update 国内、海外标准导出
This commit is contained in:
@@ -201,6 +201,7 @@ import { StandardSystemTreeNodeType, YesOrNoEnum } from '../../../enums/commonEn
|
||||
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
|
||||
import DomesticSystemTreeModal from './modules/DomesticSystemTreeModal.vue'
|
||||
import SelectionDomesticStandardDrawer from './modules/SelectionDomesticStandardDrawer.vue'
|
||||
import { postDownFile } from '../../../api/manage.js'
|
||||
|
||||
export default {
|
||||
name: 'DomesticStandardList',
|
||||
@@ -246,8 +247,8 @@ export default {
|
||||
delete: '/laws/standard/domestic/deleteByIdsAndModule',
|
||||
deleteBatch: '/laws/standard/domestic/deleteByIdsAndModule',
|
||||
downTemplateUrl: '', // 下载模板
|
||||
exportXlsUrl: '', // 导出
|
||||
exportZipUrl: '', // 带文件导出
|
||||
exportXlsUrl: '/laws/standard/domestic/exportData', // 导出
|
||||
exportZipUrl: '/laws/standard/domestic/exportDataWithFile', // 带文件导出
|
||||
importExcelUrl: '' // 导入
|
||||
},
|
||||
yesValue: YesOrNoEnum.YES.value,
|
||||
@@ -506,6 +507,92 @@ export default {
|
||||
this.selectedTreeKeys = []
|
||||
this.getTableHeader()
|
||||
this.loadData()
|
||||
},
|
||||
// 导出改成用post
|
||||
handleExportXls (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: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
||||
keyboard: false
|
||||
})
|
||||
// 把知道了这个按钮去掉
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
postDownFile(this.url.exportXlsUrl, param).then((data) => {
|
||||
if (!data || data.size === 0) {
|
||||
this.$message.warning('文件下载失败')
|
||||
return
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data]), fileName + '.xls')
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + '.xls')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
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: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
||||
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('文件下载失败')
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data]), fileName + '.zip')
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + '.zip')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
// }
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
modalLoading.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
|
||||
import OverseasStandardModal from './modules/OverseasStandardModal.vue'
|
||||
import OverseasSystemTreeModal from './modules/OverseasSystemTreeModal.vue'
|
||||
import SelectionOverseasStandardDrawer from './modules/SelectionOverseasStandardDrawer.vue'
|
||||
import { postDownFile } from '../../../api/manage.js'
|
||||
|
||||
export default {
|
||||
name: 'OverseasStandardList',
|
||||
@@ -243,11 +244,11 @@ export default {
|
||||
getQueryConditionFunc: getOverseasStandardSearchForm,
|
||||
url: {
|
||||
list: '/laws/standard/overseas/getCommonPage',
|
||||
delete: '/laws/standard/domestic/deleteByIdsAndModule',
|
||||
deleteBatch: '/laws/standard/domestic/deleteByIdsAndModule',
|
||||
delete: '/laws/standard/overseas/deleteByIdsAndModule',
|
||||
deleteBatch: '/laws/standard/overseas/deleteByIdsAndModule',
|
||||
downTemplateUrl: '', // 下载模板
|
||||
exportXlsUrl: '', // 导出
|
||||
exportZipUrl: '', // 带文件导出
|
||||
exportXlsUrl: '/laws/standard/overseas/exportData', // 导出
|
||||
exportZipUrl: '/laws/standard/overseas/exportDataWithFile', // 带文件导出
|
||||
importExcelUrl: '' // 导入
|
||||
},
|
||||
yesValue: YesOrNoEnum.YES.value,
|
||||
@@ -506,7 +507,93 @@ export default {
|
||||
this.selectedTreeKeys = []
|
||||
this.getTableHeader()
|
||||
this.loadData()
|
||||
}
|
||||
},
|
||||
// 导出改成用post
|
||||
handleExportXls (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: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
||||
keyboard: false
|
||||
})
|
||||
// 把知道了这个按钮去掉
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
postDownFile(this.url.exportXlsUrl, param).then((data) => {
|
||||
if (!data || data.size === 0) {
|
||||
this.$message.warning('文件下载失败')
|
||||
return
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data]), fileName + '.xls')
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + '.xls')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
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: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
||||
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('文件下载失败')
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data]), fileName + '.zip')
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + '.zip')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
// }
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
modalLoading.destroy()
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user