Skip to content

Commit 88d92b7

Browse files
committed
fix(Third-Party Synchronization): The synchronization failure list cannot be opened normally.
1 parent e639e15 commit 88d92b7

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

frontend/src/api/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const userApi = {
2121
add: (data: any) => request.post('/user', data),
2222
edit: (data: any) => request.put('/user', data),
2323
clearErrorApi: (key: string) => request.get(`/user/clearErrorRecord/${key}`),
24-
errorRecord: (key: string) => request.get(`/user/errorRecord/${key}`),
24+
errorRecord: (key: string) => request.get(`/user/errorRecord/${key}`, { responseType: 'blob' }),
2525
delete: (key: string) => request.delete(`/user/${key}`),
2626
deleteBatch: (data: any) => request.delete(`/user`, { data }),
2727
get: (key: string) => request.get(`/user/${key}`),

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Details": "详情"
99
},
1010
"sync": {
11-
"integration": "Platform integration needs to be enabled.",
11+
"integration": "需开启平台对接",
1212
"the_existing_user": "若用户已存在,覆盖旧用户",
1313
"sync_users": "同步用户",
1414
"sync_wechat_users": "同步企业微信用户",

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

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ import Close from '@/assets/svg/icon_close_outlined_w.svg'
121121
import Search from '@/assets/svg/icon_search-outline_outlined.svg'
122122
import type { CheckboxValueType } from 'element-plus-secondary'
123123
import type { FilterNodeMethodFunction } from 'element-plus-secondary'
124+
import { cloneDeep } from 'lodash-es'
124125
const checkAll = ref(false)
125126
const existingUser = ref(false)
126127
const isIndeterminate = ref(false)
@@ -134,7 +135,7 @@ const defaultProps = {
134135
children: 'children',
135136
label: 'name',
136137
}
137-
138+
let rawTree: any = []
138139
const organizationUserList = ref<any[]>([])
139140
const loading = ref(false)
140141
const centerDialogVisible = ref(false)
@@ -146,9 +147,23 @@ const workspaceWithKeywords = computed(() => {
146147
)
147148
})
148149
149-
watch(search, (val) => {
150-
organizationUserRef.value!.filter(val)
150+
const dfsTree = (arr: any) => {
151+
return arr.filter((ele: any) => {
152+
if (ele.children?.length) {
153+
ele.children = dfsTree(ele.children)
154+
}
155+
if (
156+
(ele.name.toLowerCase() as string).includes(search.value.toLowerCase()) ||
157+
ele.children?.length
158+
) {
159+
return true
160+
}
161+
return false
162+
})
163+
}
151164
165+
watch(search, () => {
166+
organizationUserList.value = dfsTree(cloneDeep(rawTree))
152167
nextTick(() => {
153168
organizationUserRef.value.setCheckedKeys(checkTableList.value.map((ele: any) => ele.id))
154169
})
@@ -164,23 +179,16 @@ function isLeafNode(node: any) {
164179
}
165180
166181
const handleCheck = () => {
167-
const userList = organizationUserRef.value.getCheckedNodes()
182+
const userList = [...organizationUserRef.value.getCheckedNodes(), ...checkTableList.value]
168183
let idArr = [...new Set(userList.map((ele: any) => ele.id))]
169184
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-
})
178-
.map((ele: any) => ({
179-
name: ele.name,
180-
id: ele.id,
181-
account: ele.id,
182-
email: ele.options.email,
183-
}))
185+
checkTableList.value = userList.filter((ele: any) => {
186+
if (idArr.includes(ele.id) && isLeafNode(ele)) {
187+
idArr = idArr.filter((itx: any) => itx !== ele.id)
188+
return true
189+
}
190+
return false
191+
})
184192
}
185193
186194
const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
@@ -210,6 +218,7 @@ const open = async (id: any, title: any) => {
210218
const loadingInstance = ElLoading.service({ fullscreen: true })
211219
const systemWorkspaceList = await modelApi.platform(id)
212220
organizationUserList.value = systemWorkspaceList.tree || []
221+
rawTree = cloneDeep(systemWorkspaceList.tree)
213222
loadingInstance?.close()
214223
loading.value = false
215224
centerDialogVisible.value = true
@@ -221,7 +230,7 @@ const handleConfirm = () => {
221230
user_list: checkTableList.value.map((ele: any) => ({
222231
id: ele.id,
223232
name: ele.name,
224-
email: ele.email || '',
233+
email: ele.options.email || '',
225234
})),
226235
origin: oid,
227236
cover: existingUser.value,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</el-button>
2626

2727
<el-tooltip
28-
v-if="!platformType.length"
28+
v-if="platformType.length"
2929
effect="dark"
3030
:content="$t('sync.integration')"
3131
placement="left"

0 commit comments

Comments
 (0)