菜单授权
Showing
8 changed files
with
57 additions
and
152 deletions
| ... | @@ -16,7 +16,7 @@ export const getRolesById = categoryId => { | ... | @@ -16,7 +16,7 @@ export const getRolesById = categoryId => { |
| 16 | conditions: [ | 16 | conditions: [ |
| 17 | { | 17 | { |
| 18 | property: 'category', | 18 | property: 'category', |
| 19 | value:categoryId, | 19 | value: categoryId, |
| 20 | operator: 'EQ' | 20 | operator: 'EQ' |
| 21 | } | 21 | } |
| 22 | ], | 22 | ], |
| ... | @@ -81,3 +81,43 @@ export const getParentMenuListAction = (id) => { | ... | @@ -81,3 +81,43 @@ export const getParentMenuListAction = (id) => { |
| 81 | const params = getParams(conditionGroup) | 81 | const params = getParams(conditionGroup) |
| 82 | return getAction(api.menus, params) | 82 | return getAction(api.menus, params) |
| 83 | } | 83 | } |
| 84 | // 获取权限列表 | ||
| 85 | export const getAuthorityListAction = (productId, subsystemCode) => { | ||
| 86 | const conditionGroup = { | ||
| 87 | conditions: [ | ||
| 88 | { | ||
| 89 | property: 'productId', | ||
| 90 | value: productId, | ||
| 91 | operator: 'EQ' | ||
| 92 | }, | ||
| 93 | { | ||
| 94 | property: 'code', | ||
| 95 | value: subsystemCode + '_MENU', | ||
| 96 | operator: 'EQ' | ||
| 97 | } | ||
| 98 | ], | ||
| 99 | queryRelation: 'AND' | ||
| 100 | } | ||
| 101 | const params = getParams(conditionGroup) | ||
| 102 | return getAction(api.resourceCategory, params) | ||
| 103 | } | ||
| 104 | /** | ||
| 105 | * 获取角色的权限 id operationCodes resourceCategoryCode | ||
| 106 | * id 授权id | ||
| 107 | * operationCodes 操作符集合 | ||
| 108 | * resourceCategoryCode 菜单默认MENU | ||
| 109 | */ | ||
| 110 | export const getRoleAuthorityList = ( | ||
| 111 | id, | ||
| 112 | operationCodes, | ||
| 113 | resourceCategoryCode | ||
| 114 | ) => { | ||
| 115 | return getAction(`${api.rolePermissions}/${id}`, { | ||
| 116 | operationCodes: operationCodes, | ||
| 117 | resourceCategoryCode: resourceCategoryCode | ||
| 118 | }) | ||
| 119 | } | ||
| 120 | // 角色授权 | ||
| 121 | export const roleAuthority = (id, permissionDtos) => { | ||
| 122 | return putAction(`${api.rolePermissions}/${id}`, permissionDtos) | ||
| 123 | } | ... | ... |
| 1 | import Vue from 'vue' | 1 | import Vue from 'vue' |
| 2 | 2 | ||
| 3 | // 下载,导出 | 3 | // 下载,导出 |
| 4 | Vue.prototype.$download = function(name, href) { | 4 | Vue.prototype.$download = function (name, href) { |
| 5 | var a = document.createElement('a') // 创建a标签 | 5 | var a = document.createElement('a') // 创建a标签 |
| 6 | var e = document.createEvent('MouseEvents') // 创建鼠标事件对象 | 6 | var e = document.createEvent('MouseEvents') // 创建鼠标事件对象 |
| 7 | e.initEvent('click', false, false) // 初始化事件对象 | 7 | e.initEvent('click', false, false) // 初始化事件对象 |
| ... | @@ -10,7 +10,7 @@ Vue.prototype.$download = function(name, href) { | ... | @@ -10,7 +10,7 @@ Vue.prototype.$download = function(name, href) { |
| 10 | a.dispatchEvent(e) // 给指定的元素,执行事件click事件 | 10 | a.dispatchEvent(e) // 给指定的元素,执行事件click事件 |
| 11 | } | 11 | } |
| 12 | // 导出json文件 | 12 | // 导出json文件 |
| 13 | Vue.prototype.$downloadJson = function(data, name) { | 13 | Vue.prototype.$downloadJson = function (data, name) { |
| 14 | // 1 生成文件的 blob 对象 | 14 | // 1 生成文件的 blob 对象 |
| 15 | const blobData = new Blob([JSON.stringify(data)], { | 15 | const blobData = new Blob([JSON.stringify(data)], { |
| 16 | type: 'application/octet-stream' | 16 | type: 'application/octet-stream' |
| ... | @@ -84,7 +84,7 @@ const checkCode = (rule, value, callback) => { | ... | @@ -84,7 +84,7 @@ const checkCode = (rule, value, callback) => { |
| 84 | // } | 84 | // } |
| 85 | // } | 85 | // } |
| 86 | // 日期格式转换 "yyyy-MM-dd HH:mm:ss" | 86 | // 日期格式转换 "yyyy-MM-dd HH:mm:ss" |
| 87 | Vue.prototype.$formdate = function(date) { | 87 | Vue.prototype.$formdate = function (date) { |
| 88 | if (!date) { | 88 | if (!date) { |
| 89 | return "" | 89 | return "" |
| 90 | } | 90 | } |
| ... | @@ -95,22 +95,22 @@ Vue.prototype.$formdate = function(date) { | ... | @@ -95,22 +95,22 @@ Vue.prototype.$formdate = function(date) { |
| 95 | var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':'; | 95 | var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':'; |
| 96 | var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':'; | 96 | var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':'; |
| 97 | var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()); | 97 | var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()); |
| 98 | return YY + MM + DD +" "+hh + mm + ss | 98 | return YY + MM + DD + " " + hh + mm + ss |
| 99 | } | 99 | } |
| 100 | // 时间格式过滤 | 100 | // 时间格式过滤 |
| 101 | Vue.filter('timeFilter', function(timeStr) { | 101 | Vue.filter('timeFilter', function (timeStr) { |
| 102 | if (timeStr) { | 102 | if (timeStr) { |
| 103 | return timeStr.substring(0, 10) | 103 | return timeStr.substring(0, 10) |
| 104 | } | 104 | } |
| 105 | }) | 105 | }) |
| 106 | export function getType(o) { | 106 | export function getType (o) { |
| 107 | return Object.prototype.toString.call(o).slice(8, -1) | 107 | return Object.prototype.toString.call(o).slice(8, -1) |
| 108 | } | 108 | } |
| 109 | export function isKeyType(o, type) { | 109 | export function isKeyType (o, type) { |
| 110 | return getType(o).toLowerCase() === type.toLowerCase() | 110 | return getType(o).toLowerCase() === type.toLowerCase() |
| 111 | } | 111 | } |
| 112 | // 深拷贝全局挂载 | 112 | // 深拷贝全局挂载 |
| 113 | Vue.prototype.$deepCopy = function(sth) { | 113 | Vue.prototype.$deepCopy = function (sth) { |
| 114 | // 深度复制数组 | 114 | // 深度复制数组 |
| 115 | // if (Object.prototype.toString.call(obj) === "[object Array]") { | 115 | // if (Object.prototype.toString.call(obj) === "[object Array]") { |
| 116 | // const object = []; | 116 | // const object = []; |
| ... | @@ -196,7 +196,7 @@ Vue.prototype.$dealArrNotDisabled = arr => { | ... | @@ -196,7 +196,7 @@ Vue.prototype.$dealArrNotDisabled = arr => { |
| 196 | } | 196 | } |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | function nodeDeal(arr) { | 199 | function nodeDeal (arr) { |
| 200 | arr.forEach(item => { | 200 | arr.forEach(item => { |
| 201 | delete item.disabled | 201 | delete item.disabled |
| 202 | if (item.children) { | 202 | if (item.children) { |
| ... | @@ -222,7 +222,7 @@ Vue.prototype.$dealArrDisabled = (arr, id) => { | ... | @@ -222,7 +222,7 @@ Vue.prototype.$dealArrDisabled = (arr, id) => { |
| 222 | } | 222 | } |
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | function nodeDeal(arr) { | 225 | function nodeDeal (arr) { |
| 226 | arr.forEach(item => { | 226 | arr.forEach(item => { |
| 227 | item['disabled'] = true | 227 | item['disabled'] = true |
| 228 | if (item.children) { | 228 | if (item.children) { |
| ... | @@ -249,10 +249,9 @@ Vue.prototype.$getNodeRoute = (val, id) => { | ... | @@ -249,10 +249,9 @@ Vue.prototype.$getNodeRoute = (val, id) => { |
| 249 | } | 249 | } |
| 250 | } | 250 | } |
| 251 | }) | 251 | }) |
| 252 | function nodefun(newVal, newId, newCid_list) { | 252 | function nodefun (newVal, newId, newCid_list) { |
| 253 | let flag = false | 253 | let flag = false |
| 254 | newVal.forEach(j => { | 254 | newVal.forEach(j => { |
| 255 | // console.log(j) | ||
| 256 | if (j.id === newId) { | 255 | if (j.id === newId) { |
| 257 | newCid_list.push(j.id) | 256 | newCid_list.push(j.id) |
| 258 | flag = true | 257 | flag = true |
| ... | @@ -272,7 +271,7 @@ Vue.prototype.$getNodeRoute = (val, id) => { | ... | @@ -272,7 +271,7 @@ Vue.prototype.$getNodeRoute = (val, id) => { |
| 272 | return newCid_list | 271 | return newCid_list |
| 273 | } | 272 | } |
| 274 | } | 273 | } |
| 275 | function result(cid_list) { | 274 | function result (cid_list) { |
| 276 | const arr = cid_list.concat() | 275 | const arr = cid_list.concat() |
| 277 | arr.pop() | 276 | arr.pop() |
| 278 | return arr | 277 | return arr |
| ... | @@ -325,7 +324,7 @@ Vue.prototype.$findParent = (list, id) => { | ... | @@ -325,7 +324,7 @@ Vue.prototype.$findParent = (list, id) => { |
| 325 | Vue.prototype.$findChildren = (list, nodeId) => { | 324 | Vue.prototype.$findChildren = (list, nodeId) => { |
| 326 | let newArray = [] | 325 | let newArray = [] |
| 327 | let flag = false | 326 | let flag = false |
| 328 | function dealList(list, nodeId) { | 327 | function dealList (list, nodeId) { |
| 329 | if (list.length !== 0) { | 328 | if (list.length !== 0) { |
| 330 | list.forEach(item => { | 329 | list.forEach(item => { |
| 331 | if (!flag) { | 330 | if (!flag) { | ... | ... |
| 1 | <template> | ||
| 2 | <Dialog :title="title" class="tableClass" :show.sync="visible" :width="'715px'" @close="close()"> | ||
| 3 | <template slot="content"> | ||
| 4 | <lb-table ref="multipleTable" | ||
| 5 | :pagination="false" | ||
| 6 | :column="tableData.column" | ||
| 7 | :data="tableData.data" | ||
| 8 | @selection-change="handleSelectionChange"> | ||
| 9 | </lb-table> | ||
| 10 | </template> | ||
| 11 | <template slot="footer"> | ||
| 12 | <el-button type="primary" class="save" @click="handleSaveMember()" | ||
| 13 | >保存</el-button | ||
| 14 | > | ||
| 15 | <el-button class="cancel-button" @click="close()">取消</el-button> | ||
| 16 | </template> | ||
| 17 | </Dialog> | ||
| 18 | </template> | ||
| 19 | |||
| 20 | <script> | ||
| 21 | import Dialog from "@/components/Dialog/"; | ||
| 22 | export default { | ||
| 23 | name: "", | ||
| 24 | components: { Dialog }, | ||
| 25 | props: {}, | ||
| 26 | data() { | ||
| 27 | return { | ||
| 28 | title: "人员配置", | ||
| 29 | visible: false, | ||
| 30 | tableData: { | ||
| 31 | column: [ | ||
| 32 | { | ||
| 33 | type: 'selection' | ||
| 34 | }, | ||
| 35 | { | ||
| 36 | prop: 'name', | ||
| 37 | label: '角色名称' | ||
| 38 | }, | ||
| 39 | { | ||
| 40 | prop: 'type', | ||
| 41 | label: '角色类型' | ||
| 42 | }, | ||
| 43 | { | ||
| 44 | prop: 'departmentName', | ||
| 45 | label: '角色描述' | ||
| 46 | }, | ||
| 47 | ], | ||
| 48 | data: [ | ||
| 49 | { | ||
| 50 | id: "3127e455-43ba-45ff-9326-0e02ef89485e", | ||
| 51 | createdAt: null, | ||
| 52 | updatedAt: "2022-08-04T03:38:27.626+0000", | ||
| 53 | createdBy: null, | ||
| 54 | updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e", | ||
| 55 | sort: 1, | ||
| 56 | name: "超级管理员", | ||
| 57 | loginName: "admin", | ||
| 58 | password: "05eb15777e8fd1d61c840472e7267f61d432f63340d86b59", | ||
| 59 | passwordSalt: "5178114777136485", | ||
| 60 | email: null, | ||
| 61 | lastLoginTime: null, | ||
| 62 | mobilePhone: "18291003568", | ||
| 63 | status: "ACTIVE", | ||
| 64 | passwordChangeTime: "2021-12-10T08:01:01.569+0000", | ||
| 65 | idCard: "612725202111021521", | ||
| 66 | departmentId: "2eae5304-544f-4f5b-b354-8f5d47433c9b", | ||
| 67 | organizationId: "0bca67ae-1d9e-4b41-b057-f165586d24aa", | ||
| 68 | sex: "0", | ||
| 69 | isDuty: true, | ||
| 70 | type:"", | ||
| 71 | code: "123324", | ||
| 72 | jobLevel: null, | ||
| 73 | telephone: "028-87720898", | ||
| 74 | address: "办公地点修改测试", | ||
| 75 | isLocked: false, | ||
| 76 | departmentName: "研发部", | ||
| 77 | _X_ROW_KEY: "row_276", | ||
| 78 | }, | ||
| 79 | { | ||
| 80 | name: '数据管理员', | ||
| 81 | type:"1", | ||
| 82 | }, | ||
| 83 | { | ||
| 84 | name: '数据管理员2', | ||
| 85 | type:"d", | ||
| 86 | } | ||
| 87 | ] | ||
| 88 | }, | ||
| 89 | multipleSelection: [] | ||
| 90 | |||
| 91 | } | ||
| 92 | }, | ||
| 93 | computed: {}, | ||
| 94 | watch: {}, | ||
| 95 | created() {}, | ||
| 96 | mounted() {}, | ||
| 97 | methods: { | ||
| 98 | authorization() { | ||
| 99 | this.visible = true; | ||
| 100 | }, | ||
| 101 | close() { | ||
| 102 | // this.resetForm() | ||
| 103 | this.visible = false; | ||
| 104 | }, | ||
| 105 | // 保存事件 | ||
| 106 | handleSaveMember() { | ||
| 107 | // if (this.memberList.length === 0) { | ||
| 108 | // this.$message.warning("请添加待选人员"); | ||
| 109 | // return false; | ||
| 110 | // } | ||
| 111 | // const idList = this.memberList.map(item => item.id) | ||
| 112 | // updateUser(this.roleId, idList).then(res => { | ||
| 113 | // if (res.status === 1) { | ||
| 114 | // this.$message.success({ message: '保存成功', showClose: true }) | ||
| 115 | // this.showMemberConfigDialog = false | ||
| 116 | // this.$emit('setUsers', this.roleId) | ||
| 117 | // this.resetMemberConfig() | ||
| 118 | // } else this.$message.error({ message: res.message, showClose: true }) | ||
| 119 | // }) | ||
| 120 | }, | ||
| 121 | handleSelectionChange (val) { | ||
| 122 | this.multipleSelection = val | ||
| 123 | } | ||
| 124 | } | ||
| 125 | }; | ||
| 126 | </script> | ||
| 127 | <style scoped lang="scss"> | ||
| 128 | /deep/.el-dialog__header{ | ||
| 129 | text-align: center; | ||
| 130 | margin-bottom: 10px; | ||
| 131 | .el-dialog__title{ | ||
| 132 | color: white; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | </style> |
| ... | @@ -166,6 +166,7 @@ export default { | ... | @@ -166,6 +166,7 @@ export default { |
| 166 | methods: { | 166 | methods: { |
| 167 | // 获取父级菜单 | 167 | // 获取父级菜单 |
| 168 | getParentMenuList(id) { | 168 | getParentMenuList(id) { |
| 169 | |||
| 169 | getParentMenuListAction(id).then((res) => { | 170 | getParentMenuListAction(id).then((res) => { |
| 170 | if (res.status === 1) { | 171 | if (res.status === 1) { |
| 171 | const list = this.$dealArrChildren(res.content) | 172 | const list = this.$dealArrChildren(res.content) |
| ... | @@ -195,7 +196,7 @@ export default { | ... | @@ -195,7 +196,7 @@ export default { |
| 195 | }, | 196 | }, |
| 196 | // 新增菜单 | 197 | // 新增菜单 |
| 197 | add() { | 198 | add() { |
| 198 | this.getParentMenuList(this.productId) | 199 | this.getParentMenuList("2925fdeb-ddeb-4c15-8ee0-7bc3aa75ec2b") |
| 199 | this.visible = true | 200 | this.visible = true |
| 200 | this.type = 0 | 201 | this.type = 0 |
| 201 | this.form.jumpMode = 1 | 202 | this.form.jumpMode = 1 | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment