From 284b38694de094c8c9df638d200f98498f6b59f2 Mon Sep 17 00:00:00 2001 From: ssw Date: Mon, 22 Jun 2026 20:51:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(menu):=20v0.11=20is*Authorize=20=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=8C=96=20+=20--category=20App=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P1 修复(与 web Form.vue 一致): - is*Authorize 4 字段: 仅 type ∈ [2, 3, 4, 9, 11] (表单类菜单) = 1 其他 type (1=目录/5=报表/6=大屏/7=外链/8=代码生成/10=门户) = 0 来源: web/views/permission/menu/Form.vue:281-291 onTypeChange() P2 新增: - --category flag (默认 Web) - category 字段硬编码 'Web' → opts.category || 'Web' 支持 App 端菜单 (web Form.vue 下拉 Web/App 二选一) 回归验证: TS 编译通过 (仅 tests/e2e/ 旧错误与本次无关) Co-Authored-By: Claude --- src/commands/menu/create.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/commands/menu/create.ts b/src/commands/menu/create.ts index 901684c..80de35e 100644 --- a/src/commands/menu/create.ts +++ b/src/commands/menu/create.ts @@ -40,6 +40,8 @@ interface Opts { type?: string urlAddress?: string icon?: string + /** v0.11 新增: 支持 App 菜单 (web Form.vue 下拉 Web/App 二选一) */ + category?: string json?: boolean } @@ -57,6 +59,8 @@ export function buildMenuCreateCommand(): Command { .option('--type ', '低级模式 type: 1=目录 2=Vue扩展 3=VisualDev 7=外链', '1') .option('--urlAddress ', '低级模式: URL') .option('--icon ', '低级模式: 图标') + // v0.11 新增: 支持 App 菜单 (默认 Web) + .option('--category ', '菜单分类 (Web | App, 默认 Web)', 'Web') .option('--json', '原始 JSON 输出', false) .action(async (opts: Opts) => { const c = await JnpfClient.fromToken() @@ -93,8 +97,10 @@ export function buildMenuCreateCommand(): Command { type: 3, // VisualDev enabledMark: 1, sortCode: 0, - category: 'Web', + // v0.11 修复: 用 opts.category (默认 Web), 支持 --category=App + category: opts.category || 'Web', linkTarget: '_self', + // v0.11 修复: web Form.vue:281-291 — type=3 属表单类 → is*Authorize=1 isButtonAuthorize: 1, isColumnAuthorize: 1, isDataAuthorize: 1, @@ -232,6 +238,9 @@ export function buildMenuCreateCommand(): Command { } } + // v0.11 修复: web Form.vue:281-291 条件化 is*Authorize + // 仅 type ∈ [2, 3, 4, 9, 11] (表单类菜单) = 1, 其余 (目录/报表/外链/代码生成) = 0 + const isFormType = [2, 3, 4, 9, 11].includes(type) const body: Record = { fullName: opts.fullName, enCode, @@ -239,12 +248,13 @@ export function buildMenuCreateCommand(): Command { type, enabledMark: 1, sortCode: 0, - category: 'Web', + // v0.11 修复: 用 opts.category (默认 Web), 支持 --category=App + category: opts.category || 'Web', linkTarget: '_self', - isButtonAuthorize: 1, - isColumnAuthorize: 1, - isDataAuthorize: 1, - isFormAuthorize: 1, + isButtonAuthorize: isFormType ? 1 : 0, + isColumnAuthorize: isFormType ? 1 : 0, + isDataAuthorize: isFormType ? 1 : 0, + isFormAuthorize: isFormType ? 1 : 0, icon, propertyJson, }