Skip to content

Commit b6b35ec

Browse files
committed
fix(User Management): Synchronize and Deduplicate Users
1 parent 3883338 commit b6b35ec

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<template #default="{ node, data }">
3939
<div class="custom-tree-node flex">
4040
<el-icon size="28">
41-
<avatar_organize v-if="Array.isArray(data.children)"></avatar_organize>
41+
<avatar_organize v-if="!data.options.is_user"></avatar_organize>
4242
<avatar_personal v-else></avatar_personal>
4343
</el-icon>
4444
<span class="ml-8 ellipsis" style="max-width: 40%" :title="node.label">
@@ -160,17 +160,26 @@ const filterNode: FilterNodeMethodFunction = (value: string, data: any) => {
160160
}
161161
162162
function isLeafNode(node: any) {
163-
return !Array.isArray(node.children)
163+
return node.options.is_user
164164
}
165165
166166
const handleCheck = () => {
167-
checkTableList.value = organizationUserRef.value
168-
.getCheckedNodes()
169-
.filter((ele: any) => isLeafNode(ele))
167+
const userList = organizationUserRef.value.getCheckedNodes()
168+
let idArr = [...new Set(userList.map((ele: any) => ele.id))]
169+
170+
checkTableList.value = userList
171+
.filter((ele: any) => {
172+
if (idArr.includes(ele.id) && isLeafNode(ele)) {
173+
idArr = idArr.filter((itx: any) => itx !== ele.id)
174+
return true
175+
}
176+
return false
177+
})
170178
.map((ele: any) => ({
171179
name: ele.name,
172180
id: ele.id,
173181
account: ele.id,
182+
email: ele.options.email,
174183
}))
175184
}
176185
@@ -214,7 +223,11 @@ const emits = defineEmits(['refresh'])
214223
const handleConfirm = () => {
215224
modelApi
216225
.userSync({
217-
user_list: checkTableList.value.map((ele: any) => ({ id: ele.id, name: ele.name })),
226+
user_list: checkTableList.value.map((ele: any) => ({
227+
id: ele.id,
228+
name: ele.name,
229+
email: ele.email || '',
230+
})),
218231
origin: oid,
219232
cover: existingUser.value,
220233
})

0 commit comments

Comments
 (0)