fix(Three-way Synchronization): Uncheck the box for selected users on the right to select those not in the synchronization list.

This commit is contained in:
dataeaseShu
2026-02-04 15:19:18 +08:00
committed by dataeaseShu
parent eeae468dbd
commit 502562b326
2 changed files with 25 additions and 2 deletions
@@ -162,6 +162,22 @@ const dfsTree = (arr: any) => {
})
}
const dfsTreeIds = (arr: any, ids: any) => {
return arr.filter((ele: any) => {
if (ele.children?.length) {
ele.children = dfsTreeIds(ele.children, ids)
}
if (
(ele.name.toLowerCase() as string).includes(search.value.toLowerCase()) ||
ele.children?.length
) {
ids.push(ele.id)
return true
}
return false
})
}
watch(search, () => {
organizationUserList.value = dfsTree(cloneDeep(rawTree))
nextTick(() => {
@@ -179,7 +195,15 @@ function isLeafNode(node: any) {
}
const handleCheck = () => {
const userList = [...organizationUserRef.value.getCheckedNodes(), ...checkTableList.value]
const treeIds: any = []
dfsTreeIds(cloneDeep(rawTree), treeIds)
const checkNodes = organizationUserRef.value.getCheckedNodes()
const checkNodesIds = checkNodes.map((ele: any) => ele.id)
checkTableList.value = checkTableList.value.filter(
(ele: any) =>
!treeIds.includes(ele.id) || (treeIds.includes(ele.id) && checkNodesIds.includes(ele.id))
)
const userList = [...checkNodes, ...checkTableList.value]
let idArr = [...new Set(userList.map((ele: any) => ele.id))]
checkTableList.value = userList.filter((ele: any) => {
-1
View File
@@ -1028,7 +1028,6 @@ const showTips = (successCount: any, errorCount: any, dataKey: any) => {
.then(() => {
const { value, name } = currentPlatform.value
syncUserRef.value.open(value, name)
currentPlatform.value = null
})
.catch(() => {
currentPlatform.value = null