|
@@ -93,25 +93,35 @@ const onTimeSubmit = ()=>{ |
|
|
startTime: timeForm.dateArr[0], |
|
|
startTime: timeForm.dateArr[0], |
|
|
endTime: timeForm.dateArr[1], |
|
|
endTime: timeForm.dateArr[1], |
|
|
}).then((res:any) => { |
|
|
}).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 { |
|
|
} else { |
|
|
return false; |
|
|
return false; |
|
|