docs(dacli-ts): test render 添加 form module 用法 (formData/columnData 字段对比)

- B-16 (2026-06-27): dacli test render --module=form --formId=X 验证 form 渲染契约
- 算法镜像 web 端 ColumnDesign/Main.vue:228-247 + columnData.columnList
- 空数据 fallback: tables[].fields (DB schema)
- 验证: tds_space_b3 + tds_policy_b3 PASS 2/2
This commit is contained in:
ssw committed 2026-06-27 20:12:13 +08:00
1 parent ab5502aa46
commit cdca791cea
1 file changed
+15 -3
+15 -3
View File
@@ -360,6 +360,7 @@ dacli dict typeCreate --fullName="TestDup2" --enCode="tdd10duptestv1" --parentId
| `dacli test run --formId=X` | **沉淀自 tdd10**: 跑 form API 测试 (POST/GET/PUT/DELETE 全流程, ~5s). 输出 markdown 报告 | `516f396` |
| `dacli test gen --formId=X` | P1 stub: 从 form schema 生成可重用 shell/python 脚本 | `516f396` |
| `dacli test render --module=dict [--typeId=X] [--id=Y]` | **★ 替代浏览器验证 (2026-06-27)**: 读 vue 渲染契约 + 调 API, 检查字段完整性 (~2s) | (new) |
| `dacli test render --module=form --formId=X` | **★ form module (2026-06-27)**: 读 formData.fields[].__vModel__ + columnData.columnList[].prop, 调 getModelList 对比 (主子表递归) | (new) |
| ~~`dacli test check --formId=X`~~ | **v0.11+ 已删**: schema 完整性已被 webapi 镜像自动保证 | — |
**何时用 test**:
@@ -372,7 +373,7 @@ dacli dict typeCreate --fullName="TestDup2" --enCode="tdd10duptestv1" --parentId
- **命名说明**: 主命令 `dacli test`, 对齐 `npm test` / `pytest` / `go test` 惯例. 早期 v0.11+ 命名为 `testcase`, 已统一为 `test`.
**`test render` 详细说明** (★ 替代浏览器验证):
- 算法: `@vue/compiler-sfc` 解析 web/.../sysData/dictionary/{index,Form,components/index,components/Form}.vue
- 算法 (dict module): `@vue/compiler-sfc` 解析 web/.../sysData/dictionary/{index,Form,components/index,components/Form}.vue
- list mode: 提取 `BasicColumn[].dataIndex` (列表渲染字段)
- form mode: 提取 `useForm({schemas:[{field}]}).field` (表单渲染字段)
- 调对应 API 拿当前数据
@@ -382,15 +383,26 @@ dacli dict typeCreate --fullName="TestDup2" --enCode="tdd10duptestv1" --parentId
- 字典数据列表 (vue: index.vue + API: GET /DictionaryData/{typeId})
- 字典类型编辑表单 (vue: components/Form.vue + API: GET /DictionaryType/{id})
- 字典数据编辑表单 (vue: Form.vue + API: GET /DictionaryData/{id}/Info)
- B 铁律对应: B1 列表渲染 / B2 表单渲染 / B3 详情渲染 / B4 更新后状态
- 算法 (form module, 2026-06-27 NEW):
- webapi 镜像 `loadVisualDev.getInfo(formId)` 拿 formData/columnData/tables
- 提取 formData.fields[].__vModel__ (含主子表递归: jnpfKey=table 时下钻 __config__.children)
- 镜像 web 端 `ColumnDesign/Main.vue:228-247 formFieldsOptions` 的 loop 逻辑
- 提取 columnData.columnList[].prop (列表渲染字段, 主表字段)
- 调 `getModelList({modelId:formId, currentPage:1, pageSize:10})` 拿实际数据
- **空数据 fallback**: 用 formData.tables[].fields (DB schema) 作为字段对比基准
- 镜像 web 端 `Form.vue:216-219 state.tables[i].fields` (创建时声明的物理表 schema)
- 对比: 渲染字段 ⊆ API 字段 (或 tables fallback) ? PASS : FAIL
- 用法示例:
```bash
dacli test render --module=dict # 仅验证类型列表
dacli test render --module=dict --typeId=840592399989211141 # + 验证某类型数据列表
dacli test render --module=dict --typeId=X --id=Y # + 验证某条数据表单
dacli test render --module=dict --json | jq '.results[].status' # 批量跑
dacli test render --module=form --formId=840616900198137861 # form 渲染 (formData+columnData)
dacli test render --module=form --formId=X --json # 批量跑 (jq '.results[].status')
```
- Phase B 计划: form / menu / workflow / di 等模块
- B 铁律对应: B1 列表渲染 / B2 表单渲染 / B3 详情渲染 / B4 更新后状态
- Phase B 计划: menu / workflow / di 等模块
## 📚 详细文档(按需加载,按用途查 references/)