Skip to content

Commit 39eaec0

Browse files
committed
feat: optimize add-menu mcp
1 parent 74f3ce5 commit 39eaec0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

template/tinyvue/src/views/menu/info/components/info-tab.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { flushRouter } from '@/router/guard/menu'
2929
import { useTabStore } from '@/store'
3030
import { useMenuStore } from '@/store/modules/router'
3131
import { sleep } from '@/utils/base-utils'
32+
import { getIdByLabel } from '@/utils/tree'
3233
import AddMenu from './add-menu.vue'
3334
import menuTree from './menu-tree.vue'
3435
import UpdateForm from './update-form.vue'
@@ -265,16 +266,17 @@ onMounted(async () => {
265266
inputSchema: {
266267
name: z.string().describe('名称'),
267268
order: z.number().describe('优先级').default(0),
268-
parentId: z.number().describe('父菜单ID').optional(),
269+
parentMenu: z.string().describe('父菜单').optional(),
269270
icon: z.string().describe('图标').optional().default(''),
270271
component: z.string().describe('组件'),
271272
path: z.string().describe('路径'),
272273
locale: z.string().describe('国际化'),
273274
},
274275
},
275-
async ({ name, order, parentId, icon, component, path, locale: menuLocale }) => {
276+
async ({ name, order, parentMenu, icon, component, path, locale: menuLocale }) => {
276277
handleAddMenu()
277278
await sleep(1000)
279+
const parentId = getIdByLabel(i18nMenuData.value, parentMenu)
278280
addMenu.value.setMenuInfo({
279281
name,
280282
order,

0 commit comments

Comments
 (0)