Commit 0879cdd1 by 芋道源码 Committed by Gitee

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

Merge pull request !779 from 王靖文/master
parents 2217c141 1aea6aca
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) => { ...@@ -46,8 +46,24 @@ const filterNode = (name: string, data: Tree) => {
} }
/** 处理部门被点击 */ /** 处理部门被点击 */
const handleNodeClick = async (row: { [key: string]: any }) => { let currentNode: any = {}
emits('node-click', row) 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']) const emits = defineEmits(['node-click'])
......
...@@ -255,9 +255,14 @@ const resetQuery = () => { ...@@ -255,9 +255,14 @@ const resetQuery = () => {
} }
/** 处理部门被点击 */ /** 处理部门被点击 */
const handleDeptNodeClick = async (row) => { const handleDeptNodeClick = async (row: any) => {
queryParams.deptId = row.id if (row === undefined) {
await getList() 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