Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion frontend/src/views/system/user/SyncUserDing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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) => {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/views/system/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down