Include field library metadata in template exports

- Add fieldLibrary metadata to HTML template packages, including form fields, custom time formats, multi-select options, and anesthesia options.

- Restore imported template field metadata into local compatibility caches and the backend field library API when available.

- Preserve legacy JSON template import compatibility while keeping user-facing exports on HTML packages.

- Prevent template field saves from overwriting stored multi-select and anesthesia options with empty values.

- Update README, AGENTS, feature, requirement, design, module, progress, component, and testing docs for complete template export behavior.

- Extend template export tests to cover field library metadata round-tripping.
This commit is contained in:
2026-05-02 04:27:08 +08:00
parent 03b54fe18b
commit 44decaa396
12 changed files with 171 additions and 37 deletions

View File

@@ -76,15 +76,21 @@
```json
{
"version": "1.0",
"version": "1.1",
"type": "surclaw_template_package",
"title": "模板名称",
"description": "模板描述",
"content": "模板 HTML",
"fields": []
"fields": [],
"fieldLibrary": {
"formFields": [],
"customTimeFormats": [],
"multiSelectOptions": {},
"anesthesiaOptions": []
}
}
```
HTML 模板包是一个可直接用浏览器打开的完整 HTML 文件,包含 A4 页面样式、打印样式和内嵌的 `surclaw_template_package` 元数据。它比 JSON 更适合保留“报告整体观感”,也是当前推荐的可回导模板交换格式。
HTML 模板包是一个可直接用浏览器打开的完整 HTML 文件,包含 A4 页面样式、打印样式和内嵌的 `surclaw_template_package` 元数据。元数据会随包保存模板正文、模板对应字段,以及字段管理相关设置:字段库、时间格式、多选字段选项和麻醉方式选项。它比单独 JSON 文件更适合保留“报告整体观感”,也是当前推荐的可回导模板交换格式。
PDF 导出走浏览器打印,适合归档和人工查看,不适合再次导入编辑。