fix: 【数据导出中心】文件下载体验优化

This commit is contained in:
taojinlong 2024-10-21 17:43:52 +08:00
parent 6ec5831f24
commit a92276fb2d

View File

@ -242,39 +242,12 @@ const callbackExportSuc = () => {
const downLoadAll = () => { const downLoadAll = () => {
if (multipleSelection.value.length === 0) { if (multipleSelection.value.length === 0) {
tableData.value.forEach(item => { tableData.value.forEach(item => {
downloadFile(item.id) window.open(PATH_URL + '/exportCenter/download/' + item.id)
.then(res => {
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const link = document.createElement('a')
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
link.download = item.fileName //
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
URL.revokeObjectURL(link.href)
})
.finally(() => {
exportDatasetLoading.value = false
})
}) })
return return
} }
multipleSelection.value.map(ele => { multipleSelection.value.map(ele => {
downloadFile(ele.id) window.open(PATH_URL + '/exportCenter/download/' + ele.id)
.then(res => {
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const link = document.createElement('a')
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
link.download = ele.fileName //
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
.finally(() => {
exportDatasetLoading.value = false
})
}) })
} }
const showMsg = item => { const showMsg = item => {
@ -290,7 +263,7 @@ const timestampFormatDate = value => {
} }
import { PATH_URL } from '@/config/axios/service' import { PATH_URL } from '@/config/axios/service'
const downloadClick = item => { const downloadClick = item => {
window.open(PATH_URL + '/exportCenter/download/' + item.id, '_blank') window.open(PATH_URL + '/exportCenter/download/' + item.id)
} }
const retry = item => { const retry = item => {