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,