diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/router/index.js b/src/router/index.js index 47da502..edd798a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,19 +54,22 @@ name: 'Dashboard', hidden: true }, - { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true }, - { - path: '/cooperate', - name: 'cooperate', - redirect: '/work', - hidden: true - }, - { - path: '/sys', - name: 'sys', - redirect: '/resource', - hidden: true - } + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] export const createRouter = () => { @@ -82,7 +85,6 @@ routes: constantRouterMap }) - // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ @@ -90,5 +92,5 @@ ...cooRouters, ...bmsRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/router/index.js b/src/router/index.js index 47da502..edd798a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,19 +54,22 @@ name: 'Dashboard', hidden: true }, - { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true }, - { - path: '/cooperate', - name: 'cooperate', - redirect: '/work', - hidden: true - }, - { - path: '/sys', - name: 'sys', - redirect: '/resource', - hidden: true - } + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] export const createRouter = () => { @@ -82,7 +85,6 @@ routes: constantRouterMap }) - // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ @@ -90,5 +92,5 @@ ...cooRouters, ...bmsRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/common.js b/src/router/modules/common.js index d13d41c..814027b 100644 --- a/src/router/modules/common.js +++ b/src/router/modules/common.js @@ -17,6 +17,13 @@ component: () => import('@/views/caseCommon/caseDetailRead'), hidden: true, meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } + }, + { + path: '/caseDetailSupervise/:id(\\d+)', + name: 'CaseDetailSupervise', + component: () => import('@/views/caseCommon/caseDetailSupervise'), + hidden: true, + meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } } ] } diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/router/index.js b/src/router/index.js index 47da502..edd798a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,19 +54,22 @@ name: 'Dashboard', hidden: true }, - { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true }, - { - path: '/cooperate', - name: 'cooperate', - redirect: '/work', - hidden: true - }, - { - path: '/sys', - name: 'sys', - redirect: '/resource', - hidden: true - } + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] export const createRouter = () => { @@ -82,7 +85,6 @@ routes: constantRouterMap }) - // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ @@ -90,5 +92,5 @@ ...cooRouters, ...bmsRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/common.js b/src/router/modules/common.js index d13d41c..814027b 100644 --- a/src/router/modules/common.js +++ b/src/router/modules/common.js @@ -17,6 +17,13 @@ component: () => import('@/views/caseCommon/caseDetailRead'), hidden: true, meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } + }, + { + path: '/caseDetailSupervise/:id(\\d+)', + name: 'CaseDetailSupervise', + component: () => import('@/views/caseCommon/caseDetailSupervise'), + hidden: true, + meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } } ] } diff --git a/src/router/modules/coo.js b/src/router/modules/coo.js index 0fa4830..b308b5f 100644 --- a/src/router/modules/coo.js +++ b/src/router/modules/coo.js @@ -1,19 +1,21 @@ /* Layout */ import Layout from '../../views/layout/Layout' export const cooRouters = [ - // { - // path: '/cooperate', - // name: 'cooperate', - // redirect: '/work', - // hidden: true, - // meta: { - // title: '协同工作子系统', - // permission: ['/cooperate'] - // } - // }, { - path: 'coorBusiness', + path: '/cooperate', + name: 'cooperate', + redirect: '/searchAll', + hidden: true, + meta: { + title: '协同工作子系统', + permission: ['/cooperate'], + isSys: true + } + }, + { + path: '/coorBusiness', component: Layout, + redirect: '/seo', name: 'CoorBusniess', meta: { title: '协调业务管理', @@ -141,6 +143,7 @@ path: '/searchAll', component: Layout, name: 'SearchAll', + redirect: '/seo', meta: { title: '综合查询', permission: ['/seo'], @@ -159,6 +162,7 @@ path: '/supervise', component: Layout, name: 'Supervise', + redirect: '/overtimeList', meta: { title: '案卷督办', permission: ['/supervise'], diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/router/index.js b/src/router/index.js index 47da502..edd798a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,19 +54,22 @@ name: 'Dashboard', hidden: true }, - { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true }, - { - path: '/cooperate', - name: 'cooperate', - redirect: '/work', - hidden: true - }, - { - path: '/sys', - name: 'sys', - redirect: '/resource', - hidden: true - } + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] export const createRouter = () => { @@ -82,7 +85,6 @@ routes: constantRouterMap }) - // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ @@ -90,5 +92,5 @@ ...cooRouters, ...bmsRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/common.js b/src/router/modules/common.js index d13d41c..814027b 100644 --- a/src/router/modules/common.js +++ b/src/router/modules/common.js @@ -17,6 +17,13 @@ component: () => import('@/views/caseCommon/caseDetailRead'), hidden: true, meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } + }, + { + path: '/caseDetailSupervise/:id(\\d+)', + name: 'CaseDetailSupervise', + component: () => import('@/views/caseCommon/caseDetailSupervise'), + hidden: true, + meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } } ] } diff --git a/src/router/modules/coo.js b/src/router/modules/coo.js index 0fa4830..b308b5f 100644 --- a/src/router/modules/coo.js +++ b/src/router/modules/coo.js @@ -1,19 +1,21 @@ /* Layout */ import Layout from '../../views/layout/Layout' export const cooRouters = [ - // { - // path: '/cooperate', - // name: 'cooperate', - // redirect: '/work', - // hidden: true, - // meta: { - // title: '协同工作子系统', - // permission: ['/cooperate'] - // } - // }, { - path: 'coorBusiness', + path: '/cooperate', + name: 'cooperate', + redirect: '/searchAll', + hidden: true, + meta: { + title: '协同工作子系统', + permission: ['/cooperate'], + isSys: true + } + }, + { + path: '/coorBusiness', component: Layout, + redirect: '/seo', name: 'CoorBusniess', meta: { title: '协调业务管理', @@ -141,6 +143,7 @@ path: '/searchAll', component: Layout, name: 'SearchAll', + redirect: '/seo', meta: { title: '综合查询', permission: ['/seo'], @@ -159,6 +162,7 @@ path: '/supervise', component: Layout, name: 'Supervise', + redirect: '/overtimeList', meta: { title: '案卷督办', permission: ['/supervise'], diff --git a/src/router/modules/system.js b/src/router/modules/system.js index eac2b81..5504ce9 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,18 +1,19 @@ /* Layout */ import Layout from '../../views/layout/Layout' export const systemRouters = [ - // { - // path: '/sys', - // name: 'sys', - // redirect: '/resource', - // hidden: true, - // meta: { - // title: '应用维护子系统', - // permission: ['/sys'] - // } - // }, { - path: 'system', + path: '/sys', + name: 'sys', + redirect: '/system', + hidden: true, + meta: { + title: '应用维护子系统', + permission: ['/sys'], + isSys: true + } + }, + { + path: '/system', component: Layout, redirect: '/resource', name: 'System', diff --git a/src/permission.js b/src/permission.js index 7587ebe..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,5 +1,4 @@ import router from './router' -import { createRouter } from './router' import store from './store' import NProgress from 'nprogress' // progress bar 进度条 import 'nprogress/nprogress.css' // progress bar style 进度条样式 @@ -34,6 +33,7 @@ store.dispatch('GetMenus', currentSys).then(() => { store.commit('SET_CHANGEFLAG', '0') router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record }) } else { // 没有当前子系统信息,跳转到选择子系统页面 @@ -46,28 +46,7 @@ }) }) } else { - // console.log('************************') - // console.log(store.getters.changeFlag) - // if (store.getters.changeFlag === '1') { - // console.log('监测到子系统切换:') - // const currentSys = getCurrentSys() - // if (currentSys) { - // // 远程访问获取权限列表(菜单&按钮) - // store.dispatch('GetMenus', currentSys).then(() => { - // debugger - // console.log('========获取菜单成功========') - // store.commit('SET_CHANGEFLAG', '0') - // router.matcher = createRouter().matcher - // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - // console.log(router.routes) - // console.log(to) - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // // next() // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - // }) - // } else { // 没有当前子系统信息,跳转到选择子系统页面 - // next({ path: '/dashboard' }) - // } - // } + // TODO: 判断路由是否被允许,不允许则重定向 next() } } diff --git a/src/router/index.js b/src/router/index.js index 47da502..edd798a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,19 +54,22 @@ name: 'Dashboard', hidden: true }, - { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true }, - { - path: '/cooperate', - name: 'cooperate', - redirect: '/work', - hidden: true - }, - { - path: '/sys', - name: 'sys', - redirect: '/resource', - hidden: true - } + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/index'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] export const createRouter = () => { @@ -82,7 +85,6 @@ routes: constantRouterMap }) - // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ @@ -90,5 +92,5 @@ ...cooRouters, ...bmsRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/common.js b/src/router/modules/common.js index d13d41c..814027b 100644 --- a/src/router/modules/common.js +++ b/src/router/modules/common.js @@ -17,6 +17,13 @@ component: () => import('@/views/caseCommon/caseDetailRead'), hidden: true, meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } + }, + { + path: '/caseDetailSupervise/:id(\\d+)', + name: 'CaseDetailSupervise', + component: () => import('@/views/caseCommon/caseDetailSupervise'), + hidden: true, + meta: { title: '案卷详情', icon: 'icon-config', permission: ['/caseDetail'] } } ] } diff --git a/src/router/modules/coo.js b/src/router/modules/coo.js index 0fa4830..b308b5f 100644 --- a/src/router/modules/coo.js +++ b/src/router/modules/coo.js @@ -1,19 +1,21 @@ /* Layout */ import Layout from '../../views/layout/Layout' export const cooRouters = [ - // { - // path: '/cooperate', - // name: 'cooperate', - // redirect: '/work', - // hidden: true, - // meta: { - // title: '协同工作子系统', - // permission: ['/cooperate'] - // } - // }, { - path: 'coorBusiness', + path: '/cooperate', + name: 'cooperate', + redirect: '/searchAll', + hidden: true, + meta: { + title: '协同工作子系统', + permission: ['/cooperate'], + isSys: true + } + }, + { + path: '/coorBusiness', component: Layout, + redirect: '/seo', name: 'CoorBusniess', meta: { title: '协调业务管理', @@ -141,6 +143,7 @@ path: '/searchAll', component: Layout, name: 'SearchAll', + redirect: '/seo', meta: { title: '综合查询', permission: ['/seo'], @@ -159,6 +162,7 @@ path: '/supervise', component: Layout, name: 'Supervise', + redirect: '/overtimeList', meta: { title: '案卷督办', permission: ['/supervise'], diff --git a/src/router/modules/system.js b/src/router/modules/system.js index eac2b81..5504ce9 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,18 +1,19 @@ /* Layout */ import Layout from '../../views/layout/Layout' export const systemRouters = [ - // { - // path: '/sys', - // name: 'sys', - // redirect: '/resource', - // hidden: true, - // meta: { - // title: '应用维护子系统', - // permission: ['/sys'] - // } - // }, { - path: 'system', + path: '/sys', + name: 'sys', + redirect: '/system', + hidden: true, + meta: { + title: '应用维护子系统', + permission: ['/sys'], + isSys: true + } + }, + { + path: '/system', component: Layout, redirect: '/resource', name: 'System', diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index f90812b..1c1ebd8 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,18 +44,13 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } - // if (hasPermission(menus, tmp)) { // 如果有权限,添加该路由,old - // if (tmp.children) { - // tmp.children = filterAsyncRouter(tmp.children, menus) - // } - // res.push(tmp) - // } const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -67,6 +62,15 @@ return res } +function filterRedirect(routes) { + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, @@ -149,7 +153,8 @@ } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(asyncRouterMap) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response)