Files
Mdeical_Sur_Report/工程分析/需求分析-2026-04-17-21-32-27.md

44 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 需求分析 — 2026-04-17-21-32-27
## 原始需求摘要
1. TemplateManage 字段管理中,时间/日期字段增加配置选项:
- date/time 均可选择默认值策略:「当前时间」或「手动选择(特定时间)」
- date 可选择显示格式:`YYYY-MM-DD``YYYY年MM月DD日`
- time 可选择显示格式24小时制 或 12小时制AM/PM
2. 默认模板底部写死的「年 月 日」改为动态「撰写时间」智能字段,自动取当前日期。
## 需求拆解
### 功能点
| # | 功能点 | 说明 |
|---|--------|------|
| 1 | 扩展 `FormField` 数据结构 | 新增 `timeFormat?: string``timeDefault?: 'current' \| 'specific'` |
| 2 | TemplateManage 新增字段表单增强 | 当 category === '时间' 时,显示「默认值」和「显示格式」两个配置项 |
| 3 | TemplateManage 字段编辑面板增强 | 已有时间字段点击编辑时,可修改默认值策略和显示格式 |
| 4 | 默认字段配置更新 | `surgeryDate/startTime/endTime` 加上合理的默认配置;新增 `reportDate` 字段 |
| 5 | 默认模板底部「撰写时间」 | `defaultContent.ts` 底部静态文本替换为 `${smartField('reportDate')}` |
| 6 | ReportEditor date 字段格式同步 | smart field 同步时根据 `timeFormat` 转换日期显示格式 |
| 7 | ReportEditor time 字段格式同步 | smart field 同步时根据 `timeFormat` 转换时间显示格式12h/24h |
| 8 | ReportEditor time 字段 12h 表单渲染 | time 字段表单增加 AM/PM 选择,与 hour/minute 联动 |
| 9 | ReportEditor 自动填充当前时间 | 组件初始化时,对 `timeDefault === 'current'` 且值为空的字段自动填充 |
| 10 | 通用 time 字段表单渲染 | 非 `startTime/endTime` 的 time 字段新增 hour+minute select 渲染 |
### 非功能点
- 向后兼容:未配置 `timeFormat/timeDefault` 的现有字段按原有行为工作
- 最小侵入不改动现有数据存储结构date 仍存 `YYYY-MM-DD`time 仍存 `HH:MM``startHour:startMinute`
## 影响范围预估
| 模块 | 影响程度 | 说明 |
|------|---------|------|
| `src/types.ts` | 高 | `FormField` 接口扩展 + `DEFAULT_FORM_FIELDS` 新增/更新 |
| `src/utils/defaultContent.ts` | 中 | 底部静态文本替换为 smartField |
| `src/pages/TemplateManage.tsx` | 高 | 新增字段表单、字段编辑面板、保存逻辑均需改动 |
| `src/pages/ReportEditor.tsx` | 高 | date/time 表单渲染、smart field 同步、初始化自动填充 |
## 待确认问题
无(用户已明确需求)。