路由权限调整

This commit is contained in:
dong 2022-12-21 10:35:55 +08:00
parent 70fe1b27cb
commit 8fa00227ff
2 changed files with 14 additions and 6 deletions

View File

@ -751,6 +751,7 @@ export const asyncRouter = [
meta: {
roles: [admin, user]
},
hidden: true,
children: [
{
path: '',
@ -941,6 +942,7 @@ export const asyncRouter = [
i18n: 'router.pulishManage',
roles: [admin]
},
hidden: true,
children: [
{ // 发布地图
path: 'map',
@ -1041,6 +1043,7 @@ export const asyncRouter = [
i18n: 'router.orderAuthorityManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'author/manage',
@ -1112,6 +1115,7 @@ export const asyncRouter = [
i18n: 'router.systemManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'dictionary',
@ -1323,6 +1327,7 @@ export const asyncRouter = [
i18n: 'router.fileManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'list',
@ -1399,6 +1404,7 @@ export const asyncRouter = [
i18n: 'router.newDesignUserPage',
roles: [admin, user]
},
hidden: true,
children: [
{
path: 'usermap',
@ -1505,6 +1511,7 @@ export const asyncRouter = [
i18n: 'router.raceManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'bank',
@ -1549,7 +1556,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.simulation',
roles: [admin, user, userTrainingPlatform]
roles: [user]
},
children: [
{ // 仿真
@ -1589,7 +1596,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.teachingManagement',
roles: [admin, user, userTrainingPlatform]
roles: [admin, user]
},
children: [
{
@ -1756,7 +1763,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.lineDesign',
roles: [admin, user, userTrainingPlatform]
roles: [admin]
},
children: [
{
@ -1793,7 +1800,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.case',
roles: [admin, user, userTrainingPlatform]
roles: [admin, user]
},
children: [
{
@ -1827,7 +1834,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.SystemManagement',
roles: [admin, userTrainingPlatform]
roles: [admin]
},
children: [
{ // 系统数据管理

View File

@ -20,7 +20,8 @@ function hasPermission(roles, route, parentsRoles) {
return result.length && route.meta.roles.indexOf(userTrainingPlatform) < 0;
} else {
roles = roles.filter((role) => route.meta.roles.indexOf(role) >= 0);
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0;
// return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0;
return roles.some(role => route.meta.roles.indexOf(role) >= 0);
}
} else if (parentsRoles) {
// 如果没有本级路由,有父级路由,则使用父级路由过滤