[update] 修改企标导出

This commit is contained in:
lideqin
2023-09-22 16:38:11 +08:00
parent 3ce9dd9596
commit 94aa2e61fb
@@ -170,7 +170,6 @@ import UserSelectModal from '../../../components/selection/UserSelectModal'
// 配置标准弹框
import AllocationStandardDrawer from './modules/AllocationStandardDrawer'
import { postDownFile } from '@/api/manage'
import Vue from 'vue'
export default {
name: 'EnterpriseStandardList',
@@ -336,18 +335,18 @@ export default {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
postDownFile(this.url.exportXlsUrl, param).then((data) => {
if (!data || data.size === 0) {
Vue.prototype.$message.warning('文件下载失败')
if (!data) {
this.$message.warning('文件下载失败')
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data]), fileName + '.zip')
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
} else {
const url = window.URL.createObjectURL(new Blob([data]))
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + '.zip')
link.setAttribute('download', fileName + '.xlsx')
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素