2026-05-09 11:30:34 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 业务对象状态颜色(ElTag type)集中配置
|
|
|
|
|
|
*
|
|
|
|
|
|
* 各业务域的 statusCode → ElTag type 在此统一维护,避免散落在各业务模块。
|
|
|
|
|
|
* 未来若后端状态字典返回颜色字段,可在调用方优先取后端值,缺失时回退此映射。
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
export type StatusTagType = 'primary' | 'success' | 'warning' | 'info' | 'danger';
|
|
|
|
|
|
|
|
|
|
|
|
export type StatusDomain =
|
|
|
|
|
|
| 'projectExecution'
|
|
|
|
|
|
| 'projectTask'
|
2026-05-12 21:41:39 +08:00
|
|
|
|
| 'executionAssignee'
|
|
|
|
|
|
| 'taskAssigneeMember'
|
2026-05-09 11:30:34 +08:00
|
|
|
|
| 'project'
|
|
|
|
|
|
| 'product'
|
|
|
|
|
|
| 'requirement'
|
|
|
|
|
|
| 'workOrder';
|
|
|
|
|
|
|
|
|
|
|
|
const statusTagTypeRegistry: Record<StatusDomain, Record<string, StatusTagType>> = {
|
|
|
|
|
|
// 项目-执行
|
|
|
|
|
|
projectExecution: {
|
|
|
|
|
|
pending: 'info',
|
|
|
|
|
|
active: 'primary',
|
|
|
|
|
|
paused: 'warning',
|
|
|
|
|
|
completed: 'success',
|
|
|
|
|
|
cancelled: 'danger'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 项目-任务
|
|
|
|
|
|
projectTask: {
|
|
|
|
|
|
pending: 'info',
|
|
|
|
|
|
active: 'primary',
|
2026-05-12 21:41:39 +08:00
|
|
|
|
paused: 'warning',
|
2026-05-09 11:30:34 +08:00
|
|
|
|
completed: 'success',
|
|
|
|
|
|
cancelled: 'danger'
|
|
|
|
|
|
},
|
2026-05-12 21:41:39 +08:00
|
|
|
|
// 执行协办人变更事件
|
|
|
|
|
|
executionAssignee: {
|
2026-05-09 11:30:34 +08:00
|
|
|
|
join: 'success',
|
|
|
|
|
|
inactive: 'danger',
|
|
|
|
|
|
owner_transfer_in: 'warning',
|
|
|
|
|
|
owner_transfer_out: 'warning'
|
|
|
|
|
|
},
|
2026-05-12 21:41:39 +08:00
|
|
|
|
// 任务协办人变更事件
|
|
|
|
|
|
taskAssigneeMember: {
|
|
|
|
|
|
join: 'success',
|
|
|
|
|
|
inactive: 'danger'
|
|
|
|
|
|
},
|
2026-05-09 11:30:34 +08:00
|
|
|
|
// 项目(待补全)
|
|
|
|
|
|
project: {},
|
|
|
|
|
|
// 产品(待补全)
|
|
|
|
|
|
product: {},
|
|
|
|
|
|
// 需求(待补全)
|
|
|
|
|
|
requirement: {},
|
|
|
|
|
|
// 工单(待补全)
|
|
|
|
|
|
workOrder: {}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export function getStatusTagType(domain: StatusDomain, statusCode: string | null | undefined): StatusTagType {
|
|
|
|
|
|
if (!statusCode) {
|
|
|
|
|
|
return 'info';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return statusTagTypeRegistry[domain][statusCode] || 'info';
|
|
|
|
|
|
}
|