auto-sync: 2026-05-20 10:23:47
This commit is contained in:
@@ -61,56 +61,7 @@ export interface V2Task {
|
||||
experiences?: any[];
|
||||
}
|
||||
|
||||
// ── Pipeline Definition (PIPE) ──
|
||||
|
||||
export const PIPE = [
|
||||
{ key: 'created', dept: '主公', icon: '👑', action: '提交' },
|
||||
{ key: 'planning', dept: '庞统', icon: '🐦', action: '拆解' },
|
||||
{ key: 'challenge', dept: '司马懿', icon: '🦅', action: '审核' },
|
||||
{ key: 'assigned', dept: '引擎', icon: '📮', action: '派发' },
|
||||
{ key: 'executing', dept: '将军', icon: '⚔️', action: '执行' },
|
||||
{ key: 'reviewing', dept: '司马懿', icon: '🔎', action: '验收' },
|
||||
{ key: 'done', dept: '完成', icon: '🏆', action: '完成' },
|
||||
] as const;
|
||||
|
||||
export const PIPE_STATE_IDX: Record<string, number> = {
|
||||
// moziplus states
|
||||
created: 0,
|
||||
planning: 1,
|
||||
challenging: 2,
|
||||
assigned: 3,
|
||||
executing: 4,
|
||||
cancelling: 4, // BUG-6: 同 executing 位置
|
||||
pausing: 4, // BUG-6: 同 executing 位置
|
||||
paused: 4,
|
||||
reviewing: 5,
|
||||
completed: 6,
|
||||
failed: 4,
|
||||
cancelled: 6,
|
||||
escalated: 4,
|
||||
// legacy edict states (backward compat)
|
||||
Inbox: 0, Menxia: 1, Zhongshu: 2, Assigned: 3,
|
||||
Doing: 4, Review: 5, Done: 6, Blocked: 4, Cancelled: 6, Next: 0,
|
||||
Taizi: 0, Pending: 0,
|
||||
};
|
||||
|
||||
export const DEPT_COLOR: Record<string, string> = {
|
||||
'主公': '#ffd700', '庞统': '#a07aff', '司马懿': '#6a9eff', '引擎': '#6aef9a',
|
||||
'张飞': '#ff5270', '关羽': '#f5c842', '赵云': '#44aaff', '姜维': '#2ecc8a',
|
||||
'诸葛亮': '#e8a040', '交付': '#2ecc8a',
|
||||
};
|
||||
|
||||
export const STATE_LABEL: Record<string, string> = {
|
||||
created: '新建', planning: '规划中', challenging: '审核中',
|
||||
assigned: '已派发', executing: '执行中', paused: '已暂停',
|
||||
cancelling: '取消中', pausing: '暂停中', // BUG-6
|
||||
reviewing: '验收中', completed: '已完成', failed: '已失败',
|
||||
cancelled: '已取消', escalated: '已升级',
|
||||
};
|
||||
|
||||
export function deptColor(d: string): string {
|
||||
return DEPT_COLOR[d] || '#6a9eff';
|
||||
}
|
||||
// ── Pipeline removed (v3.0): old 7-step PIPE replaced by EdictBoard PIPELINE_STEPS + TaskModal VALID_TRANSITIONS ──
|
||||
|
||||
export function stateLabel(t: Task): string {
|
||||
const r = t.review_round || 0;
|
||||
@@ -135,55 +86,13 @@ export function isEdict(t: Task): boolean {
|
||||
return /^TSK-/i.test(id) || /^[0-9a-f]{8}-/i.test(id) || /^[A-Za-z0-9]{10,16}$/.test(id);
|
||||
}
|
||||
|
||||
export function isSession(t: Task): boolean {
|
||||
return /^(OC-|MC-)/i.test(t.id || '');
|
||||
}
|
||||
// STATE_LABEL kept for backward compat (7 refs)
|
||||
|
||||
export function isArchived(t: Task): boolean {
|
||||
return !!t.archived;
|
||||
}
|
||||
|
||||
export type PipeStatus = { key: string; dept: string; icon: string; action: string; status: 'done' | 'active' | 'pending' };
|
||||
|
||||
export function getPipeStatus(t: Task): PipeStatus[] {
|
||||
const planStatus = t.plan_status || '';
|
||||
const nodes = t.nodes || [];
|
||||
const s = t.status || t.state; // moziplus status or legacy edict state
|
||||
|
||||
let activeIdx = PIPE_STATE_IDX[s] ?? 4;
|
||||
|
||||
// Refine based on moziplus sub-state
|
||||
if (s === 'planning') {
|
||||
if (planStatus === 'challenging') activeIdx = 2; // 审核
|
||||
else if (planStatus === 'approved') activeIdx = 3; // 派发
|
||||
else if (planStatus === 'rejected') activeIdx = 1; // 回到拆解
|
||||
else activeIdx = 1; // 拆解
|
||||
} else if (s === 'executing') {
|
||||
const hasReviewing = nodes.some((n: TaskNode) => n.status === 'reviewing');
|
||||
activeIdx = hasReviewing ? 5 : 4; // 验收 vs 执行
|
||||
} else if (s === 'failed' || s === 'cancelled') {
|
||||
// 根据实际失败阶段定位进度条
|
||||
if (planStatus === 'pending' || planStatus === 'rejected' || !planStatus) {
|
||||
activeIdx = 1; // 拆解阶段失败/取消
|
||||
} else if (planStatus === 'challenging') {
|
||||
activeIdx = 2; // 审核阶段失败/取消
|
||||
} else if (planStatus === 'approved') {
|
||||
activeIdx = 4; // 执行阶段失败/取消
|
||||
} else {
|
||||
activeIdx = 4; // 默认显示在执行
|
||||
}
|
||||
} else if (s === 'escalated') {
|
||||
activeIdx = 4;
|
||||
} else if (s === 'cancelling' || s === 'pausing') {
|
||||
// BUG-6: 停在执行阶段
|
||||
activeIdx = 4;
|
||||
}
|
||||
|
||||
return PIPE.map((stage, i) => ({
|
||||
...stage,
|
||||
status: (i < activeIdx ? 'done' : i === activeIdx ? 'active' : 'pending') as 'done' | 'active' | 'pending',
|
||||
}));
|
||||
}
|
||||
// getPipeStatus + PipeStatus removed (v3.0): dead code, zero references
|
||||
|
||||
// ── Tabs ──
|
||||
|
||||
|
||||
Reference in New Issue
Block a user