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 @@ - - + + + + + +