fix(frontend): 对齐数据任务详情状态

This commit is contained in:
caoxiaozhu
2026-07-27 10:03:52 +08:00
parent b14b2ecf22
commit b4927a8952
6 changed files with 112 additions and 57 deletions

View File

@@ -0,0 +1,13 @@
import type { DataProcessStatus } from '@/types/dataProcess'
export type DataProcessStatusTagType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
export interface DataProcessStatusLike {
status?: DataProcessStatus
output_dataset_id?: string | number | null
}
export function dataProcessDisplayStatus(task: DataProcessStatusLike): {
label: string
type: DataProcessStatusTagType
}

View File

@@ -0,0 +1,18 @@
/**
* 将数据处理任务的执行状态与当前轮发布指针合并为用户可理解的状态。
* 上一轮保留的 output_datasets 不参与判断,避免将尚未重新发布的当前轮误标为已发布。
*
* @param {{ status?: string, output_dataset_id?: string | number | null }} task
* @returns {{ label: string, type: 'primary' | 'success' | 'warning' | 'danger' | 'info' }}
*/
export function dataProcessDisplayStatus(task) {
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' }
}