From 189b86f5b7a670e9b209ff0487c32c2bc21c661c Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 28 Jan 2026 19:25:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=BF=E6=8D=A2=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=E4=B8=BA=20useBlo?= =?UTF-8?q?bExport=20=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 commonDownloadExcel 替换为 useBlobExport 钩子以统一导出逻辑, 并添加导出时的加载状态控制,提升用户体验。 --- apps/web-antd/src/views/system/role/index.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/views/system/role/index.vue b/apps/web-antd/src/views/system/role/index.vue index a2865560..56487678 100644 --- a/apps/web-antd/src/views/system/role/index.vue +++ b/apps/web-antd/src/views/system/role/index.vue @@ -26,7 +26,7 @@ import { roleRemove, } from '#/api/system/role'; import { ApiSwitch } from '#/components/global'; -import { commonDownloadExcel } from '#/utils/file/download'; +import { useBlobExport } from '#/utils/file/export'; import { columns, querySchema } from './data'; import roleAuthModal from './role-auth-modal.vue'; @@ -119,10 +119,14 @@ function handleMultiDelete() { }); } -function handleDownloadExcel() { - commonDownloadExcel(roleExport, '角色数据', tableApi.formApi.form.values, { - fieldMappingTime: formOptions.fieldMappingTime, - }); +const { exportBlob, exportLoading, buildExportFileName } = + useBlobExport(roleExport); +async function handleExport() { + // 构建表单请求参数 + const formValues = await tableApi.formApi.getValues(); + // 文件名 + const fileName = buildExportFileName('角色数据'); + exportBlob({ data: formValues, fileName }); } const { hasAccessByCodes, hasAccessByRoles } = useAccess(); @@ -158,7 +162,9 @@ async function handleChangeStatus(checked: boolean, row: Role) { {{ $t('pages.common.export') }}