|
|
|
|
@ -6,6 +6,28 @@ import Layout from '@/layout'
|
|
|
|
|
import {
|
|
|
|
|
getAuthMenu
|
|
|
|
|
} from '@/api/user.js'
|
|
|
|
|
const pathHandler = (item) => {
|
|
|
|
|
if(!item.path || item.path?.includes('#') || item.path == ''){
|
|
|
|
|
return item.id + '_key'
|
|
|
|
|
}
|
|
|
|
|
if(/^\^/.test(item.path)){
|
|
|
|
|
return item.path.replace(/^\^+/g,"")
|
|
|
|
|
}
|
|
|
|
|
if(/^\$/.test(item.path)){
|
|
|
|
|
return item.path.replace(/^\$+/g,"")
|
|
|
|
|
}
|
|
|
|
|
return item.path
|
|
|
|
|
// if(path.includes('$')){
|
|
|
|
|
// return path.replace(/^\$+/g,"")
|
|
|
|
|
// }
|
|
|
|
|
// if(path.includes('^')){
|
|
|
|
|
// return path.replace(/^\^+/g,"")
|
|
|
|
|
// }
|
|
|
|
|
// if(path.includes('#') || path == ''){
|
|
|
|
|
// return id + '_key'
|
|
|
|
|
// }
|
|
|
|
|
// return path
|
|
|
|
|
}
|
|
|
|
|
const componentHandler = (path) => {
|
|
|
|
|
//return path === '#'|| path == '' ? Layout : loadView(path)
|
|
|
|
|
if(path === '#' || path === ''){
|
|
|
|
|
@ -109,6 +131,29 @@ export function generaMenu(routes, data) {
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
}else if(/^\^/.test(item.path)){
|
|
|
|
|
const menu = {
|
|
|
|
|
path: pathHandler(item),
|
|
|
|
|
component: Layout,
|
|
|
|
|
children: [{
|
|
|
|
|
path: "",
|
|
|
|
|
name: 'menu_' + item.id,
|
|
|
|
|
component: (item.url.includes('#')||item.path == '') ? Layout : loadView(item.url),
|
|
|
|
|
meta: {
|
|
|
|
|
title: item.name,
|
|
|
|
|
id: item.id,
|
|
|
|
|
roles: ['admin'],
|
|
|
|
|
auths:item.has_auth_node_tags,
|
|
|
|
|
params,
|
|
|
|
|
|
|
|
|
|
icon: item.icon
|
|
|
|
|
}
|
|
|
|
|
}, ]
|
|
|
|
|
}
|
|
|
|
|
if (item.children) {
|
|
|
|
|
generaMenu(menu.children, item.children)
|
|
|
|
|
}
|
|
|
|
|
routes.push(menu)
|
|
|
|
|
} else {
|
|
|
|
|
var path = item.url;
|
|
|
|
|
if (item.path != "null" && item.path != null && item.path != "") {
|
|
|
|
|
@ -132,6 +177,7 @@ export function generaMenu(routes, data) {
|
|
|
|
|
if (item.children) {
|
|
|
|
|
generaMenu(menu.children, item.children)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
routes.push(menu)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
@ -167,8 +213,8 @@ const actions = {
|
|
|
|
|
|
|
|
|
|
commit('SET_ROOTMENU',data)
|
|
|
|
|
|
|
|
|
|
let routes = data.find(item => item.path === '/contract').children
|
|
|
|
|
let root = data.map(item => {
|
|
|
|
|
let routes = data?.find(item => item.path === '/contract').children
|
|
|
|
|
let root = data?.map(item => {
|
|
|
|
|
let menu = []
|
|
|
|
|
generaMenu(menu,item.children)
|
|
|
|
|
commit('SET_SIDEBARMENUMAP', { k: item.path, v: menu })
|
|
|
|
|
@ -176,7 +222,7 @@ const actions = {
|
|
|
|
|
item.redirect = item.children[0]?.path
|
|
|
|
|
}
|
|
|
|
|
if(item.path === '/contract') {
|
|
|
|
|
item.redirect = '/contract/contract/contractList'
|
|
|
|
|
item.redirect = '/contract/dashboard'
|
|
|
|
|
}
|
|
|
|
|
item.hidden = true
|
|
|
|
|
return item
|
|
|
|
|
@ -188,7 +234,6 @@ const actions = {
|
|
|
|
|
console.log(asyncRoutes)
|
|
|
|
|
let accessedRoutes
|
|
|
|
|
if (roles.includes('admin')) {
|
|
|
|
|
// alert(JSON.stringify(asyncRoutes))
|
|
|
|
|
accessedRoutes = asyncRoutes || []
|
|
|
|
|
} else {
|
|
|
|
|
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
|
|
|
|
|
|