form create: 加 --autoCreateMenu 选项 (盲点 47)
完整跑通浏览器 UI 端到端收集 (docs/tdd/e2e-formDesign-2026-06-16/) 后发现: 1. dacli form create 默认不挂菜单, 浏览器验证 step check-list 找不到 vxe-table 必 fail 2. 必传 --menuParentId (用 dacli menu list --keyword=目录名 拿顶级目录 id) 3. 复用 web CreateMenuModal 真实 body: pc=1, app=0, platformRelease=String 验证: - 创建 + 发布 + 挂菜单 一条龙跑通 (id=836665558169560261 enCode=dacliVerify3) - 同步修 verify-form.ts resolveMenuEnCode: 加 fallback 'menu.moduleId==formId' (因 createModule 不写 form.propertyJson.moduleId, 原 resolve 失败) 盲点 #47 已闭环
This commit is contained in:
1 parent
c63075b774
commit
7b16fd941d
2 files changed
+33
-2
No files matched your search
@@ -28,6 +28,10 @@ interface CreateOpts {
|
||||
enableFlow?: string
|
||||
flowId?: string
|
||||
autoRelease?: boolean
|
||||
/** v0.7.3 (盲点 47): 建完发布后自动挂菜单到指定父目录, 避免浏览器验证 step check-list 找不到 vxe-table */
|
||||
autoCreateMenu?: boolean
|
||||
/** 父菜单 id (--autoCreateMenu 时必传, 用 dacli menu list --keyword=... 拿) */
|
||||
menuParentId?: string
|
||||
json?: boolean
|
||||
/** 5.10.1 AI 快速建表 — 自然语言描述, 平台 LLM 生成 enCode/fullName/fields */
|
||||
ai?: string
|
||||
@@ -55,6 +59,8 @@ export function buildFormCreateCommand(): Command {
|
||||
.option('--enableFlow <0|1>', '是否绑工作流', '0')
|
||||
.option('--flowId <id>', '工作流 id (enableFlow=1 时必传)')
|
||||
.option('--autoRelease', '建完立刻发布 (type=4 自动跳过)', false)
|
||||
.option('--autoCreateMenu', '发布后自动挂菜单 (需传 --menuParentId, 避免浏览器验证找不到 list 页)', false)
|
||||
.option('--menuParentId <id>', '挂菜单的父目录 id (--autoCreateMenu 时必传; 走 dacli menu list --keyword=... 拿)')
|
||||
.option('--ai <desc>', '白皮书 5.10.1 AI 快速建表 — 自然语言描述, 平台 LLM 生成 enCode/fullName/fields, 走 type=4 视图兜底')
|
||||
.option('--ai-field <desc>', '白皮书 5.10.2 AI 推荐字段 — 自然语言描述, 平台 LLM 推荐单字段, 只输出建议不建表单')
|
||||
.option('--no-verify', '跳过浏览器层验证 (默认硬阻塞)')
|
||||
@@ -261,6 +267,26 @@ export function buildFormCreateCommand(): Command {
|
||||
log.warn('type=4 视图自动跳过 release (会 400)')
|
||||
}
|
||||
|
||||
// v0.7.3 (盲点 47): 发布后自动挂菜单, 避免浏览器验证 step check-list 找不到 vxe-table
|
||||
if (opts.autoCreateMenu && newId !== '(unknown)' && newId !== '(unknown)') {
|
||||
if (!opts.menuParentId) {
|
||||
log.error('--autoCreateMenu 必传 --menuParentId (用 dacli menu list --keyword=目录名 拿顶级目录 id)')
|
||||
if (opts.json) printJson({ id: newId, enCode: opts.enCode, type, webType, menuError: 'no parent' })
|
||||
} else {
|
||||
log.info(`挂菜单: POST /visualdev/Base/${newId}/Actions/Module pcParentId=${opts.menuParentId}`)
|
||||
// 复用 web CreateMenuModal 真实 body: pc=1, app=0, platformRelease=String
|
||||
const mr = await c.postJson<unknown>(`/visualdev/Base/${newId}/Actions/Module`, {
|
||||
pc: 1,
|
||||
app: 0,
|
||||
pcModuleParentId: [opts.menuParentId],
|
||||
appModuleParentId: [],
|
||||
platformRelease: JSON.stringify({ pc: 1, app: 0 }),
|
||||
})
|
||||
if (mr.code === 200) log.ok(`菜单挂载成功 (parentId=${opts.menuParentId})`)
|
||||
else log.warn(`菜单挂载失败 (code=${mr.code}): ${mr.msg}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.json) printJson({ id: newId, enCode: opts.enCode, type, webType })
|
||||
|
||||
// Phase 3: 浏览器层验证 (默认硬阻塞, --verify=warn / --no-verify 可绕过)
|
||||
@@ -295,6 +321,8 @@ export function buildFormCreateCommand(): Command {
|
||||
'--enableFlow': '0|1',
|
||||
'--flowId': '工作流 id',
|
||||
'--autoRelease': '建完立刻发布 (type=4 自动跳过)',
|
||||
'--autoCreateMenu': 'v0.7.3 (盲点 47) 发布后自动挂菜单 (需 --menuParentId, 避免浏览器验证失败)',
|
||||
'--menuParentId': '挂菜单的父目录 id (--autoCreateMenu 时必传; 用 dacli menu list 拿)',
|
||||
'--ai': '白皮书 5.10.1 AI 快速建表 — 自然语言描述生成 enCode/fullName/fields',
|
||||
'--ai-field': '白皮书 5.10.2 AI 推荐字段 — 只输出建议不建表单',
|
||||
'--no-verify': '跳过浏览器层验证 (默认硬阻塞)',
|
||||
|
||||
@@ -116,12 +116,15 @@ async function resolveMenuEnCode(formId: string, appCode: string): Promise<strin
|
||||
// a) 直接 enCode 相等
|
||||
let m = flat.find((x: any) => x.enCode === formEnCode)
|
||||
if (m?.enCode) return m.enCode
|
||||
// b) urlAddress 末尾包含 form enCode (model/<formEnCode>)
|
||||
// b) urlAddress 末尾包含 form enCode (model/<formEnCode> + 5字符后缀)
|
||||
m = flat.find((x: any) => {
|
||||
const u = String(x.urlAddress || '')
|
||||
return u === `model/${formEnCode}` || u.endsWith(`/${formEnCode}`)
|
||||
return u === `model/${formEnCode}` || u.startsWith(`model/${formEnCode}`)
|
||||
})
|
||||
if (m?.enCode) return m.enCode
|
||||
// c) v0.7.3: menu.moduleId == formId (web Actions/Module 挂菜单时 moduleId 字段是 formId)
|
||||
m = flat.find((x: any) => String(x.moduleId) === String(formId))
|
||||
if (m?.enCode) return m.enCode
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user