Skip to content

Commit 33df5f3

Browse files
committed
fix(Three-way Synchronization): Uncheck the box for selected users on the right to select those not in the synchronization list.
1 parent eeae468 commit 33df5f3

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

frontend/src/views/system/user/SyncUserDing.vue

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ const dfsTree = (arr: any) => {
162162
})
163163
}
164164
165+
const dfsTreeIds = (arr: any, ids: any) => {
166+
return arr.filter((ele: any) => {
167+
if (ele.children?.length) {
168+
ele.children = dfsTreeIds(ele.children, ids)
169+
}
170+
if (
171+
(ele.name.toLowerCase() as string).includes(search.value.toLowerCase()) ||
172+
ele.children?.length
173+
) {
174+
ids.push(ele.id)
175+
return true
176+
}
177+
return false
178+
})
179+
}
180+
165181
watch(search, () => {
166182
organizationUserList.value = dfsTree(cloneDeep(rawTree))
167183
nextTick(() => {
@@ -179,7 +195,15 @@ function isLeafNode(node: any) {
179195
}
180196
181197
const handleCheck = () => {
182-
const userList = [...organizationUserRef.value.getCheckedNodes(), ...checkTableList.value]
198+
const treeIds: any = []
199+
dfsTreeIds(cloneDeep(rawTree), treeIds)
200+
const checkNodes = organizationUserRef.value.getCheckedNodes()
201+
const checkNodesIds = checkNodes.map((ele: any) => ele.id)
202+
checkTableList.value = checkTableList.value.filter(
203+
(ele: any) =>
204+
!treeIds.includes(ele.id) || (treeIds.includes(ele.id) && checkNodesIds.includes(ele.id))
205+
)
206+
const userList = [...checkNodes, ...checkTableList.value]
183207
let idArr = [...new Set(userList.map((ele: any) => ele.id))]
184208
185209
checkTableList.value = userList.filter((ele: any) => {

frontend/src/views/system/user/User.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,6 @@ const showTips = (successCount: any, errorCount: any, dataKey: any) => {
10281028
.then(() => {
10291029
const { value, name } = currentPlatform.value
10301030
syncUserRef.value.open(value, name)
1031-
currentPlatform.value = null
10321031
})
10331032
.catch(() => {
10341033
currentPlatform.value = null

0 commit comments

Comments
 (0)