fix: 修复 JS 文件拆分导致的函数重复和缺失问题
Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
@@ -1,55 +1,3 @@
|
||||
async function loadConfigs() {
|
||||
try {
|
||||
const response = await fetch('/api/config');
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
renderConfigList(result.data);
|
||||
} else {
|
||||
alert('加载配置失败: ' + result.message);
|
||||
}
|
||||
} catch (error) {
|
||||
alert('加载配置失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染配置列表
|
||||
function renderConfigList(configs) {
|
||||
const tbody = document.getElementById('config-list');
|
||||
|
||||
if (configs.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty">暂无配置,请点击"创建配置"按钮</td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
tbody.innerHTML = configs.map(config => `
|
||||
<tr>
|
||||
<td>${config.config_name}</td>
|
||||
<td>${config.split_type === 'company_id' ? '按企业ID' : '按用户ID'}</td>
|
||||
<td>${config.split_name || config.split_value}</td>
|
||||
<td>${config.selected_fields.length}</td>
|
||||
<td>
|
||||
<span class="status-badge ${config.is_active ? 'status-active' : 'status-inactive'}">
|
||||
${config.is_active ? '已启用' : '已禁用'}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="action-buttons">
|
||||
<button class="btn btn-sm btn-warning" onclick="toggleConfig(${config.id})">
|
||||
${config.is_active ? '禁用' : '启用'}
|
||||
</button>
|
||||
<button class="btn btn-sm btn-primary" onclick="editConfig(${config.id})">编辑</button>
|
||||
<button class="btn btn-sm btn-success" onclick="copyConfig(${config.id})">复制</button>
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteConfig(${config.id})">删除</button>
|
||||
<button class="btn btn-sm" onclick="moveConfig(${config.id}, 'up')">↑</button>
|
||||
<button class="btn btn-sm" onclick="moveConfig(${config.id}, 'down')">↓</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// 显示创建模态框
|
||||
function showCreateModal() {
|
||||
editingConfigId = null;
|
||||
document.getElementById('modal-title').textContent = '创建配置';
|
||||
|
||||
Reference in New Issue
Block a user