feat(web+server): 新增枚举覆写支持与CSV导出功能

1. 新增buff_target枚举覆写配置,支持选择施法目标类型
2. 后端添加CSV导出接口,生成标准化英雄设计表
3. 前端新增CSV导出按钮,支持一键导出配置
4. 优化覆写字段渲染逻辑,支持枚举值转可读枚举名
5. 清理英雄数据中冗余的summon_count默认配置
This commit is contained in:
panFD
2026-09-05 12:23:23 +08:00
parent 071afc8fa2
commit 1806f4b1a5
7 changed files with 211 additions and 40 deletions

View File

@@ -7,6 +7,7 @@
<el-button size="small" type="success" @click="doSave" :disabled="!heroes.length">保存到服务器</el-button>
<el-button size="small" type="warning" @click="doExport" :disabled="!heroes.length">导出 hexport.ts</el-button>
<el-button size="small" type="primary" @click="doApply" :disabled="!heroes.length">写入 heroSet.ts</el-button>
<el-button size="small" type="danger" @click="doExportCsv" :disabled="!heroes.length">导出英雄设计表.csv</el-button>
</div>
</header>
<div class="hero-main">
@@ -406,6 +407,22 @@ async function doApply() {
}
}
async function doExportCsv() {
try {
await ElMessageBox.confirm(
`将用 ${heroes.value.length} 个英雄覆盖写入 assets/script/game/common/config/英雄设计表.csv`,
'导出确认',
{ confirmButtonText: '覆盖写入', cancelButtonText: '取消', type: 'warning' }
)
} catch { return }
try {
const r = await api.exportCsv(heroes.value)
ElMessage.success(`已写入 ${r.count} 个英雄 → ${r.path}`)
} catch (e) {
ElMessage.error('导出失败: ' + (e?.response?.data?.error || e.message))
}
}
onMounted(() => {
loadMeta()
loadHeroes()