代码更新

This commit is contained in:
2022-12-08 14:41:24 +08:00
parent 7902ae10f6
commit 7e30b906d1
4 changed files with 11 additions and 21 deletions

View File

@@ -539,6 +539,7 @@ export default {
crudDept.getDeptTree().then(res => {
this.deptsDatas = res.content
})
console.log(row)
this.nodeKey = 'dept_id'
this.openDrawer()
this.drawerTitle = '分配部门权限'
@@ -552,8 +553,8 @@ export default {
getAll().then(res => {
this.rolesDatas = res
// 回显默认选中
console.log(res)
console.log(row.roles)
// console.log(res)
// console.log(row)
this.$nextTick(function() {
for (let i = 0; i < this.rolesDatas.length; i++) {
for (let j = 0; j < row.roles.length; j++) {
@@ -578,7 +579,7 @@ export default {
this.depCheckedId = row.user_id
},
clearCheck() {
this.$refs.deptUser.setCheckedKeys([])
if (this.flag) this.$refs.deptUser.setCheckedKeys([])
},
handleClose(done) {
this.$confirm('确认关闭?')
@@ -600,9 +601,6 @@ export default {
} else {
user.roles = this.crud.selections.map(item => (item.role_id))
}
console.log('user', user)
console.log(this.flag)
console.log(this.crud.selections)
crudUser.edit(user).then(res => {
this.cancelForm()
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
@@ -611,7 +609,7 @@ export default {
},
// 覆盖原有勾选功能,父与子关联,子与父不关联
handCheck(data, node) {
this.hanleCheck(data, node, 'tree')
this.hanleCheck(data, node, 'deptUser')
},
hanleCheck(data, node, treeName) {
const _this = this
@@ -637,7 +635,7 @@ export default {
const _this = this
// console.log(data, checked, indeterminate);
// 选中全部子节点,父节点也默认选中,但是子节点再次取消勾选或者全部子节点取消勾选也不会影响父节点勾选状态
const checkNode = _this.$refs.tree.getNode(data)// 获取当前节点
const checkNode = _this.$refs.deptUser.getNode(data)// 获取当前节点
// 勾选部分子节点,父节点变为半选状态
if (checkNode.parent && checkNode.parent.childNodes.some(ele => ele.checked)) {
checkNode.parent.indeterminate = true