feat(frontend): 完善数据任务数量与状态

This commit is contained in:
caoxiaozhu
2026-07-27 09:50:26 +08:00
parent 895983ac20
commit 88a82ed771
2 changed files with 53 additions and 10 deletions

View File

@@ -26,6 +26,26 @@ assert.ok(source.includes('ElMessageBox.confirm('), '删除任务前缺少二次
assert.ok(source.includes('await deleteDataProcessTask(row.id)'), '删除操作没有调用真实 API')
assert.ok(!source.includes('TODO: 接入真实接口'), '列表仍包含本地 Mock 任务')
assert.ok(source.includes('const dataList = ref<DataProcessTask[]>([])'), '任务列表必须以空数组初始化并等待真实 API 数据')
assert.match(source, /label="文档数量"[\s\S]*?documentCountLabel\(row as DataProcessTask\)/, '任务列表没有展示真实文档数量')
assert.match(source, /function documentCountLabel\(task: DataProcessTask\)[\s\S]*?`\$\{safeCount\(task\.source_file_count\)\} 个`/, '文档数量没有使用 source_file_count 或缺少单位')
assert.match(source, /label="生成个数"[\s\S]*?generatedCountLabel\(row as DataProcessTask\)/, '任务列表没有展示真实生成数量')
assert.match(source, /function generatedCountLabel\(task: DataProcessTask\)[\s\S]*?`\$\{safeCount\(task\.output_count\)\} 条`/, '生成数量没有使用 output_count 或缺少单位')
assert.doesNotMatch(source, /label="源数据集"|label="输出数据集"/, '任务列表仍使用旧的数据集列标题')
for (const label of ['待生成', '生成中', '已生成', '已发布', '生成失败', '已停止']) {
assert.ok(source.includes(`label: '${label}'`), `任务状态缺少“${label}`)
}
assert.match(source, /task\.status === 'completed'[\s\S]*?task\.output_dataset_id[\s\S]*?已发布[\s\S]*?已生成/, '完成任务没有按当前轮输出指针区分已生成与已发布')
assert.doesNotMatch(source, /task\.output_datasets\?\.length[\s\S]*?已发布/, '上一轮保留的数据集不应将当前轮标记为已发布')
for (const [label, type] of [
['待生成', 'info'],
['生成中', 'primary'],
['已生成', 'warning'],
['已发布', 'success'],
['生成失败', 'danger'],
['已停止', 'info'],
]) {
assert.ok(source.includes(`label: '${label}', type: '${type}'`), `任务状态“${label}”颜色应为 ${type}`)
}
assert.match(apiSource, /export (?:async )?function getDataProcessTasks/, 'API 模块缺少任务列表方法')
assert.match(apiSource, /export const deleteDataProcessTask/, 'API 模块缺少任务删除方法')