瀏覽代碼

权限管理修改路由

zhaoke 2 年之前
父節點
當前提交
3b7b25e5af

+ 43 - 22
src/router/routes/routes-file-two.ts

@@ -4,54 +4,75 @@ const HomeRoutes = {
   path: '/userManagement',
   component: Layout,
   name: 'UserManagement',
-  redirect: '/userManagement/role',
+  redirect: '/userManagement/permission',
   //using el svg icon, the elSvgIcon first when at the same time using elSvgIcon and icon
   meta: { title: '权限管理', elSvgIcon: 'Fold' },
   children: [
     {
-      path: 'permission',
+      path: '/userManagement/permission',
       name: 'Permission',
       meta: { title: '权限项管理' },
       component: () => import('@/views/userManagement/permission/index.vue'),
     },
     {
-      path: 'role',
+      path: '/userManagement/role',
       name: 'Role',
       meta: { title: '角色管理' },
-      component: () => import('@/views/userManagement/role/index.vue'),
+      redirect: '/userManagement/role',
+      component: {
+        render: () => h(resolveComponent('router-view')),
+      },
+      children: [
+        {
+          path: '/userManagement/role',
+          name: 'Role',
+          hidden: true,
+          component: () => import('@/views/userManagement/role/index.vue'),
+        },
+        {
+          path: '/userManagement/role/auth',
+          name: 'Auth',
+          hidden: true,
+          meta: { title: '角色授权' },
+          component: () => import('@/views/userManagement/role/auth.vue'),
+        },
+      ],
     },
     {
-      path: 'account',
+      path: '/userManagement/account',
       name: 'Account',
       meta: { title: '账号管理' },
-      component: () => import('@/views/userManagement/account/index.vue'),
+      redirect: '/userManagement/account',
+      component: {
+        render: () => h(resolveComponent('router-view')),
+      },
+      children: [
+        {
+          path: '/userManagement/account',
+          component: () => import('@/views/userManagement/account/index.vue'),
+          hidden: true,
+        },
+        {
+          path: '/userManagement/account/accountAuth',
+          name: 'AccountAuth',
+          hidden: true,
+          meta: { title: '账号权限' },
+          component: () => import('@/views/userManagement/account/auth.vue'),
+        },
+      ],
     },
     {
-      path: 'accountGroup',
+      path: '/userManagement/accountGroup',
       name: 'AccountGroup',
       meta: { title: '账号组管理' },
       component: () => import('@/views/userManagement/accountGroup/index.vue'),
     },
     {
-      path: 'application',
+      path: '/userManagement/application',
       name: 'Application',
       meta: { title: '应用管理' },
       component: () => import('@/views/userManagement/application/index.vue'),
     },
-    {
-      path: 'auth',
-      name: 'Auth',
-      hidden: true,
-      meta: { title: '角色授权' },
-      component: () => import('@/views/userManagement/role/auth.vue'),
-    },
-    {
-      path: 'accountAuth',
-      name: 'AccountAuth',
-      hidden: true,
-      meta: { title: '账号权限' },
-      component: () => import('@/views/userManagement/account/auth.vue'),
-    },
   ],
 }
 

+ 1 - 1
src/views/userManagement/account/index.vue

@@ -208,7 +208,7 @@ const btnClick = (index, row, param) => {
     ruleForm.value = _.cloneDeep(row);
   } else {
     router.push({
-      path: "/userManagement/accountAuth",
+      path: "/userManagement/account/accountAuth",
       query: {
         id: row.user_id,
       },

+ 1 - 1
src/views/userManagement/role/index.vue

@@ -105,7 +105,7 @@ const btnClick = (index, row, param) => {
     ruleForm.value = _.cloneDeep(row);
   } else {
     router.push({
-      path: "/userManagement/auth",
+      path: "/userManagement/role/auth",
       query: {
         role_id: row.role_id,
       },