From 88d92b7b277bd3326769ddf8ef464d4d3a2a661f Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 4 Feb 2026 10:56:07 +0800 Subject: [PATCH] fix(Third-Party Synchronization): The synchronization failure list cannot be opened normally. --- frontend/src/api/user.ts | 2 +- frontend/src/i18n/zh-CN.json | 2 +- .../src/views/system/user/SyncUserDing.vue | 47 +++++++++++-------- frontend/src/views/system/user/User.vue | 2 +- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/frontend/src/api/user.ts b/frontend/src/api/user.ts index 0cc3239e..013bae32 100644 --- a/frontend/src/api/user.ts +++ b/frontend/src/api/user.ts @@ -21,7 +21,7 @@ export const userApi = { add: (data: any) => request.post('/user', data), edit: (data: any) => request.put('/user', data), clearErrorApi: (key: string) => request.get(`/user/clearErrorRecord/${key}`), - errorRecord: (key: string) => request.get(`/user/errorRecord/${key}`), + errorRecord: (key: string) => request.get(`/user/errorRecord/${key}`, { responseType: 'blob' }), delete: (key: string) => request.delete(`/user/${key}`), deleteBatch: (data: any) => request.delete(`/user`, { data }), get: (key: string) => request.get(`/user/${key}`), diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 919bebd4..6171605c 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -8,7 +8,7 @@ "Details": "详情" }, "sync": { - "integration": "Platform integration needs to be enabled.", + "integration": "需开启平台对接", "the_existing_user": "若用户已存在,覆盖旧用户", "sync_users": "同步用户", "sync_wechat_users": "同步企业微信用户", diff --git a/frontend/src/views/system/user/SyncUserDing.vue b/frontend/src/views/system/user/SyncUserDing.vue index 972bd2fc..11d557b7 100644 --- a/frontend/src/views/system/user/SyncUserDing.vue +++ b/frontend/src/views/system/user/SyncUserDing.vue @@ -121,6 +121,7 @@ import Close from '@/assets/svg/icon_close_outlined_w.svg' import Search from '@/assets/svg/icon_search-outline_outlined.svg' import type { CheckboxValueType } from 'element-plus-secondary' import type { FilterNodeMethodFunction } from 'element-plus-secondary' +import { cloneDeep } from 'lodash-es' const checkAll = ref(false) const existingUser = ref(false) const isIndeterminate = ref(false) @@ -134,7 +135,7 @@ const defaultProps = { children: 'children', label: 'name', } - +let rawTree: any = [] const organizationUserList = ref([]) const loading = ref(false) const centerDialogVisible = ref(false) @@ -146,9 +147,23 @@ const workspaceWithKeywords = computed(() => { ) }) -watch(search, (val) => { - organizationUserRef.value!.filter(val) +const dfsTree = (arr: any) => { + return arr.filter((ele: any) => { + if (ele.children?.length) { + ele.children = dfsTree(ele.children) + } + if ( + (ele.name.toLowerCase() as string).includes(search.value.toLowerCase()) || + ele.children?.length + ) { + return true + } + return false + }) +} +watch(search, () => { + organizationUserList.value = dfsTree(cloneDeep(rawTree)) nextTick(() => { organizationUserRef.value.setCheckedKeys(checkTableList.value.map((ele: any) => ele.id)) }) @@ -164,23 +179,16 @@ function isLeafNode(node: any) { } const handleCheck = () => { - const userList = organizationUserRef.value.getCheckedNodes() + const userList = [...organizationUserRef.value.getCheckedNodes(), ...checkTableList.value] let idArr = [...new Set(userList.map((ele: any) => ele.id))] - checkTableList.value = userList - .filter((ele: any) => { - if (idArr.includes(ele.id) && isLeafNode(ele)) { - idArr = idArr.filter((itx: any) => itx !== ele.id) - return true - } - return false - }) - .map((ele: any) => ({ - name: ele.name, - id: ele.id, - account: ele.id, - email: ele.options.email, - })) + checkTableList.value = userList.filter((ele: any) => { + if (idArr.includes(ele.id) && isLeafNode(ele)) { + idArr = idArr.filter((itx: any) => itx !== ele.id) + return true + } + return false + }) } const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => { @@ -210,6 +218,7 @@ const open = async (id: any, title: any) => { const loadingInstance = ElLoading.service({ fullscreen: true }) const systemWorkspaceList = await modelApi.platform(id) organizationUserList.value = systemWorkspaceList.tree || [] + rawTree = cloneDeep(systemWorkspaceList.tree) loadingInstance?.close() loading.value = false centerDialogVisible.value = true @@ -221,7 +230,7 @@ const handleConfirm = () => { user_list: checkTableList.value.map((ele: any) => ({ id: ele.id, name: ele.name, - email: ele.email || '', + email: ele.options.email || '', })), origin: oid, cover: existingUser.value, diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index 42e44651..53dae8ef 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -25,7 +25,7 @@