用jeecgBoot导出文件时候失败,需要给出提示信息
if(res.type === 'application/json'){
const _this = this;
let reader = new FileReader(); // 创建读取文件对象
reader.readAsText(res, 'utf-8'); // 设置读取的数据以及返回的数据类型为utf-8
reader.addEventListener("loadend", function () { //
let res = JSON.parse(reader.result); // 返回的数据
console.log(res,'返回结果')
_this.$message.error(res.message)
});
}else{
if (typeof window.navigator.msSaveBlob !== 'undefined') {
this.isf1 = false
window.navigator.msSaveBlob(new Blob([res], { type: 'application/vnd.ms-excel' }), '目标医院明细初始化错误信息汇总_'+new Date().getTime() + '.xlsx')
} else {
this.isf1 = false
let url = window.URL.createObjectURL(new Blob([res], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', '目标医院明细初始化错误信息汇总_'+new Date().getTime() + '.xlsx')
document.body.appendChild(link)
link.click()
document.body.removeChild(link); //下载完成移除元素
window.URL.revokeObjectURL(url); //释放掉blob对象
}
this.reload()
}