From 21821c92d9870cf2859daad99a554c904ad2cd72 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 7 Mar 2026 10:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=E6=B8=85=E5=8D=95=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现条码清单的 Excel 导出功能,用户可以通过点击导出按钮下载条码清单。此功能增强了用户体验,方便用户管理和使用条码数据。 --- src/api/mes/wm/barcode/index.ts | 5 +++++ src/views/mes/wm/barcode/index.vue | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/api/mes/wm/barcode/index.ts b/src/api/mes/wm/barcode/index.ts index 5b4133ef6..23b885792 100644 --- a/src/api/mes/wm/barcode/index.ts +++ b/src/api/mes/wm/barcode/index.ts @@ -48,5 +48,10 @@ export const WmBarcodeApi = { // 删除条码 deleteBarcode: async (id: number) => { return await request.delete({ url: '/mes/wm/barcode/delete?id=' + id }) + }, + + // 导出条码 Excel + exportBarcode: async (params: any) => { + return await request.download({ url: '/mes/wm/barcode/export-excel', params }) } } \ No newline at end of file diff --git a/src/views/mes/wm/barcode/index.vue b/src/views/mes/wm/barcode/index.vue index d5fc88c0b..226018cbf 100644 --- a/src/views/mes/wm/barcode/index.vue +++ b/src/views/mes/wm/barcode/index.vue @@ -78,6 +78,15 @@ > 条码设置 + + 导出 + @@ -167,6 +176,7 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { WmBarcodeApi } from '@/api/mes/wm/barcode' import { Barcode, BarcodeDetail } from './components' import BarcodeForm from './BarcodeForm.vue' +import download from '@/utils/download' defineOptions({ name: 'MesWmBarcode' }) @@ -245,6 +255,22 @@ const handleConfig = () => { push({ name: 'MesWmBarcodeConfig' }) } +/** 导出按钮操作 */ +const exportLoading = ref(false) +const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await WmBarcodeApi.exportBarcode(queryParams) + download.excel(data, '条码清单.xls') + } catch { + } finally { + exportLoading.value = false + } +} + onMounted(() => { getList() })