优化: 项目进度改为真实任务完成率
- 进度条不再用阶段写死百分比,改为已完成任务数/总任务数 - 复用现有任务计数通道,零后端改动;无任务项目显示无任务不伪造数字 - 阶段映射表仅保留颜色文案用途
This commit is contained in:
+13
-12
@@ -1,7 +1,8 @@
|
||||
//! 项目 & 任务状态映射常量
|
||||
//!
|
||||
//! 统一各视图(Projects/ProjectDetail/Tasks/Dashboard)的 label / badge / 阶段进度,
|
||||
//! 统一各视图(Projects/ProjectDetail/Tasks/Dashboard)的 label / badge / 阶段颜色档,
|
||||
//! 根治此前三套状态映射互相矛盾、任务文案两处不一致的问题。
|
||||
//! 项目进度不在此处(按 stage 拍百分比已废弃),由任务完成率计算,见 store.projectTaskProgress。
|
||||
|
||||
// ── 项目状态 ──
|
||||
|
||||
@@ -36,12 +37,10 @@ export const PROJECT_STATUS_BADGE_CLASS: Record<string, string> = {
|
||||
cancelled: 'stage-dim',
|
||||
}
|
||||
|
||||
/** 项目状态 → 阶段/进度信息(详情页 pipeline + Dashboard 进度条共用) */
|
||||
/** 项目状态 → 阶段信息(Dashboard 阶段 dot/chip/fill 颜色档与文案共用) */
|
||||
export interface ProjectStageInfo {
|
||||
/** pipeline 步骤索引 0-4: idea/requirement/coding/testing/release */
|
||||
stepIndex: number
|
||||
/** 进度百分比 */
|
||||
progress: number
|
||||
/** Dashboard dot/chip 颜色档: coding/testing/release */
|
||||
stage: string
|
||||
}
|
||||
@@ -49,14 +48,16 @@ export interface ProjectStageInfo {
|
||||
// 对齐 7 态。stage 值决定 Dashboard dot/chip/fill 颜色档(planning/coding/testing/release/paused/cancelled),
|
||||
// 需与 ActiveProjectsPanel.vue 的 dot-*/chip-*/fill-* 类一一对应(paused 为该组件新增 dim 类)。
|
||||
// 'active' 键已删,老数据兜底走 projectStageInfo 默认 planning。
|
||||
// 进度百分比已移出本表:进度改由任务完成率计算(store.projectTaskProgress),
|
||||
// stage 枚举与任务完成度无必然对应,固定映射会给出与实际不符的数字。
|
||||
export const PROJECT_STAGE_INFO: Record<string, ProjectStageInfo> = {
|
||||
planning: { stepIndex: 0, progress: 20, stage: 'planning' },
|
||||
in_progress: { stepIndex: 2, progress: 55, stage: 'coding' },
|
||||
testing: { stepIndex: 3, progress: 80, stage: 'testing' },
|
||||
releasing: { stepIndex: 4, progress: 95, stage: 'release' },
|
||||
completed: { stepIndex: 4, progress: 100, stage: 'release' },
|
||||
paused: { stepIndex: 1, progress: 40, stage: 'paused' },
|
||||
cancelled: { stepIndex: 0, progress: 0, stage: 'cancelled' },
|
||||
planning: { stepIndex: 0, stage: 'planning' },
|
||||
in_progress: { stepIndex: 2, stage: 'coding' },
|
||||
testing: { stepIndex: 3, stage: 'testing' },
|
||||
releasing: { stepIndex: 4, stage: 'release' },
|
||||
completed: { stepIndex: 4, stage: 'release' },
|
||||
paused: { stepIndex: 1, stage: 'paused' },
|
||||
cancelled: { stepIndex: 0, stage: 'cancelled' },
|
||||
}
|
||||
|
||||
export function projectStatusLabel(status: string): string {
|
||||
@@ -69,7 +70,7 @@ export function projectBadgeClass(status: string): string {
|
||||
|
||||
export function projectStageInfo(status: string): ProjectStageInfo {
|
||||
// 兜底用字面量而非 PROJECT_STAGE_INFO.planning,避免已删键的隐式依赖
|
||||
return PROJECT_STAGE_INFO[status] ?? { stepIndex: 0, progress: 0, stage: 'planning' }
|
||||
return PROJECT_STAGE_INFO[status] ?? { stepIndex: 0, stage: 'planning' }
|
||||
}
|
||||
|
||||
// ── 任务状态 ──
|
||||
|
||||
Reference in New Issue
Block a user