mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 08:22:41 +08:00
用户管理,选中树形后无法取消选中问题
This commit is contained in:
parent
581ca07cd3
commit
1aea6aca7c
17486
package-lock.json
generated
Normal file
17486
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -46,8 +46,24 @@ const filterNode = (name: string, data: Tree) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 处理部门被点击 */
|
/** 处理部门被点击 */
|
||||||
const handleNodeClick = async (row: { [key: string]: any }) => {
|
let currentNode: any = {}
|
||||||
|
const handleNodeClick = async (row: { [key: string]: any }, treeNode: any) => {
|
||||||
|
// 判断选中状态
|
||||||
|
if (currentNode && currentNode.name === row.name) {
|
||||||
|
treeNode.checked = !treeNode.checked
|
||||||
|
} else {
|
||||||
|
treeNode.checked = true
|
||||||
|
}
|
||||||
|
if (treeNode.checked) {
|
||||||
|
// 选中
|
||||||
|
currentNode = row
|
||||||
emits('node-click', row)
|
emits('node-click', row)
|
||||||
|
} else {
|
||||||
|
// 取消选中
|
||||||
|
treeRef.value!.setCurrentKey(undefined)
|
||||||
|
emits('node-click', undefined)
|
||||||
|
currentNode = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const emits = defineEmits(['node-click'])
|
const emits = defineEmits(['node-click'])
|
||||||
|
|
||||||
|
@ -255,9 +255,14 @@ const resetQuery = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 处理部门被点击 */
|
/** 处理部门被点击 */
|
||||||
const handleDeptNodeClick = async (row) => {
|
const handleDeptNodeClick = async (row: any) => {
|
||||||
|
if (row === undefined) {
|
||||||
|
queryParams.deptId = undefined
|
||||||
|
await getList()
|
||||||
|
} else {
|
||||||
queryParams.deptId = row.id
|
queryParams.deptId = row.id
|
||||||
await getList()
|
await getList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user