Ver código fonte

异常拦截

master
suyanyan 1 mês atrás
pai
commit
a498da7206
1 arquivos alterados com 29 adições e 19 exclusões
  1. +29
    -19
      SafeCampus.WEB/src/views/violation/analysis/index.vue

+ 29
- 19
SafeCampus.WEB/src/views/violation/analysis/index.vue Ver arquivo

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


Carregando…
Cancelar
Salvar