fix: 修复JavaScript变量名冲突导致页面无法加载的问题
Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
BIN
assets/image_20260710130443960.png
Normal file
BIN
assets/image_20260710130443960.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user