Files
ftb-project-management/apps/web/lib/overtime.ts
Script Generator 2acc9aeaa9 feat: 版本详情完整功能 + 数据串联 + 登录模块
- 版本详情:关联需求Tab(从需求池添加已采纳需求/移除释放)
- 版本详情:调研/产品方案/UI设计Tab(计划CRUD、完成提交成果、耗时统计)
- 版本详情:超期校验(结束日期超版本截止需填写原因)
- 版本详情:概览统计卡片(加班时长/排名/原因占比)
- 数据串联:产品→项目→版本→需求→加班全链路贯通
- 版本管理:规划中版本可删除,删除释放关联需求
- 数据清理:仅保留翻台宝/值班,需求池10条值班待评审需求
- 修复:列表页overflow裁剪菜单问题(4个页面统一修复)
- 新增:登录模块、AuthGuard、VersionPlan store

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-10 17:07:36 +08:00

48 lines
1.2 KiB
TypeScript

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<string, string> = {
'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;
}