diff --git a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue index 602f0ba0..0331a289 100644 --- a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue +++ b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue @@ -330,6 +330,7 @@ export default { this.getTableHeader() this.loadData() }, + // 导出改成用post handleExportXls (fileName) { if (!fileName || typeof fileName !== 'string') { fileName = '导出文件' @@ -372,6 +373,49 @@ export default { modalLoading.destroy() }) }, + // 带文件导出 + handleFileExport (fileName) { + if (!fileName || typeof fileName !== 'string') { + fileName = '导出文件' + } + const param = this.getQueryParams() + if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { + param.selections = this.selectedRowKeys.join(',') + } + console.log('导出参数', param) + // 加一个大的提示 + const modalLoading = this.$info({ + title: '提示', + content: 正在导出,请稍候 , + keyboard: false + }) + // 把知道了这个按钮去掉 + this.$nextTick(() => { + document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none' + }) + postDownFile(this.url.exportZipUrl, param).then((data) => { + if (!data) { + this.$message.warning('文件下载失败') + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx') + } 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 + '.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) // 下载完成移除元素 + window.URL.revokeObjectURL(url) // 释放掉blob对象 + } + }).finally(() => { + // 销毁这个提示 + modalLoading.destroy() + }) + }, // 配置标准 handleAllocationStandard () { console.log(this.currentTreeNode)