|
@@ -83,6 +83,8 @@ function getAllList(currPageNum = 1) {
|
|
|
$('#currentPage').text(total === 0 ? 0 : currPageNum);
|
|
|
// 当前页附件内容
|
|
|
const currPageAttData = attData.slice((currPageNum-1)*pageCount, currPageNum*pageCount);
|
|
|
+ currPageFileData = currPageAttData;
|
|
|
+ console.log(currPageFileData);
|
|
|
let html = '';
|
|
|
for(const att of currPageAttData) {
|
|
|
html += `<tr>
|
|
@@ -142,7 +144,7 @@ function getHintMsg () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+let currPageFileData = [];
|
|
|
$(document).ready(() => {
|
|
|
let detail, searchLedger;
|
|
|
// 界面布局
|
|
@@ -1221,20 +1223,38 @@ $(document).ready(() => {
|
|
|
}
|
|
|
toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
|
|
|
$(this).attr('disabled', "true")
|
|
|
- const btn = $(this)
|
|
|
- postCompressFile(`/tender/${relaTender.id}/measure/stage/${relaStage.order}/download/compresse-file`, {fileIds}, function(result) {
|
|
|
- toastr.clear()
|
|
|
- toastr.success('压缩文件成功')
|
|
|
- btn.removeAttr('disabled')
|
|
|
- const href = window.URL.createObjectURL(result)
|
|
|
- $('#zipDown').attr('href', href);
|
|
|
- $('#zipDown').attr('download', `${relaTender.name}-计量台账-第${relaStage.order}期-附件.zip`);
|
|
|
- $("#zipDown")[0].click();
|
|
|
- }, () => {
|
|
|
- btn.removeAttr('disabled')
|
|
|
- toastr.clear()
|
|
|
- toastr.error('批量下载失败')
|
|
|
- });
|
|
|
+ const btn = $(this);
|
|
|
+
|
|
|
+ const fileArr = [];
|
|
|
+ for (const id of fileIds) {
|
|
|
+ const fileInfo = _.find(currPageFileData, { id: parseInt(id) });
|
|
|
+ fileArr.push({
|
|
|
+ url: fileInfo.orginpath, //文件的oss存储路径 (必填)
|
|
|
+ name: fileInfo.filename, // 文件名 (可选, 不需要填扩展名)
|
|
|
+ foldPath: '' // (可选, 文件在压缩包中的存储路径)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const packageName = `${relaTender.name}-计量台账-第${relaStage.order}期-附件.zip`;
|
|
|
+ try {
|
|
|
+ zipOss.downloadFromAliOss(fileArr, packageName, btn);
|
|
|
+ } catch (e) {
|
|
|
+ btn.removeAttr('disabled');
|
|
|
+ toastr.clear();
|
|
|
+ toastr.error('批量下载失败');
|
|
|
+ }
|
|
|
+ // postCompressFile(`/tender/${relaTender.id}/measure/stage/${relaStage.order}/download/compresse-file`, {fileIds}, function(result) {
|
|
|
+ // toastr.clear()
|
|
|
+ // toastr.success('压缩文件成功')
|
|
|
+ // btn.removeAttr('disabled')
|
|
|
+ // const href = window.URL.createObjectURL(result)
|
|
|
+ // $('#zipDown').attr('href', href);
|
|
|
+ // $('#zipDown').attr('download', `${relaTender.name}-计量台账-第${relaStage.order}期-附件.zip`);
|
|
|
+ // $("#zipDown")[0].click();
|
|
|
+ // }, () => {
|
|
|
+ // btn.removeAttr('disabled')
|
|
|
+ // toastr.clear()
|
|
|
+ // toastr.error('批量下载失败')
|
|
|
+ // });
|
|
|
}
|
|
|
});
|
|
|
|