|
|
@ -52,7 +52,7 @@ |
|
|
|
<el-table-column label="功能选项"> |
|
|
|
<template v-if="scope.row.children.length === 0" slot-scope="scope"> |
|
|
|
<el-checkbox |
|
|
|
v-for="options in scope.row.resourcePermissionList" |
|
|
|
v-for="options in scope.row.resourcePermissions" |
|
|
|
:key="options.id" |
|
|
|
v-model="options.checked" |
|
|
|
:label="options.permissionType" |
|
|
@ -154,6 +154,7 @@ export default { |
|
|
|
}, |
|
|
|
getRoleMenuList(roleId) { |
|
|
|
getPermissionsByRoleId(roleId).then(data => { |
|
|
|
data = data.map(row => row.resourcePermissionId) |
|
|
|
this.menuList.forEach(permission => { |
|
|
|
if (permission.children.length > 0) { |
|
|
|
this.echoChildren(permission.children, data) |
|
|
@ -167,14 +168,14 @@ export default { |
|
|
|
// 有下级去处理下级 |
|
|
|
if (val.children.length > 0) { |
|
|
|
if (checked) { |
|
|
|
this.checkedIds.add(val.resourcePermissionList[0].id) |
|
|
|
this.checkedIds.add(val.resourcePermissions[0].id) |
|
|
|
} else { |
|
|
|
this.checkedIds.delete(val.resourcePermissionList[0].id) |
|
|
|
this.checkedIds.delete(val.resourcePermissions[0].id) |
|
|
|
} |
|
|
|
this.findChildren(val.children, checked) |
|
|
|
} else { |
|
|
|
// 无下级处理本级 |
|
|
|
val.resourcePermissionList.forEach(options => { |
|
|
|
val.resourcePermissions.forEach(options => { |
|
|
|
options.checked = checked |
|
|
|
if (checked) { |
|
|
|
this.checkedIds.add(options.id) |
|
|
@ -190,9 +191,9 @@ export default { |
|
|
|
val.indeterminate = false |
|
|
|
}, |
|
|
|
handleCheckChange(val) { |
|
|
|
const length = val.resourcePermissionList.length |
|
|
|
const length = val.resourcePermissions.length |
|
|
|
let checkedLength = 0 |
|
|
|
val.resourcePermissionList.forEach(options => { |
|
|
|
val.resourcePermissions.forEach(options => { |
|
|
|
if (options.checked) { |
|
|
|
this.checkedIds.add(options.id) |
|
|
|
checkedLength++ |
|
|
@ -211,7 +212,7 @@ export default { |
|
|
|
list.forEach(children => { |
|
|
|
children.checked = checked |
|
|
|
children.indeterminate = false |
|
|
|
children.resourcePermissionList.forEach(options => { |
|
|
|
children.resourcePermissions.forEach(options => { |
|
|
|
options.checked = checked |
|
|
|
if (checked) { |
|
|
|
this.checkedIds.add(options.id) |
|
|
@ -240,10 +241,12 @@ export default { |
|
|
|
}) |
|
|
|
result.checked = parentCheckedLength === result.children.length |
|
|
|
result.indeterminate = (parentIndeterminateLength > 0 || parentCheckedLength > 0) && parentCheckedLength < result.children.length |
|
|
|
if (result.permission.component !== 'Layout') { |
|
|
|
if (result.checked || result.indeterminate) { |
|
|
|
this.checkedIds.add(result.resourcePermissionList[0].id) |
|
|
|
this.checkedIds.add(result.resourcePermissions[0].id) |
|
|
|
} else { |
|
|
|
this.checkedIds.delete(result.resourcePermissionList[0].id) |
|
|
|
this.checkedIds.delete(result.resourcePermissions[0].id) |
|
|
|
} |
|
|
|
} |
|
|
|
// 如果还有上级,继续操作 |
|
|
|
if (result.permission.pid !== 0) { |
|
|
@ -265,7 +268,7 @@ export default { |
|
|
|
}, |
|
|
|
settingChecked(result, optionsIds) { |
|
|
|
let matching = false |
|
|
|
result.resourcePermissionList.forEach(options => { |
|
|
|
result.resourcePermissions.forEach(options => { |
|
|
|
optionsIds.forEach(optionsId => { |
|
|
|
if (options.id === optionsId) { |
|
|
|
options.checked = true |
|
|
@ -282,7 +285,7 @@ export default { |
|
|
|
menuList.forEach(permission => { |
|
|
|
permission.checked = false |
|
|
|
permission.indeterminate = false |
|
|
|
permission.resourcePermissionList.forEach(options => { |
|
|
|
permission.resourcePermissions.forEach(options => { |
|
|
|
options.checked = false |
|
|
|
}) |
|
|
|
if (permission.children.length > 0) { |
|
|
|