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

This commit is contained in:
王靖文 2025-05-16 16:35:18 +08:00
parent 581ca07cd3
commit 1aea6aca7c
3 changed files with 17512 additions and 5 deletions

17486
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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'])

View File

@ -255,10 +255,15 @@ 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()
} }
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()