Fix new template disappearing after save

- Update TemplateManage save flows to use the current in-memory template list instead of stale localStorage as the source of truth.

- Merge current templates back into the compatibility cache so newly created backend templates are not dropped on content save.

- Add an accessible label for the new-template button to support reliable E2E coverage.

- Add template list merge unit tests covering stale-cache replacement and newly created templates.

- Add Playwright coverage for creating a template, saving template content, and confirming it remains visible and persisted.

- Update feature, progress, testing, and AGENTS documentation for the template management fix.
This commit is contained in:
2026-05-02 03:42:41 +08:00
parent b346b7e194
commit d61ee4f83a
8 changed files with 96 additions and 20 deletions

View File

@@ -14,6 +14,7 @@
- 报告 API 已实现列表、详情、创建、保存、完成修订、历史记录和软删除;`ReportManage``ReportView``ReportEditor` 已优先调用后端,只有开发/显式回退模式下才保留本地回退。
- 后端报告校验已区分草稿和完成状态:草稿允许患者姓名/住院号暂空,完成报告仍强制要求。
- 模板管理、字段库、模板导入导出已实现;模板 API 已支持可用/可管理列表、详情、创建、更新、删除和个人模板;字段库已优先接入 `/api/library/fields`
- 模板管理新增后保存内容已改为基于当前页面 state 更新,并与本地兼容缓存合并,避免旧缓存把新建模板从列表中冲掉。
- 用户管理、部门管理员约束和部门模板授权已优先接入后端 Users/Departments API签名上传和模板图片资源已通过 Files API 写入后端文件资源。
- 系统设置、抽帧策略、AI Provider、语音参数和默认模板已优先接入 Settings API只有开发/显式回退模式下才保留本地缓存回退。
- Docker/Nginx 静态部署配置已存在。
@@ -81,3 +82,4 @@
| 2026-05-02 | 修正报告草稿后端校验和保存失败提示,补充麦克风启动前置检查。 |
| 2026-05-02 | 增加 Nginx 和 NestJS 请求体上限配置,修复大图文报告保存 `request entity too large`。 |
| 2026-05-02 | 新增 Docker HTTPS 演示入口和麦克风访问说明,解决非安全上下文下语音听写不可启动的问题。 |
| 2026-05-02 | 修复模板管理中新建模板后点击保存内容导致模板从列表消失的问题,并补充单元测试和 E2E。 |