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, }