From 1ff118c2e0968a827901f519ee060deb629ebd45 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 28 Jan 2026 19:34:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86):=20=E6=9B=BF=E6=8D=A2=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=B8=BA=E5=8F=AF=E5=A4=8D=E7=94=A8=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 useBlobExport 钩子替代 commonDownloadExcel 工具函数,统一导出逻辑 - 增加导出按钮的加载状态和禁用状态,提升用户体验 - 通过钩子自动构建导出文件名,简化调用代码 --- apps/web-antd/src/views/system/client/index.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/views/system/client/index.vue b/apps/web-antd/src/views/system/client/index.vue index 98d8f96e..43176771 100644 --- a/apps/web-antd/src/views/system/client/index.vue +++ b/apps/web-antd/src/views/system/client/index.vue @@ -18,7 +18,7 @@ import { clientRemove, } from '#/api/system/client'; import { ApiSwitch } from '#/components/global'; -import { commonDownloadExcel } from '#/utils/file/download'; +import { useBlobExport } from '#/utils/file/export'; import clientDrawer from './client-drawer.vue'; import { columns, querySchema } from './data'; @@ -104,8 +104,14 @@ function handleMultiDelete() { }); } -function handleDownloadExcel() { - commonDownloadExcel(clientExport, '客户端数据', tableApi.formApi.form.values); +const { exportBlob, exportLoading, buildExportFileName } = + useBlobExport(clientExport); +async function handleExport() { + // 构建表单请求参数 + const formValues = await tableApi.formApi.getValues(); + // 文件名 + const fileName = buildExportFileName('客户端数据'); + exportBlob({ data: formValues, fileName }); } const { hasAccessByCodes } = useAccess(); @@ -124,7 +130,9 @@ async function handleChangeStatus(checked: boolean, row: Client) { {{ $t('pages.common.export') }}