|
|
@ -11,9 +11,13 @@ const permission = {
|
|
|
|
addRoutes: [],
|
|
|
|
addRoutes: [],
|
|
|
|
defaultRoutes: [],
|
|
|
|
defaultRoutes: [],
|
|
|
|
topbarRouters: [],
|
|
|
|
topbarRouters: [],
|
|
|
|
sidebarRouters: []
|
|
|
|
sidebarRouters: [],
|
|
|
|
|
|
|
|
crumbs:""
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
mutations: {
|
|
|
|
|
|
|
|
SET_CRUMBS: (state, crumbs) => {
|
|
|
|
|
|
|
|
state.crumbs = crumbs;
|
|
|
|
|
|
|
|
},
|
|
|
|
SET_ROUTES: (state, routes) => {
|
|
|
|
SET_ROUTES: (state, routes) => {
|
|
|
|
state.addRoutes = routes
|
|
|
|
state.addRoutes = routes
|
|
|
|
state.routes = constantRoutes.concat(routes)
|
|
|
|
state.routes = constantRoutes.concat(routes)
|
|
|
@ -58,6 +62,11 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
|
|
|
if (type && route.children) {
|
|
|
|
if (type && route.children) {
|
|
|
|
route.children = filterChildren(route.children)
|
|
|
|
route.children = filterChildren(route.children)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增修改不是弹窗的形式
|
|
|
|
|
|
|
|
if(extractPrefix(route.path)){
|
|
|
|
|
|
|
|
route.meta.activeMenu = extractPrefix(route.path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (route.component) {
|
|
|
|
if (route.component) {
|
|
|
|
// Layout ParentView 组件特殊处理
|
|
|
|
// Layout ParentView 组件特殊处理
|
|
|
|
if (route.component === 'Layout') {
|
|
|
|
if (route.component === 'Layout') {
|
|
|
@ -79,7 +88,14 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function extractPrefix (str){
|
|
|
|
|
|
|
|
const pattern = /(.+?)(-info|-add|-edit)/;
|
|
|
|
|
|
|
|
const match = str.match(pattern);
|
|
|
|
|
|
|
|
if(match){
|
|
|
|
|
|
|
|
return match[1]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
function filterChildren(childrenMap, lastRouter = false) {
|
|
|
|
function filterChildren(childrenMap, lastRouter = false) {
|
|
|
|
var children = []
|
|
|
|
var children = []
|
|
|
|
childrenMap.forEach((el, index) => {
|
|
|
|
childrenMap.forEach((el, index) => {
|
|
|
|