Files
dacli/docs/doc/deprecated/audit-form-create-deviations.md
T
ssw 50ab7e2a2d chore(v0.11+): 归档 dacli/doc/ → dacli/docs/doc/deprecated/ (22 文件废弃)
用户拍板 (2026-06-25): dacli/doc/ 整个目录内容已废弃, 移到 dacli/docs/doc/deprecated/.

废弃原因:
1. v0.11+ webapi 镜像架构已替代所有 extract 脚本 + 静态 JSON 快照 (architecture.md api.md extractors.md 描述的方案过时)
2. 父 CLAUDE.md + dacli/CLAUDE.md 已合并, 不再需要独立 doc/ 维护
3. v0.11+ 30+ NEW-CMD + 18 webapi 模块, 旧 plan.md 描述的命令多数已废弃

22 文件全部 git mv (rename tracking 保留历史):
- architecture.md / plan.md / api.md / extractors.md / baseline.md / help-system.md (架构 6)
- ai-error-analysis.md / ai-optimization-plan.md (AI 分析 2)
- audit-form-create-deviations.md / RESUME.md / verify-form-create-fix.mjs (实战 3)
- v0.6 ~ v0.8.4-changelog.md (11 个版本变更日志)
- v0.8-endpoints.md / v0.8-plan.md / v0.8-scan.md (v0.8 文档 3)

新增 docs/doc/deprecated/README.md 说明废弃原因 + 内容索引 + 下一步指引.
新文档统一写到 docs/ (cmd-review + skill-audit + web-patches + v0.11-next-steps-plan.md + source-analysis.md).
2026-06-25 16:18:28 +08:00

29 KiB
Raw Blame History

dacli form create 一致性核对报告

审计日期:2026-06-22 审计范围:dacli/src/commands/form/create.ts:261-304 对照源:

  • web/apps/jnpf-web-apps-main/src/components/FormGenerator/src/helper/componentMap.ts
  • web/apps/jnpf-web-apps-main/src/components/ColumnDesign/src/helper/config.ts
  • 真实表单 workSystem:585448937427567365 / workSystem:624163990351643525 / workSystem:836658473499370693 (经 dacli form info 拉取)

结论速览:4 个待验证点中,3 个确认为真实不一致(任务 1、2、3、4 全部命中),其中:

  • 任务 1(relationForm typo):bug — 含非法 key ' popupTable' 与杜撰 key searchForms,前端永不识别
  • 任务 2(columnData 缺字段):bug — 29 个 web 标准字段缺失,其中 funcs/ruleList/tabConfig 等可能引发渲染异常
  • 任务 3(columnList entry 缺字段):bug — 16 个 web 真实字段缺失;__config__ 缺 15 个子字段
  • 任务 4(searchList entry 缺字段):bug — 8 个 web 真实字段缺失

任务 1:验证 ' popupTable' / searchForms bug

文件位置

  • dacli:/home/ubuntu/ccWorkDir/dacli/src/commands/form/create.ts:299

dacli 端现状(代码片段)

// create.ts:279-304
const columnDataObj: any = {
  type: 1, pageSize: 20,
  // ...
  relationForm: { ' popupTable': '', columnOptions: [], searchForms: [] },
  // ...
}

web 端真相(代码片段)

// web/.../FormGenerator/src/helper/componentMap.ts:1363-1406
{
  __config__: {
    jnpfKey: 'relationForm',
    label: '关联表单',
    // ...
  },
  on: { change: '...' },
  style: { width: '100%' },
  placeholder: '请选择',
  modelId: '',
  relationField: '',
  hasPage: false,
  pageSize: 20,
  queryType: 0,
  propsValue: undefined,
  extraOptions: [],
  columnOptions: [],
  clearable: true,
  popupType: 'dialog',      // ← 真实字段
  popupTitle: '选择数据',   // ← 真实字段
  popupWidth: '800px',      // ← 真实字段
  filterable: false,
  disabled: false,
}

全部 web 真实字段(共 18 个):

__config__, on, style, placeholder, modelId, relationField,
hasPage, pageSize, queryType, propsValue, extraOptions, columnOptions,
clearable, popupType, popupTitle, popupWidth, filterable, disabled

全 web 源码搜索结果

$ grep -rn "searchForms\|popupTable" web/.../FormGenerator/
# 无任何命中(仅命中 popupTableSelect 控件名,但与 popupTable 不同)

结论:真不一致

  1. dacli ' popupTable' 是 typo:键名前多一个空格,且 popupTable 在 JNPF 控件库不存在(正确的是 popupType/popupTitle/popupWidth)。明显是从 popupType 抄错。
  2. dacli searchForms 完全杜撰:web 端无此字段,关系表单(relationForm)只通过 modelId + columnOptions 控制弹窗,不存在独立的 searchForms 数组。
  3. dacli columnOptions 命名合法但语义错位:web 中 columnOptions 在 relationForm 控件 schema 中表示弹窗列表展示列;dacli 写在 relationForm 内顶层是误用——dacli 把 relationForm 当作 columnData 顶层的字段了,与 web 的 columnData 顶层 relationForm: {}(空对象即可)语义不符。

影响

  • dacli 生成的表单写入 JNPF 后,relationForm 字段为 { ' popupTable': '', columnOptions: [], searchForms: [] };前端 Parser.vue 解析时全部字段被忽略(不识别带空格的 key,也不识别 searchForms)。
  • 经抽样验证 workSystem:836658473499370693(疑似 dacli 早期生成的 e2eTest1),存库后 relationForm 已被后端序列化为 {}(未知字段被丢弃),所以未引发线上 bug,但说明这段代码是死代码。
  • 不影响 list 渲染(relationForm 仅供设计器右侧面板读,列表本身用 columnList 字段)。

修复建议

文件:dacli/src/commands/form/create.ts:299

修复前:

relationForm: { ' popupTable': '', columnOptions: [], searchForms: [] },

修复后(最简:与 web 一致,返回空对象):

relationForm: {},

修复后(完整:复刻 web schema 但保持空 schema):

// 关联表单字段(design-time only, 仅设计器右侧面板读)
// 见 web/.../FormGenerator/src/helper/componentMap.ts:1363
relationForm: {
  modelId: '', relationField: '',
  hasPage: false, pageSize: 20, queryType: 0,
  columnOptions: [],
  popupType: 'dialog', popupTitle: '选择数据', popupWidth: '800px',
},

建议先用 relationForm: {},最低风险修复。后续如果需要 dacli 生成自带 relationForm 弹窗列配置的表单,再展开成完整 schema。


任务 2:验证 columnData 默认值完整性

文件位置

  • dacli:/home/ubuntu/ccWorkDir/dacli/src/commands/form/create.ts:279-304 (columnDataObj)
  • web:/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/components/ColumnDesign/src/helper/config.ts:109-198 (defaultColumnData / defaultAppColumnData)

dacli 端现状(代码片段)

// create.ts:279-304(27 字段)
const columnDataObj: any = {
  type: 1, pageSize: 20,
  showSummary: false, summaryField: '',
  btnsList: [], btnsPosition: 'right', rowBtnsList: [], columnBtnsList: [],
  sortList: [],
  useColumnPermission: false, columnPermissions: [],
  defaultSortConfig: {},
  useDataInterface: false, dataInterfaceId: '',
  pageSizes: [10, 20, 50, 100],
  showCheckbox: false,
  usePage: true, useAdvancedQuery: true, useFilter: true, useSort: true,
  useOverflow: true, useDragSort: true,
  hasPrint: false, printId: '', printBtnPosition: 'right',
  cardListConfig: {},
  complexHeaderList: [], complexHeaderConfig: {},
  useCustomBtns: false, customBtnsList: [],
  columnList: [], searchList: [],
  appColumnOptions: [], appColumnList: [],
  tableConfig: { border: true, stripe: false, size: 'default', showRadio: false, showRowNumber: true },
  relationForm: { ' popupTable': '', columnOptions: [], searchForms: [] },
  useBtnPermission: false, useFormPermission: false, useDataPermission: false,
  hasPage: true, hasDefaultValue: false, hasSuperQuery: false, hasTreeQuery: false,
}

web 端真相(代码片段)

// web/.../ColumnDesign/src/helper/config.ts:109-198(defaultColumnData,47 字段)
const defaultColumnData = {
  ruleList: { matchLogic: 'and', conditionList: [] },  // 过滤规则
  searchList: [],
  resizable: true,
  hasSuperQuery: true,
  showOverflow: true,
  childTableStyle: 1,
  showSummary: false, summaryField: [],
  columnList: [], columnOptions: [], defaultColumnList: [],
  type: 1, defaultSortConfig: [], viewKey: '',
  hasPage: true, pageSize: 20,
  hasTreeQuery: false,
  treeTitle: '左侧标题', treeTitleI18nCode: '',
  treeDataSource: 'dictionary', treeDictionary: '',
  treeRelation: '', treeRelationFieldSelectType: 'all', treeRelationFieldAbleIds: [],
  treeSyncType: 0, treeSyncInterfaceId: '', treeSyncInterfaceName: '',
  treeSyncTemplateJson: [],
  treePropsUrl: '', treePropsName: '', treeTemplateJson: [],
  treePropsValue: 'id', treePropsChildren: 'children', treePropsLabel: 'fullName',
  groupField: '', parentField: '',
  printIds: [],
  useColumnPermission: false, useFormPermission: false,
  useBtnPermission: false, useDataPermission: false,
  customBtnsList: [], btnsList: defaultBtnsList, columnBtnsList: defaultColumnBtnsList,
  funcs: { afterOnload: '...', rowStyle: '...', cellStyle: '...' },
  uploaderTemplateJson: {},
  complexHeaderList: [],
  tabConfig: { on: false, relationField: '', hasAllTab: true },
  cardListConfig: { cardLayout: 'horizontal', ... },
}

对比结果(48 字段交集/差集)

dacli 有但 web 没有(24 个 dacli-only,疑似冗余/typo 字段)

字段 备注
appColumnList, appColumnOptions 这是 APP 端(手机端)的字段,dacli 合并到 PC 端;web defaultAppColumnData 才是 APP 端独立 schema
btnsPosition, rowBtnsList, showCheckbox, useDragSort, useFilter, useSort, useAdvancedQuery, useOverflow, usePage, hasDefaultValue, sortList, columnPermissions, complexHeaderConfig, useDataInterface, dataInterfaceId, pageSizes, useCustomBtns, hasPrint, printId, printBtnPosition 部分可能在 web tableConfig/其他字段承担,需逐项查 web 渲染入口确认;当前未被 web defaultColumnData 收录即说明 web 不再读
relationForm: { ' popupTable': '', ... } 见任务 1 的 typo 段

web 有但 dacli 没有(29 个 web-only 字段,dacli 缺失)

🔴 必须修复(影响 list 渲染或关键功能):

  1. ruleList — 过滤规则(前端 matchLogic + conditionList,没它前端可能用 undefined.conditionList 报错)
  2. funcs — 行/单元格/数据加载 JS 函数({afterOnload, rowStyle, cellStyle}),没它设计器打开时丢默认值
  3. resizable — 列表列拖拽开关
  4. showOverflow — 溢出省略(dacli 写了 useOverflow: true,web 用 showOverflow,命名不一致,前端很可能读不到)
  5. tabConfig — 标签面板配置 {on, relationField, hasAllTab},没它 tab 控件功能失效
  6. viewKey — 视图主键(webType=3 必填,否则 list 接口查不到视图)
  7. defaultColumnList — 所有可选择字段列表(前端渲染列选择器,没它列配置空白)

🟡 应该修复(树形/分组/打印功能相关): 8. groupField — 分组字段(type=3 分组列表) 9. parentField — 父级字段(type=3 树形列表) 10. childTableStyle — 子表样式(主子表特有) 11. printIds — 打印模板 ID 数组(dacli 写 printId 单值,类型错位——web 是数组) 12. uploaderTemplateJson — 上传组件模板

🟢 设计器元数据(缺失不影响功能,但前端容错差): 13. treeTitle, treeTitleI18nCode, treeDataSource, treeDictionary 14. treeRelation, treeRelationFieldSelectType, treeRelationFieldAbleIds 15. treeSyncType, treeSyncInterfaceId, treeSyncInterfaceName, treeSyncTemplateJson 16. treeTemplateJson, treePropsUrl, treePropsName, treePropsValue, treePropsChildren, treePropsLabel

结论:真不一致(29 字段缺失 + 1 字段命名错误)

关键风险

  • 盲点 51 关联:BS-51 已知 dacli 列 schema 缺字段引发 list 白屏;本任务验证的 29 字段差异是其上游根因之一
  • type 类型错位:dacli printId: '' 单值 vs web printIds: [] 数组 → 设计器端读 printIds.map() 会 NPE
  • 同名不同义:dacli useOverflow vs web showOverflow → 列表溢出省略默认行为丢失

修复建议

文件:dacli/src/commands/form/create.ts:279-304

修复前:

const columnDataObj: any = {
  type: 1, pageSize: 20,
  showSummary: false, summaryField: '',
  // ... dacli 简化版 ...
}

修复后(最小闭环,按 web defaultColumnData 1:1 复刻 + 修任务 1 typo):

const columnDataObj: any = {
  // === 与 web ColumnDesign/helper/config.ts:109-198 defaultColumnData 对齐 ===
  ruleList: { matchLogic: 'and', conditionList: [] },  // 过滤规则(修复)
  searchList: [],                                       // 查询字段
  resizable: true,                                      // 列表列拖拽
  hasSuperQuery: true,                                  // 高级查询
  showOverflow: true,                                   // 溢出省略(dacli 旧名 useOverflow 修复)
  childTableStyle: 1,                                   // 子表样式(修复)
  showSummary: false, summaryField: [],                 // 合计
  columnList: [], columnOptions: [], defaultColumnList: [], // 字段列表 + 默认列
  type: 1,                                              // 列表类型
  defaultSortConfig: [],                                // 默认排序(数组非对象)
  viewKey: '',                                          // 视图主键(修复)
  hasPage: true, pageSize: 20,                          // 分页
  hasTreeQuery: false,                                  // 左侧树查询
  // === 树形列表(type=3 时启用)===
  treeTitle: '左侧标题', treeTitleI18nCode: '',
  treeDataSource: 'dictionary', treeDictionary: '',
  treeRelation: '', treeRelationFieldSelectType: 'all', treeRelationFieldAbleIds: [],
  treeSyncType: 0, treeSyncInterfaceId: '', treeSyncInterfaceName: '', treeSyncTemplateJson: [],
  treePropsUrl: '', treePropsName: '', treeTemplateJson: [],
  treePropsValue: 'id', treePropsChildren: 'children', treePropsLabel: 'fullName',
  // === 分组/树形主表(type=3)===
  groupField: '', parentField: '',
  // === 打印/上传 ===
  printIds: [],                                         // 数组(修复 dacli printId 单值)
  uploaderTemplateJson: {},
  // === 权限 ===
  useColumnPermission: false, useFormPermission: false,
  useBtnPermission: false, useDataPermission: false,
  // === 按钮 + JS 函数(修复 funcs 缺失)===
  customBtnsList: [],
  btnsList: [                                           // 默认 5 个按钮(见 web config.ts:74-80)
    { show: true, value: 'add', icon: 'icon-ym icon-ym-btn-add', label: '新增', labelI18nCode: 'common.add2Text' },
    { show: false, value: 'download', icon: 'icon-ym icon-ym-btn-download', label: '导出', labelI18nCode: 'common.exportText' },
    { show: false, value: 'upload', icon: 'icon-ym icon-ym-btn-upload', label: '导入', labelI18nCode: 'common.importText' },
    { show: false, value: 'batchRemove', icon: 'icon-ym icon-ym-btn-clearn', label: '批量删除', labelI18nCode: 'common.batchDelText' },
    { show: false, value: 'batchPrint', icon: 'icon-ym icon-ym-report-icon-preview-printPreview', label: '批量打印', labelI18nCode: 'common.batchPrintText' },
  ],
  columnBtnsList: [                                     // 默认列按钮(见 web config.ts:82-107)
    { show: true, value: 'edit', icon: 'icon-ym icon-ym-btn-edit', label: '编辑', labelI18nCode: 'common.editText', event: { enableFunc: '...' } },
    { show: true, value: 'remove', icon: 'icon-ym icon-ym-btn-clearn', label: '删除', labelI18nCode: 'common.delText', event: { enableFunc: '...' } },
    { show: true, value: 'detail', icon: 'icon-ym icon-ym-generator-menu', label: '详情', labelI18nCode: 'common.detailText', event: { enableFunc: '...' } },
  ],
  funcs: {                                              // 修复 funcs 缺失
    afterOnload: '({ data, tableRef, onlineUtils }) => {\r\n   \r\n}',
    rowStyle: '({ row, rowIndex }) => {\r\n   \r\n}',
    cellStyle: '({ row, column, rowIndex, columnIndex }) => {\r\n   \r\n}',
  },
  // === 标签面板(修复 tabConfig)===
  tabConfig: { on: false, relationField: '', hasAllTab: true },
  // === 卡片布局 ===
  cardListConfig: {
    cardLayout: 'horizontal', titleField: '', subTitleField: '',
    displayFields: '', columnCount: 1, enableImage: false,
    imageSource: '', displayPosition: 'left', fillMode: 'contain',
  },
  // === 表头与表格 ===
  complexHeaderList: [],                                // 多级表头(dacli 旧 complexHeaderConfig 移除)
  // === 关系表单(修复任务 1 的 typo)===
  relationForm: {},                                      // 见任务 1 修复
  // === dacli 保留的扩展字段(待 web 验证后清理)===
  hasDefaultValue: false,                               // dacli 自有,需 web 验证
  tableConfig: { border: true, stripe: false, size: 'default', showRadio: false, showRowNumber: true },
  // === APP 端(mobile)独立字段 — 暂时保留旧名,标记待清理 ===
  appColumnOptions: [], appColumnList: [],
}

任务 3:验证 columnList entry 字段完整性

文件位置

  • dacli:/home/ubuntu/ccWorkDir/dacli/src/commands/form/create.ts:261-273 (buildColumnListEntry)
  • web 真实:表单 workSystem:624163990351643525(员工培训)首个 input 列 entry

dacli 端现状(代码片段)

// create.ts:261-273
const buildColumnListEntry = (field: any) => {
  const label = field.fieldName || field.field
  const prop = field.field
  return {
    label, labelI18nCode: '', prop,
    fixed: 'none', headerAlign: 'left', align: 'left',
    sortable: false, width: null,
    jnpfKey: 'input',
    __vModel__: prop,
    __config__: { jnpfKey: 'input', label, showLabel: true, tableName: opts.enCode, formId: `formItem${opts.enCode}` },
    fullName: label, id: prop,
  }
}

dacli entry 顶层字段(共 12 个):

label, labelI18nCode, prop, fixed, headerAlign, align,
sortable, width, jnpfKey, __vModel__, __config__, fullName, id

web 端真相(代码片段)

// 真实表单 workSystem:624163990351643525 第一条 columnList entry(input 控件)
{
  "label": "工号",
  "labelI18nCode": "",
  "prop": "inputField44a3a9",
  "fixed": "none",
  "headerAlign": "left",
  "align": "left",
  "jnpfKey": "input",
  "sortable": false,
  "width": null,
  "id": "inputField44a3a9",
  "fullName": "工号",
  "fullNameI18nCode": [""],
  "clearable": true,
  "useScan": false,
  "suffixIcon": "",
  "addonAfter": "",
  "showCount": false,
  "__config__": {
    "formId": "formItem44a3a9",
    "visibility": ["pc", "app"],
    "jnpfKey": "input",
    "noShow": false,
    "tipLabel": "",
    "tableFixed": "none",
    "dragDisabled": false,
    "className": [],
    "label": "工号",
    "trigger": "blur",
    "showLabel": true,
    "required": false,
    "tableName": "mt624164005967037317",
    "renderKey": 1730948559130,
    "layout": "colFormItem",
    "tagIcon": "icon-ym icon-ym-generator-input",
    "tag": "JnpfInput",
    "regList": [],
    "tableAlign": "left",
    "span": 24
  },
  "readonly": false,
  "maskConfig": { "...": "..." },
  "__vModel__": "inputField44a3a9",
  "useMask": false,
  "showPassword": false,
  "style": { "width": "100%" },
  "disabled": false,
  "placeholder": "请输入",
  "prefixIcon": "",
  "addonBefore": "",
  "on": { "change": "..." }
}

对比差异(16 个字段缺失 + 15 个 config 子字段缺失)

顶层 entry 缺失字段(16 个)

字段 类型 必要性 影响
placeholder string 必须 列头 tooltip/筛选占位符
clearable bool 必须 input/select 列是否可清空
disabled bool 必须 列是否禁用
readonly bool 必须 input 列只读
style object 必须 列宽(width 不够时补 inline style)
on object 必须 change/blur 等 JS 增强
fullNameI18nCode string[] 必须 多语言标签(无 → 设计器打开时 i18n 报错)
addonBefore, addonAfter, prefixIcon, suffixIcon, showCount, showPassword, useMask, useScan, maskConfig 各异 input 控件特有 表单设计器右侧面板读不到时,列配置面板空白

__config__ 子字段缺失(15 个)

子字段 类型 影响
tag (e.g. 'JnpfInput') string 关键 — 控件渲染 tag,前端组件映射靠此 key
tagIcon string 设计器图标
visibility string[] PC/APP 端可见性
layout ('colFormItem') string 布局模式
span (24) number 栅格
required bool 必填
regList array 校验规则列表
trigger string 校验触发时机
tipLabel string 提示文案
noShow bool 是否在列表隐藏
tableFixed, tableAlign string 列表固定/对齐
dragDisabled, className bool/array 设计器拖拽控制
renderKey number 设计器渲染 key,缺失会导致拖拽失效

结论:真不一致(31 个字段差异)

关键风险

  • __config__.tag 缺失 → 前端组件映射查不到,列表列渲染空白
  • __config__.renderKey 缺失 → 设计器列拖拽排序失效(dacli 生成 form 打开设计器无法调列顺序)
  • placeholder/clearable/disabled 等控件属性缺失 → 设计器右侧面板打开时空白

修复建议

文件:dacli/src/commands/form/create.ts:261-273

修复后:

const buildColumnListEntry = (field: any, jnpfKey = 'input') => {
  const label = field.fieldName || field.field
  const prop = field.field
  // 控件 tag 映射(与 web FormGenerator componentMap 对齐)
  const tagMap: Record<string, string> = {
    input: 'JnpfInput',
    textarea: 'JnpfInputTextarea',
    inputNumber: 'JnpfInputNumber',
    select: 'JnpfSelect',
    datePicker: 'JnpfDatePicker',
    // ...
  }
  const tagIconMap: Record<string, string> = {
    input: 'icon-ym icon-ym-generator-input',
    // ...
  }
  return {
    // === 与 web 真实 entry 对齐(修复 16 字段)===
    label, labelI18nCode: '', prop,
    fixed: 'none', headerAlign: 'left', align: 'left',
    sortable: false, width: null,
    jnpfKey,
    id: prop, fullName: label, fullNameI18nCode: [''],  // 数组类型(修复)
    clearable: true, disabled: false, readonly: false,
    placeholder: '请输入',
    style: { width: '100%' },
    on: { change: '({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n    // 在此编写代码\n    \n}' },
    addonBefore: '', addonAfter: '', prefixIcon: '', suffixIcon: '',
    showCount: false, showPassword: false, useMask: false, useScan: false,
    maskConfig: { prefixType: 1, useUnrealMask: false, maskType: 1, unrealMaskLength: 1, prefixLimit: 0, suffixLimit: 0, filler: '*', prefixSpecifyChar: '', suffixType: 1, ignoreChar: '', suffixSpecifyChar: '' },
    // === __vModel__ 与 __config__(修复 __config__ 15 子字段)===
    __vModel__: prop,
    __config__: {
      jnpfKey,
      tag: tagMap[jnpfKey] || 'JnpfInput',
      tagIcon: tagIconMap[jnpfKey] || 'icon-ym icon-ym-generator-input',
      label, showLabel: true, tipLabel: '',
      labelWidth: undefined, tableAlign: 'left', tableFixed: 'none',
      className: [], defaultValue: '',
      required: false, layout: 'colFormItem', span: 24,
      dragDisabled: false, visibility: ['pc', 'app'],
      tableName: opts.enCode,
      noShow: false, regList: [], trigger: 'change',
      formId: `formItem${opts.enCode}`,
      renderKey: Date.now(),  // 修复 design-time 拖拽
      transferList: [],
    },
  }
}

任务 4:验证 searchList entry 字段完整性

文件位置

  • dacli:/home/ubuntu/ccWorkDir/dacli/src/commands/form/create.ts:274-277 (buildSearchListEntry)
  • web 真实:表单 workSystem:585448937427567365(采购申请)首个 searchList entry(datePicker)

dacli 端现状(代码片段)

// create.ts:274-277
const buildSearchListEntry = (entry: any) => ({
  ...entry,
  sourceType: 2, value: '', searchType: 1, searchMultiple: 0, isKeyword: false, noShow: false,
})

dacli searchList entry 字段(= buildColumnListEntry + 6 个搜索字段,共 18 个):

label, labelI18nCode, prop, fixed, headerAlign, align, sortable, width,
jnpfKey, __vModel__, __config__, fullName, id,
sourceType, value, searchType, searchMultiple, isKeyword, noShow

web 端真相(代码片段)

// 真实表单 workSystem:585448937427567365 第一条 searchList entry(datePicker)
{
  "label": "申请日期",
  "labelI18nCode": "formGenerator.component.datePicker",
  "prop": "datePickerField107",
  "jnpfKey": "datePicker",
  "sourceType": 2,
  "value": [],
  "searchType": 3,
  "searchMultiple": false,
  "isKeyword": false,
  "id": "datePickerField107",
  "fullName": "申请日期",
  "fullNameI18nCode": ["formGenerator.component.datePicker"],
  "clearable": true,
  "__config__": {
    "endRelationField": "", "dragDisabled": false, "className": [],
    "showLabel": true, "required": true,
    "tableName": "mt585441085065528069",
    "renderKey": 1721715536926,
    "tagIcon": "icon-ym icon-ym-generator-date",
    "startRelationField": "", "defaultCurrent": true,
    "tag": "JnpfDatePicker",
    "formId": 107, "visibility": ["pc", "app"], "jnpfKey": "datePicker",
    "noShow": false, "endTimeTarget": 1, "tipLabel": "",
    "tableFixed": "none", "startTimeType": 1, "endTimeRule": false,
    "label": "申请日期", "trigger": "change",
    "startTimeRule": false, "endTimeType": 1, "layout": "colFormItem",
    "startTimeTarget": 1, "regList": [], "tableAlign": "left", "span": 24,
    "labelI18nCode": "formGenerator.component.datePicker",
    "tipLabelI18nCode": "common.inputTextPrefix"
  },
  "format": "yyyy-MM-dd",
  "__vModel__": "datePickerField107",
  "style": { "width": "100%" },
  "disabled": false,
  "placeholder": "请选择",
  "on": { "change": "...", "blur": "..." },
  "placeholderI18nCode": "common.chooseTextPrefix"
}

对比差异(8 个字段缺失)

dacli searchList entry 缺失字段(8 个)

字段 类型 影响
fullNameI18nCode string[] 多语言标签(dacli buildColumnListEntry 也没,需要在两个 builder 都补)
clearable bool 搜索框可清空
disabled bool 搜索框禁用
style object 搜索框宽度
placeholder string 占位符
placeholderI18nCode string 占位符 i18n
on object change/blur JS 增强
format (date 控件) / 控件特有字段 视 jnpfKey datePicker 必有,inputNumber/select 等不同

关键类型错误

  • value: '' 应为 value: []:dacli 写空字符串,web datePicker 类型期望数组(范围搜索),前端 value.split 会报错

结论:真不一致(8 字段缺失 + 1 类型错位)

关键风险

  • value: '' 而非 value: [] → 前端 value.length 读到 undefined,搜索时 NPE
  • placeholder/on 缺失 → 设计器右侧面板空白,运营无法配置搜索增强

修复建议

文件:dacli/src/commands/form/create.ts:274-277

修复后:

const buildSearchListEntry = (entry: any) => ({
  ...entry,
  // === 与 web 真实 searchList entry 对齐(修复 8 字段 + 1 类型错位)===
  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 类型)===
  sourceType: 2,
  value: [],                   // 数组(修复 dacli 旧 value: '')
  searchType: 1,
  searchMultiple: false,        // bool(修复 dacli 旧 searchMultiple: 0)
  isKeyword: false,
  noShow: false,
})

总体修复建议(优先级排序)

优先级 任务 修复点 行号 影响范围
P0 任务 1 relationForm typo + 杜撰字段 create.ts:299 后端存库字段脏数据
P0 任务 2 columnData 29 字段缺失 + printId/useOverflow 命名错位 create.ts:279-304 盲点 51 根因(list 白屏)
P1 任务 3 columnList entry 31 字段缺失 create.ts:261-273 设计器右侧面板空白 + 列拖拽失效
P1 任务 4 searchList entry 8 字段缺失 + value 类型错位 create.ts:274-277 搜索栏 NPE

自动化防护建议

  1. form/_precheck.ts 加 schema diff guard(类似 BS-51 的 v0.7.4 修复):
    // 表单 create 后, 对比存库 columnData 字段数 vs web defaultColumnData (47)
    // 若 < 35 字段,触发 WARN:「dacli 简化版 schema,建议用 `form clone <id>` 拿完整 baseline」
    
  2. form/validate 子命令扩展:当前 form validate 仅检查 __config__ 完整性;建议加 columnData 顶层 schema 完整性检查(v0.11 候选)。
  3. scripts/extract-web-schema.py 自动化:当前手动从 web 提取,AI 易漏字段。建议该脚本输出 data/web-derived-schemas.json 时,自动把 webDefault + 1:1 dacli default 做 diff 并 PR 到 references/web-source-map.md。

附录:核对方法

# 1. 拉真实表单 schema(workSystem 81 张表单可作 baseline)
dacli app switch --appCode=workSystem
dacli form info 624163990351643525  # 员工培训(35KB columnData)
dacli form info 585448937427567365  # 采购申请(34KB columnData)

# 2. 对比脚本
python3 -c "
import json, urllib.request
d = json.loads(open('/tmp/crmOrder_info.json').read())
print(json.dumps(json.loads(d['columnData']), indent=2))
"

# 3. web 端基线(设计器默认 schema)
# web/.../ColumnDesign/src/helper/config.ts:109-198 defaultColumnData
# web/.../ColumnDesign/src/helper/config.ts:174-198 defaultAppColumnData

# 4. 控件 schema(jnpfKey: 'relationForm')
# web/.../FormGenerator/src/helper/componentMap.ts:1363-1406

关联盲点

  • BS-51(dacli 简化版 schema → list 白屏):本报告 4 个任务 = BS-51 的 4 个上游根因
  • BS-50(form schema 缺主表 → menu create "主表不存在"):相关但本报告不涉及
  • BS-47/48/49:本报告不涉及