downloadFiles () {
this.$message.info('文件正在下载,请耐心等待')
const params = {
year: this.queryParam.year ? this.queryParam.year : '',
month: this.queryParam.month ? this.queryParam.month : '',
week: this.queryParam.week ? this.queryParam.week : ''
}
this.axios.get('/spang-safety/sa/download', { params: params, responseType: 'blob' }).then(res => {
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' })
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
document.body.appendChild(a)
a.href = url
a.download = '效果分析'
a.click()
window.URL.revokeObjectURL(url)
})
}
下载文件出现下载的文件打开后内容为下载路径的txt,download不生效
最新推荐文章于 2024-06-14 15:02:13 发布