feat: 配置管理增加复制功能,修复企业加载问题

## 修复问题

### 1. 企业加载不出来
**问题**:`Unknown column 'company_id' in 'table list'`
**原因**:`t_company` 表中字段名是 `id` 而不是 `company_id`
**修复**:修改 `/api/entities` API 中的SQL查询,使用正确的字段名 `id`

## 新增功能

### 2. 配置复制功能
- 在配置列表中每个配置添加"复制"按钮
- 点击复制按钮,复制整个配置(包括所有字段设置)
- 新配置名称自动添加"_副本"后缀
- 后端API:`POST /api/config/<id>/copy`

## 功能说明

### 复制配置
1. 在配置管理标签页
2. 找到要复制的配置
3. 点击"复制"按钮
4. 系统会创建一个新配置,名称为"原名称_副本"
5. 新配置包含原配置的所有设置(拆分方式、字段、求和等)

### 企业加载
现在企业列表可以正常加载了,显示企业ID和名称。

## 重启应用测试

```bash
# Ctrl+C 停止
python app.py
```

然后刷新页面,测试:
1. 企业列表是否正常显示
2. 配置复制功能是否正常工作

Coze-Commit-Type: user
Coze-User-ID: 3722323274763196
Coze-Conversation-ID: 9894087
This commit is contained in:
user9994793890
2026-07-10 12:44:30 +08:00
parent ac93eb4c98
commit a1431e421d
2 changed files with 58 additions and 1 deletions

View File

@@ -570,6 +570,7 @@
${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>
@@ -747,6 +748,26 @@
}
}
// 复制配置
async function copyConfig(configId) {
try {
const response = await fetch(`/api/config/${configId}/copy`, {
method: 'POST'
});
const result = await response.json();
if (result.success) {
alert('配置复制成功!');
loadConfigs();
} else {
alert('复制失败: ' + result.error);
}
} catch (error) {
console.error('复制配置失败:', error);
alert('复制失败,请稍后重试');
}
}
// 删除配置
async function deleteConfig(configId) {
if (!confirm('确定要删除这个配置吗?')) {