diff --git a/apps/web-antd/src/views/system/tenant/index.vue b/apps/web-antd/src/views/system/tenant/index.vue index 8df85fed..a8db5c56 100644 --- a/apps/web-antd/src/views/system/tenant/index.vue +++ b/apps/web-antd/src/views/system/tenant/index.vue @@ -26,7 +26,7 @@ import { } from '#/api/system/tenant'; import { ApiSwitch } from '#/components/global'; import { useTenantStore } from '#/store/tenant'; -import { commonDownloadExcel } from '#/utils/file/download'; +import { useBlobExport } from '#/utils/file/export'; import { columns, querySchema } from './data'; import tenantDrawer from './tenant-drawer.vue'; @@ -122,8 +122,14 @@ function handleMultiDelete() { }); } -function handleDownloadExcel() { - commonDownloadExcel(tenantExport, '租户数据', tableApi.formApi.form.values); +const { exportBlob, exportLoading, buildExportFileName } = + useBlobExport(tenantExport); +async function handleExport() { + // 构建表单请求参数 + const formValues = await tableApi.formApi.getValues(); + // 文件名 + const fileName = buildExportFileName('租户数据'); + exportBlob({ data: formValues, fileName }); } /** @@ -159,7 +165,6 @@ function handleSyncTenantConfig() { } async function handleChangeStatus(checked: boolean, row: Tenant) { - console.log(checked); await tenantStatusChange({ id: row.id, tenantId: row.tenantId, @@ -208,7 +213,9 @@ const handleMenuClick: DropdownEmits['menuClick'] = (e) => { {{ $t('pages.common.export') }} diff --git a/apps/web-antd/src/views/system/tenantPackage/index.vue b/apps/web-antd/src/views/system/tenantPackage/index.vue index 4a573414..0ac2c3bb 100644 --- a/apps/web-antd/src/views/system/tenantPackage/index.vue +++ b/apps/web-antd/src/views/system/tenantPackage/index.vue @@ -20,7 +20,7 @@ import { packageRemove, } from '#/api/system/tenant-package'; import { ApiSwitch } from '#/components/global'; -import { commonDownloadExcel } from '#/utils/file/download'; +import { useBlobExport } from '#/utils/file/export'; import { columns, querySchema } from './data'; import tenantPackageDrawer from './tenant-package-drawer.vue'; @@ -104,12 +104,14 @@ function handleMultiDelete() { }); } -function handleDownloadExcel() { - commonDownloadExcel( - packageExport, - '租户套餐数据', - tableApi.formApi.form.values, - ); +const { exportBlob, exportLoading, buildExportFileName } = + useBlobExport(packageExport); +async function handleExport() { + // 构建表单请求参数 + const formValues = await tableApi.formApi.getValues(); + // 文件名 + const fileName = buildExportFileName('租户套餐数据'); + exportBlob({ data: formValues, fileName }); } /** @@ -137,7 +139,9 @@ async function handleChangeStatus(checked: boolean, row: TenantPackage) { {{ $t('pages.common.export') }}