Commit 1aea6aca by 王靖文

用户管理,选中树形后无法取消选中问题

parent 581ca07c
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,8 +46,24 @@ const filterNode = (name: string, data: Tree) => {
}
/** 处理部门被点击 */
const handleNodeClick = async (row: { [key: string]: any }) => {
emits('node-click', row)
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)
} else {
// 取消选中
treeRef.value!.setCurrentKey(undefined)
emits('node-click', undefined)
currentNode = null
}
}
const emits = defineEmits(['node-click'])
......
......@@ -255,9 +255,14 @@ const resetQuery = () => {
}
/** 处理部门被点击 */
const handleDeptNodeClick = async (row) => {
queryParams.deptId = row.id
await getList()
const handleDeptNodeClick = async (row: any) => {
if (row === undefined) {
queryParams.deptId = undefined
await getList()
} else {
queryParams.deptId = row.id
await getList()
}
}
/** 添加/修改操作 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment