|
|
@@ -244,7 +244,6 @@
|
|
|
}
|
|
|
|
|
|
const showPermissionDialog = (row: any) => {
|
|
|
- console.log(`%c row == `, 'background:#41b883 ; padding:1px; color:#fff', row)
|
|
|
permissionDialog.value = true
|
|
|
nowRoleInfo.id = row.id
|
|
|
nowRoleInfo.name = row.name
|
|
|
@@ -252,7 +251,6 @@
|
|
|
nowRoleInfo.create_date = row.create_date
|
|
|
nowRoleInfo.auth_ids = row.auth_ids
|
|
|
nowRoleInfo.show_ids = row.show_ids
|
|
|
- console.log(`%c row.show_ids == `, 'background:#41b883 ; padding:1px; color:#fff', row.show_ids)
|
|
|
const tree = treeRef.value
|
|
|
if (!tree) return
|
|
|
tree.setCheckedKeys(row.show_ids)
|
|
|
@@ -293,11 +291,14 @@
|
|
|
|
|
|
const savePermission = async () => {
|
|
|
let tree = treeRef.value
|
|
|
- await roleService.saveRoleAuth(nowRoleInfo.id, tree.getCheckedKeys(), tree.getHalfCheckedKeys())
|
|
|
- permissionDialog.value = false
|
|
|
- setTimeout(() => {
|
|
|
+ if (tree.getCheckedKeys().length === 0) {
|
|
|
+ ElMessage.error('请选择权限')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await roleService.saveRoleAuth(nowRoleInfo.id, tree.getCheckedKeys(), tree.getHalfCheckedKeys()).then(() => {
|
|
|
+ permissionDialog.value = false
|
|
|
getTableData()
|
|
|
- }, 1000)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const toggleExpandAll = () => {
|
|
|
@@ -333,8 +334,8 @@
|
|
|
const keys: string[] = []
|
|
|
const traverse = (nodeList: any[]) => {
|
|
|
nodeList.forEach((node) => {
|
|
|
- if (node.name) {
|
|
|
- keys.push(node.name)
|
|
|
+ if (node.id) {
|
|
|
+ keys.push(node.id)
|
|
|
}
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
traverse(node.children)
|