提交 3c1fb1a6 authored 作者: CRS's avatar CRS

new

上级 0bc94be1
...@@ -908,13 +908,20 @@ export default { ...@@ -908,13 +908,20 @@ export default {
this.$server.getEvaDownload(val).then(res=>{ this.$server.getEvaDownload(val).then(res=>{
console.log(res) console.log(res)
if (res.status === 200) { if (res.status === 200) {
let name = this.sysName + '系统' + this.type === 2 ? '适配' : '改造' + '报告'; let name = this.type === 2 ? '适配' : '改造' + '报告';
let link = document.createElement('a'); name = this.sysName + '系统' + name
link.setAttribute('download', 'test'); let x = new XMLHttpRequest();
link.href = res.data; x.open('GET', res.data, true);
document.body.appendChild(link); // 添加到页面中,为兼容Firefox浏览器 x.responseType = 'blob';
link.click(); x.onload = (e) =>{
document.body.removeChild(link); // 从页面移除 console.log(e)
let url = window.URL.createObjectURL(x.response)
let a = document.createElement('a');
a.href = url
a.download = name
a.click()
}
x.send();
} }
}) })
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论