浏览代码

异常拦截

master
suyanyan 1 个月前
父节点
当前提交
a498da7206
共有 1 个文件被更改,包括 29 次插入19 次删除
  1. +29
    -19
      SafeCampus.WEB/src/views/violation/analysis/index.vue

+ 29
- 19
SafeCampus.WEB/src/views/violation/analysis/index.vue 查看文件

@@ -93,25 +93,35 @@ const onTimeSubmit = ()=>{
startTime: timeForm.dateArr[0],
endTime: timeForm.dateArr[1],
}).then((res:any) => {
console.log(res,"....UTF-8''");
const filename:any = ref()
filename.value = window.decodeURI(res.headers["content-disposition"].split("=")[2]);
filename.value = filename.value.slice(7,-1)
let blobUrl = window.URL.createObjectURL(res.data);
const a = document.createElement('a');
a.style.display = 'none';
a.setAttribute("target", "_blank");
a.download = filename.value
a.href = blobUrl;
a.click();
a.remove();
ElMessage({
message: '导出成功',
type: 'success'
});
closeTime();
});
if(res.headers['content-disposition']){
const filename:any = ref()
filename.value = window.decodeURI(res.headers["content-disposition"].split("=")[2]);
filename.value = filename.value.slice(7,-1)
let blobUrl = window.URL.createObjectURL(res.data);
const a = document.createElement('a');
a.style.display = 'none';
a.setAttribute("target", "_blank");
a.download = filename.value
a.href = blobUrl;
a.click();
a.remove();
ElMessage({
message: '导出成功',
type: 'success'
});
closeTime();
}else{
const fileReader:any = new FileReader()
fileReader.readAsText(new Blob([res.data], { type: 'application/octet-stream' }), 'utf-8')
fileReader.onload = () => {
const result = JSON.parse(fileReader.result)
ElMessage({
message: result.msg,
type: 'error'
});
}
}
})
} else {
return false;


正在加载...
取消
保存