fix: 修复JavaScript变量名冲突导致页面无法加载的问题

Coze-Commit-Type: user
Coze-User-ID: 3722323274763196
Coze-Conversation-ID: 9894087
This commit is contained in:
user9994793890
2026-07-10 13:07:58 +08:00
parent 2d9951de59
commit 0ebc35398d
2 changed files with 11 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -640,9 +640,9 @@
// 当前实体加载状态 // 当前实体加载状态
let currentEntityType = ''; let currentEntityType = '';
let currentPage = 1; let entityPage = 1;
let currentSearch = ''; let currentSearch = '';
const pageSize = 100; const entityPageSize = 100;
// 加载企业/用户列表(支持分页和搜索) // 加载企业/用户列表(支持分页和搜索)
async function loadEntities(page = 1, search = '') { async function loadEntities(page = 1, search = '') {
@@ -658,19 +658,19 @@
currentEntityType = splitType === 'company_id' ? 'company' : currentEntityType = splitType === 'company_id' ? 'company' :
splitType === 'user_id' ? 'user' : splitType === 'user_id' ? 'user' :
splitType === 'station_id' ? 'station' : ''; splitType === 'station_id' ? 'station' : '';
currentPage = page; entityPage = page;
currentSearch = search; currentSearch = search;
select.innerHTML = '<option value="">加载中...</option>'; select.innerHTML = '<option value="">加载中...</option>';
try { try {
const response = await fetch(`/api/entities?type=${currentEntityType}&page=${page}&page_size=${pageSize}&search=${encodeURIComponent(search)}`); const response = await fetch(`/api/entities?type=${currentEntityType}&page=${page}&page_size=${entityPageSize}&search=${encodeURIComponent(search)}`);
const result = await response.json(); const result = await response.json();
if (result.success) { if (result.success) {
const entities = result.data; const entities = result.data;
const total = result.total || 0; const total = result.total || 0;
const totalPages = Math.ceil(total / pageSize); const totalPages = Math.ceil(total / entityPageSize);
if (entities.length === 0) { if (entities.length === 0) {
select.innerHTML = '<option value="">无数据</option>'; select.innerHTML = '<option value="">无数据</option>';
@@ -714,9 +714,9 @@
} }
let html = `<small class="text-muted">共 ${total} 条</small>`; let html = `<small class="text-muted">共 ${total} 条</small>`;
html += `<button type="button" class="btn btn-sm btn-secondary" onclick="loadEntities(${currentPage - 1}, currentSearch)" ${currentPage <= 1 ? 'disabled' : ''}>上一页</button>`; html += `<button type="button" class="btn btn-sm btn-secondary" onclick="loadEntities(${entityPage - 1}, currentSearch)" ${entityPage <= 1 ? 'disabled' : ''}>上一页</button>`;
html += `<span>${currentPage}/${totalPages}</span>`; html += `<span>${entityPage}/${totalPages}</span>`;
html += `<button type="button" class="btn btn-sm btn-secondary" onclick="loadEntities(${currentPage + 1}, currentSearch)" ${currentPage >= totalPages ? 'disabled' : ''}>下一页</button>`; html += `<button type="button" class="btn btn-sm btn-secondary" onclick="loadEntities(${entityPage + 1}, currentSearch)" ${entityPage >= totalPages ? 'disabled' : ''}>下一页</button>`;
paginationDiv.innerHTML = html; paginationDiv.innerHTML = html;
} }
@@ -850,13 +850,13 @@
try { try {
// 先加载第一页数据 // 先加载第一页数据
const response = await fetch(`/api/entities?type=${entityType}&page=1&page_size=${pageSize}`); const response = await fetch(`/api/entities?type=${entityType}&page=1&page_size=${entityPageSize}`);
const result = await response.json(); const result = await response.json();
if (result.success) { if (result.success) {
const entities = result.data; const entities = result.data;
const total = result.total || 0; const total = result.total || 0;
const totalPages = Math.ceil(total / pageSize); const totalPages = Math.ceil(total / entityPageSize);
select.innerHTML = entities.map(e => { select.innerHTML = entities.map(e => {
let value = ''; let value = '';
@@ -881,7 +881,7 @@
// 更新分页UI // 更新分页UI
currentEntityType = entityType; currentEntityType = entityType;
currentPage = 1; entityPage = 1;
updatePagination(totalPages, total); updatePagination(totalPages, total);
} }
} catch (error) { } catch (error) {