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