# Implementation Plan: Yearly Dashboard Summary ## Overview 实现仪表盘年度汇总功能,包括后端API和前端展示组件。 ## Tasks - [x] 1. 实现后端年度汇总API - [x] 1.1 在 WorkRecordService 中添加 get_yearly_summary 方法 - 复用 ExportService 的数据聚合逻辑 - 返回按人员分组的月度收入数据 - 人员按姓名字母顺序排序 - _Requirements: 3.1, 3.2, 4.1, 4.3_ - [x] 1.2 在 work_record_routes 中添加 yearly-summary 端点 - GET /api/work-records/yearly-summary - 参数验证:year 必须为有效整数 - _Requirements: 3.1, 3.4_ - [ ]* 1.3 编写属性测试:Grand Total Correctness - **Property 1: Grand Total Correctness** - **Validates: Requirements 1.3, 3.3** - [ ]* 1.4 编写属性测试:Dashboard-Export Consistency - **Property 3: Dashboard-Export Consistency** - **Validates: Requirements 4.1** - [x] 2. Checkpoint - 确保后端测试通过 - 确保所有测试通过,如有问题请询问用户 - [x] 3. 实现前端年度汇总展示 - [x] 3.1 在 api.js 中添加 getYearlySummary 方法 - 调用 /api/work-records/yearly-summary 端点 - _Requirements: 2.2_ - [x] 3.2 在 Dashboard.jsx 中添加年度汇总区域 - 添加年份选择器,默认当前年份 - 添加年度汇总表格,显示人员、12个月收入、年度合计 - 添加合计行显示每月总计和年度总计 - 处理空数据状态 - _Requirements: 1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 2.3, 4.2_ - [x] 4. Final Checkpoint - 确保功能完整 - 确保所有测试通过,如有问题请询问用户 ## Notes - 标记 `*` 的任务为可选任务,可跳过以加快MVP开发 - 后端数据计算逻辑应与 ExportService 保持一致 - 前端表格样式应与现有月度报告保持一致