|
@@ -563,18 +563,26 @@ export default {
|
|
|
responseType: 'blob' // 表明返回服务器返回的数据类型
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- const content = res
|
|
|
- const blob = new Blob([content])
|
|
|
- if ('download' in document.createElement('a')) { // 非IE下载
|
|
|
- const elink = document.createElement('a')
|
|
|
- elink.download = '导出信息.xls'
|
|
|
- elink.style.display = 'none'
|
|
|
- elink.href = URL.createObjectURL(blob)
|
|
|
- document.body.appendChild(elink)
|
|
|
- elink.click()
|
|
|
- URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
- document.body.removeChild(elink)
|
|
|
- }
|
|
|
+ const aLink = document.createElement('a')
|
|
|
+ const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
|
|
|
+ aLink.href = URL.createObjectURL(blob)
|
|
|
+ aLink.download = '导出信息.xlsx'
|
|
|
+ // aLink.style.display = 'none'
|
|
|
+ aLink.click()
|
|
|
+ document.body.appendChild(aLink)
|
|
|
+ // document.body.removeChild(aLink)
|
|
|
+
|
|
|
+ // const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
|
|
+ // if ('download' in document.createElement('a')) { // 非IE下载
|
|
|
+ // const elink = document.createElement('a')
|
|
|
+ // elink.download = '导出信息.xls'
|
|
|
+ // elink.style.display = 'none'
|
|
|
+ // elink.href = URL.createObjectURL(blob)
|
|
|
+ // document.body.appendChild(elink)
|
|
|
+ // elink.click()
|
|
|
+ // URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
+ // document.body.removeChild(elink)
|
|
|
+ // }
|
|
|
})
|
|
|
// if (this.startId === '') {
|
|
|
// this.$message({ message: '提示,👈请选择目录', type: 'success', duration: 1000, offset: 150 })
|