2026-07-13 16:14:22 +08:00
|
|
|
|
// 全局错误处理,防止JavaScript错误中断执行
|
|
|
|
|
|
window.onerror = function(msg, url, line, col, error) {
|
|
|
|
|
|
console.error('JavaScript错误:', msg, 'at', url, 'line:', line);
|
|
|
|
|
|
return true; // 阻止错误传播
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
// 全局变量
|
2026-07-13 16:14:22 +08:00
|
|
|
|
let editingConfigId = null;
|
|
|
|
|
|
let allFields = [];
|
|
|
|
|
|
let currentPage = 1;
|
|
|
|
|
|
let pageSize = 10;
|
|
|
|
|
|
let currentEntityType = '';
|
|
|
|
|
|
let currentSearch = '';
|
|
|
|
|
|
let entityPage = 1;
|
|
|
|
|
|
let entityPageSize = 20;
|
|
|
|
|
|
let selectedEntityIds = new Set();
|
2026-07-13 16:10:13 +08:00
|
|
|
|
let fieldCustomNames = {};
|
|
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
// 标签切换
|
|
|
|
|
|
function switchTab(tabName) {
|
|
|
|
|
|
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
|
|
|
|
|
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
|
2026-07-13 16:10:13 +08:00
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
document.querySelector(`.tab[onclick="switchTab('${tabName}')"]`).classList.add('active');
|
|
|
|
|
|
document.getElementById(`${tabName}-tab`).classList.add('active');
|
2026-07-13 16:10:13 +08:00
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
if (tabName === 'config') {
|
|
|
|
|
|
loadConfigs();
|
|
|
|
|
|
} else if (tabName === 'generate') {
|
|
|
|
|
|
loadGenerateConfigs();
|
|
|
|
|
|
} else if (tabName === 'history') {
|
|
|
|
|
|
loadHistory();
|
2026-07-13 16:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
// 格式化日期时间
|
|
|
|
|
|
function formatDateTime(dateStr) {
|
|
|
|
|
|
if (!dateStr) return '';
|
|
|
|
|
|
const date = new Date(dateStr);
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
|
const hours = String(date.getHours()).padStart(2, '0');
|
|
|
|
|
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
|
|
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
2026-07-13 16:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
// 显示错误提示
|
|
|
|
|
|
function showError(message) {
|
|
|
|
|
|
alert('错误:' + message);
|
2026-07-13 16:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-13 16:17:11 +08:00
|
|
|
|
// 显示成功提示
|
|
|
|
|
|
function showSuccess(message) {
|
|
|
|
|
|
alert('成功:' + message);
|
2026-07-13 16:10:13 +08:00
|
|
|
|
}
|
2026-07-13 16:20:40 +08:00
|
|
|
|
|
|
|
|
|
|
// 页面加载时自动加载配置列表
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
loadConfigs();
|
|
|
|
|
|
});
|