|
@@ -49,13 +49,15 @@ router.beforeEach(async (to, from, next) => {
|
|
|
} else {
|
|
|
try {
|
|
|
const treeData = await store.dispatch('user/getMenuInfo')
|
|
|
- const nd = treeData.filter(item => item.pageid)
|
|
|
+ const nd = treeData.filter(item => item.pageconfigurationid)
|
|
|
store.dispatch('auth/changeAuthArrs', nd)
|
|
|
// const typeData = setType(treeData, 'up_auth_id', 'auth_id')
|
|
|
const menusArray = parseMenuItem(nd)
|
|
|
- const treeMenu = listToTree(menusArray, 'superiorid', 'pageid')
|
|
|
- const dataMenu = _.unionBy(treeMenu, 'pageid')
|
|
|
+ const treeMenu = listToTree(menusArray, 'up_auth_id', 'auth_id')
|
|
|
+ const dataMenu = _.unionBy(treeMenu, 'auth_id')
|
|
|
const menus = parseMenu(dataMenu)
|
|
|
+ console.log(treeMenu)
|
|
|
+
|
|
|
store.dispatch('permission/setRoutes', menus)
|
|
|
router.addRoutes(menus)
|
|
|
next({ ...to, replace: true })
|
|
@@ -83,44 +85,43 @@ router.beforeEach(async (to, from, next) => {
|
|
|
})
|
|
|
|
|
|
function parseMenuItem (data) {
|
|
|
+ //pagetype 1模块 2页面 3按钮 4表格 5树形 6弹窗
|
|
|
const menus = []
|
|
|
data.map(item => {
|
|
|
- if (item.opentype == 1) {
|
|
|
+ if (item.pagetype == 1) {
|
|
|
menus.push({
|
|
|
- auth_id: item.pageid,
|
|
|
+ auth_id: item.pageconfigurationid,
|
|
|
up_auth_id: item.superiorid,
|
|
|
- path: item.router,
|
|
|
- name: item.pagedescribe,
|
|
|
+ path: item.pageroute,
|
|
|
+ name: item.pagename,
|
|
|
meta: {
|
|
|
title: item.pagename,
|
|
|
- elSvgIcon: item.icon ?? 'Fold',
|
|
|
- show_index: item.defaultindex,
|
|
|
+ elSvgIcon: item.pageicon ?? 'Fold',
|
|
|
+ show_index: item.displayorder,
|
|
|
qid: item.serviceid,
|
|
|
},
|
|
|
component: Layout,
|
|
|
- hidden: !item.is_show,
|
|
|
+ hidden: !item.isdisplay,
|
|
|
})
|
|
|
- } else if (item.opentype == 2) {
|
|
|
+ } else if (item.pagetype == 2) {
|
|
|
menus.push({
|
|
|
- auth_id: item.pageid,
|
|
|
+ auth_id: item.pageconfigurationid,
|
|
|
up_auth_id: item.superiorid,
|
|
|
- path: item.router,
|
|
|
- name: item.pagedescribe,
|
|
|
+ path: item.pageroute,
|
|
|
+ name: item.pagename,
|
|
|
meta: {
|
|
|
title: item.pagename,
|
|
|
- elSvgIcon: item.icon ?? 'Fold',
|
|
|
- show_index: item.defaultindex,
|
|
|
- qid: item.queryTemplateID,
|
|
|
- auth_id: item.pageid,
|
|
|
+ elSvgIcon: item.pageicon ?? 'Fold',
|
|
|
+ show_index: item.displayorder,
|
|
|
+ qid: item.serviceid,
|
|
|
+ auth_id: item.pageconfigurationid,
|
|
|
up_auth_id: item.superiorid,
|
|
|
pagecode: item.pagecode,
|
|
|
- superiorcode: item.superiorcode,
|
|
|
- sort: item.sort,
|
|
|
- tagetpageid: item.tagetpageid
|
|
|
+ superiorcode: item.pagecode
|
|
|
},
|
|
|
- component: resolve => require(['@/views' + item.filepath], resolve),
|
|
|
+ component: resolve => require(['@/views/table/index.vue'], resolve),
|
|
|
// component: () => import('./views/table/index.vue'),
|
|
|
- hidden: !item.is_show,
|
|
|
+ hidden: !item.isdisplay,
|
|
|
})
|
|
|
}
|
|
|
})
|