From 2a5c45e15cd812703499621bb78e364474842606 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 16 Jan 2026 14:22:09 +0800 Subject: [PATCH] =?UTF-8?q?refactor(tenant):=20=E6=9B=BF=E6=8D=A2=20TableS?= =?UTF-8?q?witch=20=E4=B8=BA=20ApiSwitch=20=E5=B9=B6=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=87=E6=8D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将租户和租户套餐列表中的 TableSwitch 组件替换为 ApiSwitch,并统一处理状态切换逻辑。使用 EnableStatus 常量来管理状态值,提高代码可维护性。 --- .../web-antd/src/views/system/tenant/index.vue | 18 ++++++++++++++---- .../src/views/system/tenantPackage/index.vue | 14 +++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/apps/web-antd/src/views/system/tenant/index.vue b/apps/web-antd/src/views/system/tenant/index.vue index a9765c5a..360a10a0 100644 --- a/apps/web-antd/src/views/system/tenant/index.vue +++ b/apps/web-antd/src/views/system/tenant/index.vue @@ -8,6 +8,7 @@ import { computed } from 'vue'; import { useAccess } from '@vben/access'; import { Fallback, Page, useVbenDrawer } from '@vben/common-ui'; +import { EnableStatus } from '@vben/constants'; import { Popconfirm, Space } from 'antdv-next'; @@ -21,7 +22,7 @@ import { tenantStatusChange, tenantSyncPackage, } from '#/api/system/tenant'; -import { TableSwitch } from '#/components/table'; +import { ApiSwitch } from '#/components/global'; import { useTenantStore } from '#/store/tenant'; import { commonDownloadExcel } from '#/utils/file/download'; @@ -154,6 +155,15 @@ function handleSyncTenantConfig() { }, }); } + +async function handleChangeStatus(checked: boolean, row: Tenant) { + console.log(checked); + await tenantStatusChange({ + id: row.id, + tenantId: row.tenantId, + status: checked ? EnableStatus.Enable : EnableStatus.Disable, + }); +}