From c23b9c26e9d5fc79e6809b578eec587015b91496 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 26 Mar 2026 15:21:32 +0800 Subject: [PATCH] =?UTF-8?q?2026-03-26=20=E5=AF=BC=E5=87=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JsonExcel.vue | 369 ++++++++++++++++++ src/main.js | 2 +- src/utils/excel-util.js | 6 + src/views/modules/print/rePrintPoPart.vue | 1 - .../modules/warehouse/labelTransactionLog.vue | 4 + 5 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 src/components/JsonExcel.vue diff --git a/src/components/JsonExcel.vue b/src/components/JsonExcel.vue new file mode 100644 index 0000000..d76864d --- /dev/null +++ b/src/components/JsonExcel.vue @@ -0,0 +1,369 @@ + + + diff --git a/src/main.js b/src/main.js index bd436b4..5a8d8c3 100644 --- a/src/main.js +++ b/src/main.js @@ -11,7 +11,7 @@ import '@/assets/scss/index.scss' import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios import { isAuth } from '@/utils' import cloneDeep from 'lodash/cloneDeep' -import JsonExcel from 'vue-json-excel' +import JsonExcel from '@/components/JsonExcel.vue' import i18n from '@/i18n/i18n' import './utils/directives' import decimalUtil from '@/utils/decimalUtil.js' diff --git a/src/utils/excel-util.js b/src/utils/excel-util.js index b266908..4f86f55 100644 --- a/src/utils/excel-util.js +++ b/src/utils/excel-util.js @@ -116,6 +116,12 @@ let export2Excel = opt => { }); } let rows = !!resp.data.rows?options.rowFetcher(resp).rows:resp.data.page.list; + if (!rows || rows.length === 0) { + Message.warning({ + message: '没有数据可导出' + }); + return; + } var columns = [ [] ]; diff --git a/src/views/modules/print/rePrintPoPart.vue b/src/views/modules/print/rePrintPoPart.vue index 6fe3f75..6f4c123 100644 --- a/src/views/modules/print/rePrintPoPart.vue +++ b/src/views/modules/print/rePrintPoPart.vue @@ -1532,7 +1532,6 @@ export default { this._exportLoadingInstance.close() this._exportLoadingInstance = null } - this.$message.success('导出成功') } }, created() { diff --git a/src/views/modules/warehouse/labelTransactionLog.vue b/src/views/modules/warehouse/labelTransactionLog.vue index 2929fb6..8bcd445 100644 --- a/src/views/modules/warehouse/labelTransactionLog.vue +++ b/src/views/modules/warehouse/labelTransactionLog.vue @@ -483,6 +483,10 @@ export default { // 导出数据 exportData() { + if (this.dataList.length === 0) { + this.$message.warning('没有数据可导出') + return + } // 构造导出参数(与查询一致,但不分页) const exportParams = { buNo: this.searchData.buNo,