From ce64d942065510ce5f20019892a52a2c23ae65c2 Mon Sep 17 00:00:00 2001 From: gjh <1421wake> Date: Mon, 14 Apr 2025 17:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8D=95=E8=8E=B7=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/common/api.ts | 7 ++++++- src/views/projectBoard/unfinishNode/index.vue | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/api/common/api.ts b/src/api/common/api.ts index da434a9..bd30436 100644 --- a/src/api/common/api.ts +++ b/src/api/common/api.ts @@ -15,7 +15,9 @@ import axios from 'axios'; * @returns {*} */ export const downloadFile = (url, fileName?, parameter?) => { + return getFileblob(url, parameter).then((data) => { + if (!data || data.size === 0) { message.warning('文件下载失败'); return; @@ -33,7 +35,10 @@ export const downloadFile = (url, fileName?, parameter?) => { document.body.removeChild(link); //下载完成移除元素 window.URL.revokeObjectURL(url); //释放掉blob对象window.btoa(unescape(encodeURIComponent('我是一段需要处理的字符'))) } - }); + }) + .catch(error=>{ + message.error(error.message) + }) }; export const downloadonlinePreview = async (url, fileName,parameter) =>{ diff --git a/src/views/projectBoard/unfinishNode/index.vue b/src/views/projectBoard/unfinishNode/index.vue index caf41ea..4451e95 100644 --- a/src/views/projectBoard/unfinishNode/index.vue +++ b/src/views/projectBoard/unfinishNode/index.vue @@ -35,6 +35,7 @@ import { onMounted, ref, nextTick, computed } from 'vue'; import { downloadFile } from '@/api/common/api'; import dayjs from 'dayjs'; +import { message } from 'ant-design-vue'; const tableLoading = ref(false); const btnLoading1 = ref(false); const btnLoading2 = ref(false); @@ -109,7 +110,9 @@ btnLoading2.value = true; downloadFile('/export/timeOutInfo', `评分表${nowTime.value}.xlsx`, {}).then((_) => { btnLoading2.value = false; - }); + }).catch(err=>{ + message.error(err.message); + }) } function handleProjectResult() { btnLoading3.value = true;