对接条款对比 导出

This commit is contained in:
范强强
2024-03-06 11:31:33 +08:00
parent 1872f7383e
commit 7b2fd9e157
@@ -36,6 +36,7 @@ import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import JTable from '../../../components/jero/JTable.vue' import JTable from '../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../mixins/JeroListMixin.js' import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
import viewDifferenceModal from './modules/viewDifferenceModal' import viewDifferenceModal from './modules/viewDifferenceModal'
import { downFile } from '../../../api/manage'
export default { export default {
name: 'comparisonTermsView', name: 'comparisonTermsView',
mixins: [JeroListMixin], mixins: [JeroListMixin],
@@ -125,6 +126,44 @@ export default {
}, },
handleExportXls () { handleExportXls () {
const fileName = '条款比对信息'
const fileSuffix = '.xlsx'
const param = {}
param.standHisId = this.standHisId
param.exportName = fileName + fileSuffix
// 加一个大的提示
const modalLoading = this.$info({
title: this.$t('tips'),
content: <span>{this.$t('exportTip')}
<a-spin size="small" /></span>,
keyboard: false
})
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
downFile('/compare/sarItemsCompareHis/exportSarItemsCompareHisXls', param).then((data) => {
if (!data) {
this.$message.warning(this.$t('fileDownloadFail'))
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + fileSuffix)
} else {
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 + fileSuffix)
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 销毁这个提示
modalLoading.destroy()
})
} }
} }
} }