export interface OvertimeRecord { id: string; projectId: string; versionId?: string; requirementId?: string; person: string; startTime: string; endTime: string; duration: number; reasonId: string; remark?: string; createdAt: string; } export type OvertimeReason = | 'requirement_change' | 'requirement_add' | 'version_sprint' | 'bug_fix' | 'online_issue' | 'test_fix' | 'tech_difficulty' | 'integration_issue' | 'upstream_delay' | 'overload' | 'rework'; export const OVERTIME_REASON_LABEL: Record = { 'reason-1': '需求变更', 'reason-2': '需求新增', 'reason-3': '版本冲刺', 'reason-4': 'Bug修复', 'reason-5': '线上问题修复', 'reason-6': '测试问题整改', 'reason-7': '技术难点攻关', 'reason-8': '联调问题', 'reason-9': '上游交付延误', 'reason-10': '工作量超负荷', 'reason-11': '返工修改', }; export function calcDuration(start: string, end: string): number { const s = new Date(start).getTime(); const e = new Date(end).getTime(); if (isNaN(s) || isNaN(e) || e <= s) return 0; return Math.round(((e - s) / (1000 * 60 * 60)) * 10) / 10; }