feat(开发任务): 状态流转接入单条工作流

This commit is contained in:
Script Generator
2026-06-25 14:04:45 +08:00
parent 168c748835
commit 52833d81ac
6 changed files with 187 additions and 109 deletions

View File

@@ -3,6 +3,15 @@ import { calcWorkHours, formatWorkHours, type TimeInterval } from './work-hours'
export type DevTaskStatus = 'todo' | 'in_progress' | 'testing' | 'submitted';
export type ReferenceType = 'requirement' | 'prototype_note' | 'external';
export interface Reference {
type: ReferenceType;
id: string;
label: string;
url?: string;
}
export interface DevTask {
id: string;
taskNo: string;
@@ -16,6 +25,7 @@ export interface DevTask {
expectedStartAt: string;
expectedEndAt: string;
estimateHours?: number;
actualStartAt?: string;
actualEndAt?: string;
@@ -27,6 +37,9 @@ export interface DevTask {
riskLevel?: 'low' | 'medium' | 'high';
delayReason?: string;
overdueVersionReason?: string;
references?: Reference[];
aiDraft?: boolean;
aiDraftAt?: string;
createdBy: string;
createdAt: string;
updatedAt: string;
@@ -84,6 +97,9 @@ export function formatHours(hours: number): string {
}
export function getEstimateHours(task: DevTask): number {
if (typeof task.estimateHours === 'number' && task.estimateHours > 0) {
return Math.round(task.estimateHours * 2) / 2;
}
if (!task.expectedStartAt || !task.expectedEndAt) return 0;
return calcWorkHours(task.expectedStartAt, task.expectedEndAt);
}
@@ -162,7 +178,6 @@ export function isLegacyTask(t: any): boolean {
'startDate' in t ||
'dueDate' in t ||
'completedAt' in t ||
'estimateHours' in t ||
'actualHours' in t ||
'overdueReason' in t
);