fix(frontend): 对齐数据任务详情状态
This commit is contained in:
@@ -5,8 +5,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import DataTablePage from '@/components/DataTablePage.vue'
|
||||
import { deleteDataProcessTask, getDataProcessTasks } from '@/api/modules/dataProcess'
|
||||
import type { DataProcessTask, DataProcessType } from '@/types/dataProcess'
|
||||
|
||||
type TaskStatusTagType = 'success' | 'warning' | 'info' | 'danger' | 'primary'
|
||||
import { dataProcessDisplayStatus } from '@/utils/dataProcessStatus.js'
|
||||
|
||||
const processTypeMap: Record<DataProcessType, string> = {
|
||||
structured: '结构化数据',
|
||||
@@ -87,19 +86,6 @@ function generatedCountLabel(task: DataProcessTask) {
|
||||
return `${safeCount(task.output_count)} 条`
|
||||
}
|
||||
|
||||
/** 将当前轮生成状态与发布指针合并为用户可理解的列表状态。 */
|
||||
function taskDisplayStatus(task: DataProcessTask): { label: string; type: TaskStatusTagType } {
|
||||
if (task.status === 'running') return { label: '生成中', type: 'primary' }
|
||||
if (task.status === 'completed') {
|
||||
return task.output_dataset_id
|
||||
? { label: '已发布', type: 'success' }
|
||||
: { label: '已生成', type: 'warning' }
|
||||
}
|
||||
if (task.status === 'failed') return { label: '生成失败', type: 'danger' }
|
||||
if (task.status === 'stopped') return { label: '已停止', type: 'info' }
|
||||
return { label: '待生成', type: 'info' }
|
||||
}
|
||||
|
||||
onMounted(loadData)
|
||||
</script>
|
||||
|
||||
@@ -123,10 +109,10 @@ onMounted(loadData)
|
||||
<el-table-column label="任务状态" align="center" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="taskDisplayStatus(row as DataProcessTask).type"
|
||||
:type="dataProcessDisplayStatus(row as DataProcessTask).type"
|
||||
size="small"
|
||||
effect="light"
|
||||
>{{ taskDisplayStatus(row as DataProcessTask).label }}</el-tag>
|
||||
>{{ dataProcessDisplayStatus(row as DataProcessTask).label }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理类型" align="center" width="140">
|
||||
|
||||
Reference in New Issue
Block a user