diff --git a/src/router/index.js b/src/router/index.js index cdf56fb16..c339ee95d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -249,24 +249,6 @@ export const admin = '04'; // 管理员 export const superAdmin = '05'; // 超级管理员 // export const referee = '07'; // 裁判员 -export const projectTrain = '011'; // 城市轨道项目 -export const projectXian = '012'; // 西安地铁项目 -export const projectXty = '013'; // 西铁院 -export const projectGzzb = '014'; // 贵州装备 -export const projectJsxt = '015'; // 竞赛系统 -export const projectJyd = '017'; // 竞业达 -export const projectTky = '018'; // 铁科院 -export const projectHeb = '019'; // 哈盈达 -export const projectDrts = '020'; // 行调实训 -export const projectSdy = '021';// 苏电院 -export const projectRichor = '022';// 中航锐创 -export const projectRichorJoint = '023'; // 中航锐创(实训室) -export const projectSrsandbox = '024'; // 上饶沙盘 -export const projectJxgm = '025'; // 江西工贸 -export const projectSay = '026'; // 江苏安全 -export const projectRichorhhcj = '027'; // 红河财经 -export const projectTeaching = '028'; // 教学通用 - export const userTrainingPlatform = '016'; // 实训系统 // export const refereePlatform = '017'; // 裁判系统 @@ -292,17 +274,6 @@ export const constantRoutes = [ component: Login, hidden: true }, - // 设计平台登录 - { - path: '/design', - redirect: '/design/login', - hidden: true - }, - { - path: '/design/login', - component: Login, - hidden: true - }, { path: '/authorization', component: Authorization, @@ -2115,198 +2086,6 @@ export const asyncRouter = [ ] } ]; -/* merge 是否再路由处理中与asyncRouter进行合并 mergeIndex合并进入asyncRouter【mergeIndex】 慎重调整asyncRouter顺序 */ -export const projectRoute = { - designgzb: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designxty: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designheb: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designsdy: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designrichorjoint: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designsrsandbox: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designjxgm: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designsay: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ], - designrichorhhcj: [ - { // 系统管理 - path: '/system', - component: Layout, - merge: true, - mergeIndex: 4, - meta: { - i18n: 'router.systemManage', - roles: [admin] - }, - children: [ - { - path: 'deviceManage', - component: DeviceManage, - meta: { - i18n: 'router.deviceManage' - } - } - ] - } - ] -}; const createRouter = () => new Router({ base: process.env.VUE_APP_PRO == 'local' ? '/' : '/cbtc/', mode: 'history', // require service support diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 1a1bef2a3..d7d07009c 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -1,7 +1,5 @@ -import { publicAsyncRoute, asyncRouter, constantRoutes, user, projectTrain, projectXian, projectXty, projectGzzb, projectJsxt, projectRichorJoint, - projectJyd, projectRichor, projectTky, projectHeb, superAdmin, admin, userTrainingPlatform, JSXT, projectRoute, projectDrts, projectSdy, - projectSrsandbox, projectJxgm, projectSay, projectRichorhhcj, projectTeaching } from '@/router/index'; -import { loginInfo } from '@/scripts/ProjectConfig'; +// import { loginInfo } from '@/scripts/ProjectConfig'; +import { userTrainingPlatform, admin, publicAsyncRoute, asyncRouter, constantRoutes, superAdmin, user } from '@/router/index'; import { getSessionStorage } from '@/utils/auth'; import store from '@/store/index'; @@ -40,32 +38,9 @@ function hasPermission(roles, route, parentsRoles) { * 根据项目重置 路由 * @param systemType 项目类型 */ -function resetAsyncRouter({ systemType }) { +function resetAsyncRouter() { let list = publicAsyncRoute; - const projectList = [projectTrain, projectXian, projectJyd, projectTky, projectDrts, projectRichor]; - const specialProjects = [projectXty, projectGzzb, projectHeb, projectSdy, projectRichorJoint, projectSrsandbox, projectJxgm, projectSay, projectRichorhhcj, projectTeaching]; - const specialProjectEnum = {[projectXty]:'designxty', [projectGzzb]:'designgzb', [projectHeb]:'designheb', - [projectSdy]:'designsdy', [projectRichorJoint]:'designrichorjoint', [projectSrsandbox]: 'designsrsandbox', [projectJxgm]: 'designjxgm', - [projectSay]: 'designsay', [projectRichorhhcj]: 'designrichorhhcj', [projectTeaching]: 'designteaching' }; - if (projectList.includes(systemType)) { - list = [...list, ...asyncRouter]; - } else if (specialProjects.includes(systemType) ) { - if (projectRoute) { - const proRoute = projectRoute[specialProjectEnum[systemType]]; - if (proRoute && proRoute.length) { - proRoute.forEach(item => { - if (item.merge) { - asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children]; - } else { - list.push(item); - } - }); - } - } - list = [...list, ...asyncRouter]; - } else if (systemType == projectJsxt) { - list = [...list, ...JSXT]; - } + list = [...list, ...asyncRouter]; return list; } @@ -113,7 +88,8 @@ const permission = { if (roles.includes(admin) && !roles.includes(user)) { // 只拥有管理员 不拥有普通用户权限 则增加用户权限 roles.push(user); } - const routeList = resetAsyncRouter(loginInfo[getSessionStorage('project') || 'login']); + // loginInfo[getSessionStorage('project') || 'login'] + const routeList = resetAsyncRouter(); const accessedRouters = filterAsyncRouter(routeList, roles); accessedRouters.forEach(route => {