From bfff16cd6b909fb6850cee032542320c9a67ed4a Mon Sep 17 00:00:00 2001 From: zzy Date: Sat, 25 Apr 2026 16:27:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login/index.ts | 19 ++ src/layout/components/TenantSwitchButton.vue | 102 +++++++++ src/layout/components/TenantSwitchDialog.vue | 200 ++++++++++++++++++ src/layout/components/ToolHeader.vue | 73 +++++-- .../components/UserInfo/src/UserInfo.vue | 19 -- src/views/Login/Login.vue | 171 ++------------- src/views/community/house/HouseForm.vue | 36 +++- src/views/community/house/index.vue | 12 +- 8 files changed, 434 insertions(+), 198 deletions(-) create mode 100644 src/layout/components/TenantSwitchButton.vue create mode 100644 src/layout/components/TenantSwitchDialog.vue diff --git a/src/api/login/index.ts b/src/api/login/index.ts index dfbb76f..8c0ba35 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -115,3 +115,22 @@ export const getUserTenantList = (data: UserTenantListVO) => { data }) } + +// 切换租户并重新登录 +export interface SwitchTenantVO { + tenantId: number +} + +export const switchTenant = (data: SwitchTenantVO) => { + return request.post({ + url: '/system/auth/switch-tenant', + data + }) +} + +// 获取登录用户的租户列表(已登录状态) +export const getLoggedInUserTenantList = () => { + return request.get({ + url: '/system/auth/get-user-tenant-list' + }) +} diff --git a/src/layout/components/TenantSwitchButton.vue b/src/layout/components/TenantSwitchButton.vue new file mode 100644 index 0000000..0ddffe4 --- /dev/null +++ b/src/layout/components/TenantSwitchButton.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/layout/components/TenantSwitchDialog.vue b/src/layout/components/TenantSwitchDialog.vue new file mode 100644 index 0000000..01dd873 --- /dev/null +++ b/src/layout/components/TenantSwitchDialog.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/src/layout/components/ToolHeader.vue b/src/layout/components/ToolHeader.vue index 48cdc20..552093e 100644 --- a/src/layout/components/ToolHeader.vue +++ b/src/layout/components/ToolHeader.vue @@ -1,5 +1,5 @@ diff --git a/src/views/community/house/HouseForm.vue b/src/views/community/house/HouseForm.vue index a4e2a6c..e06ed38 100644 --- a/src/views/community/house/HouseForm.vue +++ b/src/views/community/house/HouseForm.vue @@ -29,14 +29,28 @@ - + + + - + + + @@ -125,7 +139,15 @@ const open = async (type: string, id?: number) => { if (id) { formLoading.value = true try { - formData.value = await HouseApi.getHouse(id) + const data = await HouseApi.getHouse(id) + // 去除楼号和单元号的后缀 + if (data.buildingNo) { + data.buildingNo = String(data.buildingNo).replace(/号楼$/g, '') + } + if (data.unitNo) { + data.unitNo = String(data.unitNo).replace(/单元$/g, '') + } + formData.value = data } finally { formLoading.value = false } @@ -170,4 +192,12 @@ const resetForm = () => { } formRef.value?.resetFields() } + +/** 处理数字输入 */ +const handleNumberInput = (field: string) => { + if (formData.value[field] === '') { + formData.value[field] = undefined + } +} + diff --git a/src/views/community/house/index.vue b/src/views/community/house/index.vue index 2750893..618079d 100644 --- a/src/views/community/house/index.vue +++ b/src/views/community/house/index.vue @@ -102,8 +102,16 @@ - - + + + + + +