Browse Source

导出捕获异常

master
gjh 2 months ago
parent
commit
ce64d94206
  1. 7
      src/api/common/api.ts
  2. 5
      src/views/projectBoard/unfinishNode/index.vue

7
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) =>{

5
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;

Loading…
Cancel
Save