feat: 实现需求管理、加班记录、成员/角色管理模块

- 需求模块:完整 CRUD、状态流转(采纳/拒绝/关闭)、详情抽屉、产品→项目级联选择
- 加班记录:产品→项目→版本三级联动、月份筛选(MonthPicker)、CSV 导出
- 成员管理:左右布局(部门树+成员列表)、手机号脱敏、初始密码自动生成及规则设置
- 角色管理:卡片列表、系统角色保护、CRUD
- 通用组件:FilterSelect 下拉、MonthPicker 月份选择器、Pagination 分页
- 样式统一:状态标签加 border、日期输入现代化、筛选组件风格一致

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-09 18:16:18 +08:00
parent 24ba61f929
commit 9a0b16a8f1
36 changed files with 4355 additions and 272 deletions

46
apps/web/lib/overtime.ts Normal file
View File

@@ -0,0 +1,46 @@
export interface OvertimeRecord {
id: string;
projectId: string;
versionId?: 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;
}