1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
let n = 0;
const generateMenuTree = (menus) => {
const arr = [];
for (let i = 0; i < menus.length; i++) {
const menu = menus[i];
if (menu.subMenu.length) {
const children = generateMenuTree(menu.subMenu)
arr.push({
index: menu.value + '_' + n++,
name: menu.label,
path: menu.value,
children
})
} else {
arr.push({
name: menu.label,
value: 'dzsys-' + menu.value,
path: '/business/dzsys/' + menu.value,
isDz: true,
icon: "el-icon-document",
children: []
})
}
}
return arr;
}
export const getDzSysMenu = () => {
const menuStr = window.sessionStorage.getItem('menu')
if (!menuStr) {
return null;
}
const menusConfig = JSON.parse(menuStr);
// menusConfig.unshift( { id: null, label: "登陆", value: "login", subMenu: [] } )
return {
name: '电证系统',
index: 'dzsys',
path: 'dzsys',
children: generateMenuTree(menusConfig)
}
}