Skip to content

Commit

Permalink
Showing 5 changed files with 51 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/api/sys/model/menuModel.ts
Original file line number Diff line number Diff line change
@@ -44,13 +44,19 @@ export interface MenuListItem {
component: string;
orderNo: number;
disabled: boolean;
keepAlive: boolean;
title: string;
icon: string;
hideMenu: boolean;
hideBreadcrumb: boolean;
currentActiveMenu: string;
title: string;
icon: string;
closeTab: boolean;
ignoreKeepAlive: boolean;
hideTab: boolean;
frameSrc: string;
carryParam: boolean;
hideChildrenInMenu: boolean;
affix: boolean;
dynamicLevel: number;
realPath: string;
children?: MenuListItem[] | undefined;
}

1 change: 1 addition & 0 deletions src/locales/lang/en/sys.ts
Original file line number Diff line number Diff line change
@@ -146,6 +146,7 @@ export default {
paramType: 'Type',
paramValue: 'Value',
paramList: 'Parameter List',
rootMenu: 'Root Menu',
// action
addMenu: 'Add Menu',
editMenu: 'Eidt Menu',
1 change: 1 addition & 0 deletions src/locales/lang/zh-CN/sys.ts
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ export default {
paramType: '参数类型',
paramValue: '参数值',
paramList: '参数列表',
rootMenu: '根菜单',
// action
addMenu: '新增菜单',
editMenu: '编辑菜单',
34 changes: 33 additions & 1 deletion src/views/sys/menu/MenuDrawer.vue
Original file line number Diff line number Diff line change
@@ -226,12 +226,44 @@
});
}
menuId.value = data.record.id;
if ('record' in data) {
menuId.value = data.record.id;
}
// get tree data from data.data
const treeData = await getAllMenu().then((data) => {
return data.data;
});
treeData.push({
name: 'root',
id: 1,
type: 0,
parentId: 0,
path: '',
redirect: '',
component: '',
orderNo: 0,
disabled: false,
title: 'sys.menu.rootMenu',
icon: '',
hideMenu: false,
hideBreadcrumb: false,
currentActiveMenu: '',
ignoreKeepAlive: false,
hideTab: false,
frameSrc: '',
carryParam: false,
hideChildrenInMenu: false,
affix: false,
dynamicLevel: 0,
realPath: '',
});
for (let i = 0; i < treeData.length; i++) {
treeData[i].title = t(treeData[i].title);
}
updateSchema({
field: 'parentId',
componentProps: { treeData },
7 changes: 6 additions & 1 deletion src/views/sys/menu/menu.data.ts
Original file line number Diff line number Diff line change
@@ -132,11 +132,16 @@ export const formSchema: FormSchema[] = [
field: 'parentId',
label: t('sys.menu.menuParent'),
component: 'TreeSelect',
defaultValue: {
label: t('sys.menu.rootMenu'),
key: 'root',
value: 1,
},
componentProps: {
// set the field name of the data from the server, the below show that
// the label show the field of data.name
fieldNames: {
label: 'name',
label: 'title',
key: 'id',
value: 'id',
},

0 comments on commit e0db046

Please sign in to comment.