[update] 内部工作组导出必选左侧树节点
This commit is contained in:
@@ -155,7 +155,7 @@ import '@assets/less/common.less'
|
||||
import JTable from '@/components/jero/JTable'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import TreeNodeModal from './modules/TreeNodeModal'
|
||||
import { postAction } from '@/api/manage'
|
||||
import { postAction, downFile } from '@/api/manage'
|
||||
import WorkingGroupModal from './modules/WorkingGroupModal'
|
||||
import { getWorkGroupTreeList } from '@/api/api'
|
||||
|
||||
@@ -330,6 +330,7 @@ export default {
|
||||
this.initTreeData()
|
||||
this.loadData(1)
|
||||
},
|
||||
// 导入,必须选中左侧节点
|
||||
handleImport (e) {
|
||||
if (!this.currentTreeNode || this.currentTreeNode.length <= 0) {
|
||||
this.$message.warning(this.$t('system.internalWorkGroup.pleaseSelectASystem'))
|
||||
@@ -337,6 +338,54 @@ export default {
|
||||
} else {
|
||||
this.importData = { workingGroupId: this.currentTreeNode[0] }
|
||||
}
|
||||
},
|
||||
// 导出左侧必选
|
||||
handleExportXls (fileName) {
|
||||
if (!this.currentTreeNode || this.currentTreeNode.length <= 0) {
|
||||
this.$message.warning(this.$t('system.internalWorkGroup.pleaseSelectASystem'))
|
||||
return
|
||||
}
|
||||
if (!fileName || typeof fileName !== 'string') {
|
||||
fileName = '导出文件'
|
||||
}
|
||||
const param = this.getQueryParams()
|
||||
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
||||
param.selections = this.selectedRowKeys.join(',')
|
||||
}
|
||||
param.workingGroupId = this.currentTreeNode[0]
|
||||
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'
|
||||
})
|
||||
downFile(this.url.exportXlsUrl, 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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user