|
@@ -3637,7 +3637,7 @@ $(document).ready(function() {
|
|
|
// 批量下载
|
|
|
$('#bach-download').click(function() {
|
|
|
const fileIds = [];
|
|
|
- const type = $(this).prop('type');
|
|
|
+ const type = $(this).attr('type');
|
|
|
let node = ''
|
|
|
if (type === 'curr') {
|
|
|
node = '#nodelist-table .check-file:checked'
|
|
@@ -3645,15 +3645,27 @@ $(document).ready(function() {
|
|
|
node = '#alllist-table .check-file:checked'
|
|
|
}
|
|
|
$(node).each(function() {
|
|
|
- const fileId = $(this).attr('file-id');
|
|
|
- fileId && fileIds.push(fileId);
|
|
|
+ const fileId = $(this).attr('file-id');
|
|
|
+ fileId && fileIds.push(fileId);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if (fileIds.length) {
|
|
|
- const url = `/tender/${tender.id}/ledger/compresse/file?fileIds=${JSON.stringify(fileIds)}`;
|
|
|
- $('#zipDown').attr('href', url);
|
|
|
- console.log(url);
|
|
|
+ if (fileIds.length > 10) {
|
|
|
+ return toastr.warning(`最大允许10个文件(当前${fileIds.length}个)`)
|
|
|
+ }
|
|
|
+ toastr.success('正在进行压缩文件...')
|
|
|
+ $(this).attr('disabled', "true")
|
|
|
+ const btn = $(this)
|
|
|
+ postCompressFile(`/tender/${tender.id}/ledger/compresse/file`, {fileIds}, function(result) {
|
|
|
+ toastr.success('压缩文件成功,即将开始下载')
|
|
|
+ btn.removeAttr('disabled')
|
|
|
+ const href = window.URL.createObjectURL(result)
|
|
|
+ $('#zipDown').attr('href', href);
|
|
|
+ $('#zipDown').attr('download', `${tender.name}-台账分解-附件.zip`);
|
|
|
$("#zipDown")[0].click();
|
|
|
+ })
|
|
|
+ // const url = `/tender/${tender.id}/ledger/compresse/file?fileIds=${JSON.stringify(fileIds)}`;
|
|
|
+ // console.log(url);
|
|
|
}
|
|
|
});
|
|
|
|