feat: AI Worker 平台 MVP v1.0.0 - 多租户/项目管理/AI Worker/任务编排/HITL审核/成本治理
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import type { TaskStatus, ProjectStatus, TaskPriority } from '@/types';
|
||||
import { Tag } from 'antd';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export const taskStatusConfig: Record<
|
||||
TaskStatus,
|
||||
{ label: string; color: string; tagColor: string }
|
||||
> = {
|
||||
pending: { label: '待处理', color: '#8c8c8c', tagColor: 'default' },
|
||||
assigned: { label: '已分配', color: '#1677ff', tagColor: 'blue' },
|
||||
in_progress: { label: '进行中', color: '#fa8c16', tagColor: 'orange' },
|
||||
review: { label: '待审核', color: '#722ed1', tagColor: 'purple' },
|
||||
done: { label: '已完成', color: '#52c41a', tagColor: 'green' },
|
||||
rejected: { label: '已拒绝', color: '#f5222d', tagColor: 'red' },
|
||||
cancelled: { label: '已取消', color: '#8c8c8c', tagColor: 'default' },
|
||||
};
|
||||
|
||||
export const taskStatusList: TaskStatus[] = [
|
||||
'pending',
|
||||
'assigned',
|
||||
'in_progress',
|
||||
'review',
|
||||
'done',
|
||||
'rejected',
|
||||
'cancelled',
|
||||
];
|
||||
|
||||
export const projectStatusConfig: Record<
|
||||
ProjectStatus,
|
||||
{ label: string; color: string }
|
||||
> = {
|
||||
planning: { label: '规划中', color: 'default' },
|
||||
active: { label: '进行中', color: 'processing' },
|
||||
paused: { label: '已暂停', color: 'warning' },
|
||||
completed: { label: '已完成', color: 'success' },
|
||||
cancelled: { label: '已取消', color: 'error' },
|
||||
};
|
||||
|
||||
export const priorityConfig: Record<TaskPriority, { label: string; color: string }> = {
|
||||
low: { label: '低', color: 'default' },
|
||||
medium: { label: '中', color: 'blue' },
|
||||
high: { label: '高', color: 'orange' },
|
||||
urgent: { label: '紧急', color: 'red' },
|
||||
};
|
||||
|
||||
export function TaskStatusTag({ status }: { status: TaskStatus }) {
|
||||
const cfg = taskStatusConfig[status];
|
||||
return <Tag color={cfg.tagColor}>{cfg.label}</Tag>;
|
||||
}
|
||||
|
||||
export function ProjectStatusTag({ status }: { status: ProjectStatus }) {
|
||||
const cfg = projectStatusConfig[status];
|
||||
return <Tag color={cfg.color}>{cfg.label}</Tag>;
|
||||
}
|
||||
|
||||
export function PriorityTag({ priority }: { priority: TaskPriority }) {
|
||||
const cfg = priorityConfig[priority];
|
||||
return <Tag color={cfg.color}>{cfg.label}</Tag>;
|
||||
}
|
||||
|
||||
export function StatusDot({ status }: { status: TaskStatus }): ReactNode {
|
||||
const cfg = taskStatusConfig[status];
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: 8,
|
||||
height: 8,
|
||||
borderRadius: '50%',
|
||||
backgroundColor: cfg.color,
|
||||
marginRight: 6,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user