mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
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:
@@ -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) => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user