From 60e1c628bb3a157599ef95d384bc1fcb57342834 Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Tue, 19 May 2026 08:52:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8C=E6=AD=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/lb-user.js | 8 +++++ src/views/lb-business/user-manage/index.vue | 39 +++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/api/lb-user.js b/src/api/lb-user.js index 568b211..a09634a 100644 --- a/src/api/lb-user.js +++ b/src/api/lb-user.js @@ -37,3 +37,11 @@ export function deleteLbUser(id) { method: 'delete' }) } + +export function syncLbUserFromHxr(params) { + return request({ + url: '/lbUser/sync-from-hxr', + method: 'post', + params + }) +} diff --git a/src/views/lb-business/user-manage/index.vue b/src/views/lb-business/user-manage/index.vue index 15d0d07..0a2254a 100644 --- a/src/views/lb-business/user-manage/index.vue +++ b/src/views/lb-business/user-manage/index.vue @@ -68,6 +68,15 @@ 新增 + + 同步用户 + @@ -84,6 +93,7 @@ + @@ -372,8 +382,10 @@ import { addLbUser, deleteLbUser, getLbUserList, + syncLbUserFromHxr, updateLbUser } from '@/api/lb-user' +import { getBusinessHeaders } from '@/utils/business-headers' function emptyForm() { return { @@ -448,6 +460,7 @@ export default { return { loading: false, submitLoading: false, + syncLoading: false, list: [], total: 0, dialogVisible: false, @@ -602,6 +615,32 @@ export default { pname: row.pname || '' } }, + getTenantIdFromBusinessHeaders() { + const headers = getBusinessHeaders() + const value = headers && headers['X-Tenant-Id'] + return value ? String(value).trim() : '' + }, + handleSyncFromHxr() { + const tenantId = this.getTenantIdFromBusinessHeaders() + if (!tenantId) { + this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户') + return + } + this.syncLoading = true + syncLbUserFromHxr({ tenantId }) + .then((res) => { + const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000) + if (!isSuccess) { + this.$message.error((res && res.message) || '同步用户失败') + return + } + this.$message.success((res && res.message) || '同步用户成功') + this.fetchList() + }) + .finally(() => { + this.syncLoading = false + }) + }, handleAdd() { this.dialogTitle = '新增用户' this.isEdit = false