From 94541219635aab85cb013e3eec37250bca4efaea Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 28 Jan 2026 19:27:17 +0800 Subject: [PATCH] =?UTF-8?q?refactor(views):=20=E6=9B=BF=E6=8D=A2=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD=E4=B8=BA=20useBlobExport=20?= =?UTF-8?q?=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用新的 useBlobExport 组合式函数替换原有的 commonDownloadExcel 工具函数,以统一导出逻辑并支持加载状态。同时调整按钮状态绑定 exportLoading 并重构参数获取方式。 --- apps/web-antd/src/views/system/post/index.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index bfa7bf3c..da25a4cb 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -17,7 +17,7 @@ import { postList, postRemove, } from '#/api/system/post'; -import { commonDownloadExcel } from '#/utils/file/download'; +import { useBlobExport } from '#/utils/file/export'; import DeptTree from '#/views/system/user/dept-tree.vue'; import { columns, querySchema } from './data'; @@ -118,8 +118,14 @@ function handleMultiDelete() { }); } -function handleDownloadExcel() { - commonDownloadExcel(postExport, '岗位信息', tableApi.formApi.form.values); +const { exportBlob, exportLoading, buildExportFileName } = + useBlobExport(postExport); +async function handleExport() { + // 构建表单请求参数 + const formValues = await tableApi.formApi.getValues(); + // 文件名 + const fileName = buildExportFileName('岗位数据'); + exportBlob({ data: formValues, fileName }); } @@ -137,7 +143,9 @@ function handleDownloadExcel() { {{ $t('pages.common.export') }}