资料下载--批量下载

This commit is contained in:
zhaoxiao
2021-10-08 16:43:49 +08:00
parent 521c2a58a8
commit 1cc0878821
2 changed files with 32 additions and 19 deletions
+13 -8
View File
@@ -112,7 +112,8 @@ export default {
}
],
url: {
list: '/project/payWorkingGroupDistributionRecord/listForFile'
list: '/project/payWorkingGroupDistributionRecord/listForFile',
exportXlsUrl: '/project/payWorkingGroupDistributionRecord/zipFile'
}
}
},
@@ -133,15 +134,19 @@ export default {
this.$message.warn('请至少选择一个文件')
return
}
// 获取文件名称
let fileName = ''
if (!fileName || typeof fileName != 'string') {
fileName = '导出文件'
}
// 获取文件名称
let firstFile = this.dataSource.filter(tt => tt.fileId === this.selectedRowKeys[0])
fileName = `${firstFile[0].fileName}等${this.selectedRowKeys.length}个文件.zip`
let fileIdStr = this.selectedRowKeys.join(',')
batchDownloadFile({ ids: fileIdStr }).then(res => {
// 调用a标签下载文件的方法
downloadFileByA(res, fileName)
})
fileName = `${firstFile[0].fileName}等${this.selectedRowKeys.length}个文件`
let param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['ids'] = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
downloadFile(this.url.exportXlsUrl, fileName + '.zip', param)
}
}
}