fix(form): B-9 自动给 tables[0].typeId='1' (主表标识, 后端 FlowFormDataUtil 需要)

dacli form create 之前 tables 推导后缺 typeId 字段,
后端 createMast:831 查 typeId='1' 找不到抛 '集合条件过滤获得目标为空' (MsgCode.COD001).
现在自动给第一个表加 typeId='1', 后续表 typeId='0' (子表).
用户 --tables 显式指定 typeId 不受影响 (if !t.typeId 检查).

镜像 web formDesign/Form.vue:288 `const typeId = i == 0 ? '1' : '0'`.
后端 jnpf/.../FlowFormDataUtil.java:831
`filter(t -> "1".equals(t.getTypeId())).findFirst()` → throw MsgCode.COD001
后端 TableModel.java:13 注释 '1-主表、0-子表'.

main 兜底 schema 已带 typeId='1' (line 124), 但用户 --tables 路径可能漏,
这里加防御性补全 (无论 --tables 还是兜底都覆盖).

tds 9 bug 复盘 2026-06-27
This commit is contained in:
ssw committed 2026-06-27 10:09:25 +08:00
1 parent 707c3fbb50
commit 94420465d2
1 file changed
+13
+13
View File
@@ -130,6 +130,19 @@ export function buildFormCreateCommand(): Command {
},
]
// 2026-06-27 B-9 修复: tables 推导后, 自动给第一个表加 typeId='1' (主表标识)
// 后端 jnpf/.../FlowFormDataUtil.java:831 查 typeId='1' 找主表, 找不到抛 MsgCode.COD001
// ("集合条件过滤获得目标为空"). 即使用户 --tables 显式传了, 也可能漏 typeId.
// 兜底 schema 已有 typeId='1' (line 124), 这里统一保护用户传入路径.
// 用户 --tables 显式指定 typeId 不受影响 (先检查 !t.typeId).
if (Array.isArray(tables) && tables.length > 0) {
tables.forEach((t: any, idx: number) => {
if (t && typeof t === 'object' && !t.typeId) {
t.typeId = idx === 0 ? '1' : '0'
}
})
}
const body: Record<string, unknown> = {
fullName: opts.fullName,
enCode: opts.enCode,