From 4ab8483486c48bfa341c9cb44dbe5eebeee4a923 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Sun, 31 Oct 2021 14:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=A5=E6=BA=90=E5=8F=8A?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 15 +- src/layouts/navbar/index.vue | 4 +- src/libs/auth/generateBtnPermission.js | 24 ++- src/libs/route/addRoutes.js | 2 +- src/pages/data/list/index.vue | 213 +++++++++---------------- src/pages/role/list/index.vue | 47 ++---- src/pages/user/list/index.vue | 4 +- 7 files changed, 110 insertions(+), 199 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 9f6974d..5ef267d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -40,19 +40,18 @@ export default { userTemplate: `http://39.108.250.202/template/%E6%95%B0%E6%8D%AE%E5%B9%B3%E5%8F%B0%E7%94%A8%E6%88%B7%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx`, // 角色管理 - batchRemove:`/data/data/role/batchRemove`, - getRole:`/data/data/role/get`, + batchRemove:`/users/role/batchRemove`, + getRole:`/users/role/obtainDetails`, getName:`/data/data/role/getName`, - listRole:`/data/data/role/list`, + listRole:`/users/role/list`, removeRole:`/data/data/role/remove`, - saveOrUpdate:`/data/data/role/saveOrUpdate`, - getRoles:`/data/data/role/getRole`, - getPermissions:`/data/data/permission/getPermissions`, + saveOrUpdate:`/users/role/saveOrUpdate`, + getPermissions:`/users/user-role/getUserRolesPermissionMenu`, // 权限菜单管理 doAssign:`/data/data/permission/doAssign`, - queryPermissionMenu:`/data/data/permission/queryPermissionMenu`, - savePer:`/data/data/permission/save`, + queryPermissionMenu:`/users/user-role/grantAllPermissions`, + savePer:`/users/user-role/rolePermissionService`, toAssign:`/data/data/permission/toAssign`, // 表展示 diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index 6b05f9a..eb2dc4e 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -96,8 +96,8 @@ export default { }, // 获取权限列表 getPer(){ - this.$post(this.api.getPermissions).then(res => { - let routes = res.permissions[0].children + this.$get(`${this.api.getPermissions}?platformId=${Setting.platformId}`).then(res => { + let routes = res.permissionMenu[0].children Setting.dynamicRoute && addRoutes(routes) this.initMenu() }).catch(err => { diff --git a/src/libs/auth/generateBtnPermission.js b/src/libs/auth/generateBtnPermission.js index 101f368..195f554 100644 --- a/src/libs/auth/generateBtnPermission.js +++ b/src/libs/auth/generateBtnPermission.js @@ -6,20 +6,16 @@ import store from '@/store'; export default function(data){ let result = [] data.map(e => { - if(e.select){ - e.children.map(n => { - if(n.select){ // select为true,则表示拥有该权限 - if(n.children.length){ - result.push(`${e.name}:${n.name}`) - n.children.map(j => { - j.select && (e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`)) - }) - }else{ - result.push(`${e.path}:${n.name}`) - } - } - }) - } + e.children.map(n => { + if(n.children.length){ + result.push(`${e.name}:${n.name}`) + n.children.map(j => { + e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`) + }) + }else{ + result.push(`${e.path}:${n.name}`) + } + }) }) store.dispatch('auth/addBtnAuth',result) } diff --git a/src/libs/route/addRoutes.js b/src/libs/route/addRoutes.js index e4939b8..fe8aeda 100644 --- a/src/libs/route/addRoutes.js +++ b/src/libs/route/addRoutes.js @@ -11,7 +11,7 @@ function createMeta(item){ function createRoute(data){ data.map(e => { - if(e.select && e.path){ // select为true,则表示拥有该权限,同时path不为空,才生成路由集合 + if(e.path){ // select为true,则表示拥有该权限,同时path不为空,才生成路由集合 let meta = createMeta(e) newRoutes.push({ name: e.path, diff --git a/src/pages/data/list/index.vue b/src/pages/data/list/index.vue index 790f46d..19ca525 100644 --- a/src/pages/data/list/index.vue +++ b/src/pages/data/list/index.vue @@ -1,7 +1,7 @@