From 2b57c787b596e74a6d0fa6575b40aa618efa0aac Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Mon, 19 Dec 2022 17:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E6=9D=83=E9=99=90=E4=B8=8E?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9D=83=E9=99=90=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nladmin-ui/src/views/system/user/index.vue | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/nladmin-ui/src/views/system/user/index.vue b/nladmin-ui/src/views/system/user/index.vue index dd5bae1..d84001f 100644 --- a/nladmin-ui/src/views/system/user/index.vue +++ b/nladmin-ui/src/views/system/user/index.vue @@ -214,7 +214,7 @@ :data="deptsDatas" :default-checked-keys="depChecked" :props="deptProps" - :node-key="nodeKey" + node-key="deptId" highlight-current check-strictly @check="handCheck" @@ -337,7 +337,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css' let userRoles = [] const defaultForm = { - dept_id: null, + deptId: null, depts: [], username: null, personName: null, @@ -389,7 +389,6 @@ export default { deptsDatas: [], rolesDatas: [], drawerTitle: '', - nodeKey: 'dept_id', flag: true, dataPerm: false, dataDialog: {}, @@ -458,10 +457,10 @@ export default { // 新增与编辑前做的操作 [CRUD.HOOK.afterToCU](crud, form) { this.getRoles() - if (form.dept_id == null) { + if (form.deptId == null) { crudDept.getDepts() } else { - this.getSupDepts(form.dept_id) + this.getSupDepts(form.deptId) } // this.getRoleLevel() 暂时不用 form.isUsed = form.enabled.toString() @@ -633,28 +632,36 @@ export default { }) }) }, + // 部门权限 openDeptDrawer(row) { crudDept.getDeptTree().then(res => { this.deptsDatas = res.content }) - this.nodeKey = 'dept_id' this.openDrawer() this.drawerTitle = '分配部门权限' this.flag = true // 默认选中 - this.depChecked = row.depts + const deptIds = [] + for (var index in row.depts) { + deptIds.push(row.depts[index].deptId) + } + this.$nextTick(() => { + this.$refs.deptUser.setCheckedKeys(deptIds) + }) this.giveValue(row) }, + // 角色权限 openRoleDrawer(row) { this.rolesDatas = [] getAll().then(res => { this.rolesDatas = res // 回显默认选中 this.$nextTick(function() { - for (let i = 0; i < this.rolesDatas.length; i++) { - for (let j = 0; j < row.roles.length; j++) { - if (this.rolesDatas[i].role_id == row.roles[j]) { + for (let j = 0; j < row.roles.length; j++) { + for (let i = 0; i < this.rolesDatas.length; i++) { + if (this.rolesDatas[i].roleId == row.roles[j].roleId) { this.$refs.roleTable.toggleRowSelection(this.rolesDatas[i], true) + break } } } @@ -772,9 +779,9 @@ export default { this.depChecked = [] }, giveValue(row) { - this.depCheckedId = row.user_id + this.depCheckedId = row.userId }, - clearCheck() { + clearCheck() { // 清空选中 if (this.flag) this.$refs.deptUser.setCheckedKeys([]) }, handleClose(done) { @@ -790,12 +797,12 @@ export default { }, saveChecked() { const user = { - user_id: this.depCheckedId + userId: this.depCheckedId } if (this.flag) { user.depts = this.$refs.deptUser.getCheckedKeys() } else { - user.roles = this.crud.selections.map(item => (item.role_id)) + user.roles = this.crud.selections.map(item => (item.roleId)) } crudUser.edit(user).then(res => { this.cancelForm() @@ -852,9 +859,9 @@ export default { user_id: this.dataDialog.user_id, permission_scope_type: row.value } - crudDataPermission.getDataDetail(param).then(res => { - this.dataPermissions = res - }) + // crudDataPermission.getDataDetail(param).then(res => { + // this.dataPermissions = res + // }) this.showData = true } }