|
@@ -42,7 +42,6 @@ router.beforeEach(async (to: any, from, next: any) => {
|
|
|
const treeMenu = setTree(treeData, 'up_auth_id', 'auth_id')
|
|
|
const dataMenu = _.unionBy(treeMenu, 'auth_id')
|
|
|
const menus = parseMenu(dataMenu)
|
|
|
- console.log(menus)
|
|
|
// const { roles }: any = await userStore.getInfo()
|
|
|
// accessRoutes = await permissionStore.generateRoutes(roles)
|
|
|
accessRoutes = menus
|
|
@@ -94,6 +93,18 @@ function parseItem(item) {
|
|
|
},
|
|
|
})
|
|
|
} else if (item.children && item.children.length <= 1) {
|
|
|
+ const datas = item.children
|
|
|
+ const arrs: any = []
|
|
|
+ datas.forEach((p) => {
|
|
|
+ arrs.push({
|
|
|
+ path: p.route_info,
|
|
|
+ component: () => import('./views' + p.file_link),
|
|
|
+ name: p.auth_ident,
|
|
|
+ meta: {
|
|
|
+ title: p.auth_name,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
menus.push({
|
|
|
path: item.route_info,
|
|
|
component: Layout,
|
|
@@ -104,30 +115,18 @@ function parseItem(item) {
|
|
|
show_index: item.show_index,
|
|
|
qid: item.queryTemplateID,
|
|
|
},
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: item.route_info,
|
|
|
- component: () => import('./views' + item.file_link),
|
|
|
- name: item.auth_ident,
|
|
|
- meta: {
|
|
|
- title: item.auth_name,
|
|
|
- elSvgIcon: item.show_icon ?? 'Fold',
|
|
|
- show_index: item.show_index,
|
|
|
- qid: item.queryTemplateID,
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
+ children: arrs,
|
|
|
})
|
|
|
} else {
|
|
|
const datas = item.children
|
|
|
const arrs: any = []
|
|
|
- datas.forEach((item, ci) => {
|
|
|
+ datas.forEach((p) => {
|
|
|
arrs.push({
|
|
|
- path: item.route_info,
|
|
|
- component: () => import('./views' + item.file_link),
|
|
|
- name: item.auth_ident + ci,
|
|
|
+ path: p.route_info,
|
|
|
+ component: () => import('./views' + p.file_link),
|
|
|
+ name: p.auth_ident,
|
|
|
meta: {
|
|
|
- title: item.auth_name,
|
|
|
+ title: p.auth_name,
|
|
|
},
|
|
|
})
|
|
|
})
|
|
@@ -165,13 +164,8 @@ function parseItem(item) {
|
|
|
function parseMenu(arr: Array<any>) {
|
|
|
const menus: any = []
|
|
|
arr.forEach((item) => {
|
|
|
- if (item.show_type == 1) {
|
|
|
- const res = parseItem(item)
|
|
|
- menus.push(res)
|
|
|
- } else if (item.show_type == 2) {
|
|
|
- const res = parseItem(item)
|
|
|
- menus.push(res)
|
|
|
- }
|
|
|
+ const res = parseItem(item)
|
|
|
+ menus.push(res)
|
|
|
})
|
|
|
const newMenus = menus.flat()
|
|
|
newMenus.push({
|