From 080bd6bfbebd9cb6101bb117d865037f9dadd93b Mon Sep 17 00:00:00 2001 From: ssw Date: Mon, 6 Jul 2026 20:21:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(dacli):=20form=20create=20--ai=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=20searchList=20=E6=BC=8F=20=5F=5Fconfig=5F=5F=20?= =?UTF-8?q?=E5=8C=85=E8=A3=85=20(BS-=E6=96=B060)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 根因 dacli form create --ai / --table 路径下, buildSearchListEntry 函数只填顶层 21 个字段, 没补 __config__ 包装. 但 web 端 ListHeader/transform.ts:43 访问 data.__config__.jnpfKey 时 无防护, 触发 TypeError. ## 修复 buildSearchListEntry 函数返回值加 __config__ 包装 (与 buildColumnListEntry 对齐): jnpfKey / tag / tagIcon / label / showLabel / visibility / tableName / formId 等 ## 验证 - 1. dacli form create --ai 跑通 - 2. 提取 searchList[0] has __config__=True - 3. 批量修复 14 个 dos form 的 searchList (SQL) - 4. Playwright 实测: imageRepository/dataset/pipeline 0 错误 - 5. TC-C: PASS ## 盲点 BS-新60 (form create searchList __config__ 包装) --- src/commands/form/create.ts | 69 +++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/src/commands/form/create.ts b/src/commands/form/create.ts index 00e8460..d26c5e0 100644 --- a/src/commands/form/create.ts +++ b/src/commands/form/create.ts @@ -600,24 +600,57 @@ export function buildFormCreateCommand(): Command { // - `searchMultiple: 0` → `searchMultiple: false` (类型对齐) // - 补 8 字段 (fullNameI18nCode/clearable/disabled/style/placeholder/on/placeholderI18nCode/format) // 详见 docs/dacli/audit-form-create-deviations.md 任务4 - const buildSearchListEntry = (entry: any) => ({ - ...entry, - // === 控件行为字段 (与 columnList 对齐) === - fullNameI18nCode: [entry.fullNameI18nCode || ''], // 数组 - clearable: true, disabled: false, - style: { width: '100%' }, - placeholder: entry.placeholder || '请输入', - placeholderI18nCode: '', - on: { change: '({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}' }, - format: entry.format, // datePicker: 'yyyy-MM-dd', 其他类型透传 - // === 搜索特有 (修复 value 类型 + searchMultiple bool) === - sourceType: 2, - value: [], // 修复: 数组 (dacli 旧 value: '') - searchType: 1, - searchMultiple: false, // 修复: bool (dacli 旧 searchMultiple: 0) - isKeyword: false, - noShow: false, - }) + const buildSearchListEntry = (entry: any) => { + const jnpfKey = entry.jnpfKey || 'input' + const label = entry.fieldName || entry.field + const prop = entry.field + const tag = JNPF_TAG_MAP[jnpfKey] || 'JnpfInput' + const tagIcon = JNPF_ICON_MAP[jnpfKey] || 'icon-ym icon-ym-generator-input' + return { + // === 顶层基础字段 (与 web 对齐, 工件设计器数据格式) === + label, labelI18nCode: '', prop, + jnpfKey, // 顶层冗余 (兼容 list 渲染) + id: prop, fullName: label, + fullNameI18nCode: [entry.fullNameI18nCode || ''], + // === 控件行为字段 (与 columnList 对齐) === + clearable: true, disabled: false, readonly: false, + style: { width: '100%' }, + placeholder: entry.placeholder || '请输入', + placeholderI18nCode: '', + on: { change: '({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}' }, + format: entry.format, // datePicker: 'yyyy-MM-dd' + // === 搜索特有 === + sourceType: 2, + value: [], // 数组 (web datePicker 期望) + searchType: 1, + searchMultiple: false, + isKeyword: false, + noShow: false, + // === BS-新60 修复 (2026-07-06): 与 columnList 对齐补 __config__ 包装 === + // 根因: web ListHeader/transform.ts:43 `data.__config__.jnpfKey` 无防护 + // 影响: formData 浏览器加载时 TypeError, 整个列表页崩溃 + // 修复: searchList 项必须有 __config__.jnpfKey 包装 + __config__: { + jnpfKey, + tag, // 控件 tag + tagIcon, // 设计器图标 + label, showLabel: true, tipLabel: '', + className: [], defaultValue: '', + required: false, + visibility: ['pc', 'app'], + tableName: opts.enCode, + noShow: false, + formId: `formItem${prop}`, + renderKey: Date.now(), + regList: [], trigger: 'change', + span: 24, + layout: 'colFormItem', + dragDisabled: false, + transferList: [], + rule: entry.rule, // 数据源类型 (高代码字典类型等) + }, + } + } // v0.11 (审计修复): 与 web ColumnDesign/src/helper/config.ts:109-198 `defaultColumnData` 对齐 // 关键变更: