Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

laiguoran 3 years ago
parent
commit
e6b91b895b
3 changed files with 24 additions and 6 deletions
  1. 20 4
      app/public/js/sr_detail.js
  2. 3 1
      app/service/stage_rela.js
  3. 1 1
      app/view/stage_rela/detail.ejs

+ 20 - 4
app/public/js/sr_detail.js

@@ -1136,7 +1136,7 @@ $(document).ready(() => {
     // 批量下载
     $('#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'
@@ -1149,9 +1149,25 @@ $(document).ready(() => {
         });
 
         if (fileIds.length) {
-            const url = `/tender/${relaTender.id}/measure/stage/${relaStage.order}/download/compresse-file?fileIds=${JSON.stringify(fileIds)}`;
-            $('#zipDown').attr('href', url);
-            $("#zipDown")[0].click();
+            if (fileIds.length > 10) {
+              return toastr.warning(`最大允许10个文件(当前${fileIds.length}个)`)
+            }
+            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('批量下载失败')
+            });
         }
     });
 

+ 3 - 1
app/service/stage_rela.js

@@ -49,8 +49,10 @@ class srCache {
                 l.contract_tp = this.ctx.helper.mul(l.unit_price, l.contract_qty, decimal.tp);
                 l.qc_tp = this.ctx.helper.mul(l.unit_price, l.qc_qty, decimal.tp);
             }
+            l.gather_qty = this.ctx.helper.add(l.contract_qty, l.qc_qty);
             l.gather_tp = this.ctx.helper.add(l.contract_tp, l.qc_tp);
-            l.pre_gather_tp = this.ctx.helper.add(l.pre_contract_qty, l.pre_contract_tp);
+            l.pre_gather_qty = this.ctx.helper.add(l.pre_contract_qty, l.pre_contract_qty);
+            l.pre_gather_tp = this.ctx.helper.add(l.pre_contract_tp, l.pre_contract_tp);
             l.end_contract_qty = this.ctx.helper.add(l.pre_contract_qty, l.contract_qty);
             l.end_contract_tp = this.ctx.helper.add(l.pre_contract_tp, l.contract_tp);
             l.end_qc_qty = this.ctx.helper.add(l.pre_qc_qty, l.qc_qty);

+ 1 - 1
app/view/stage_rela/detail.ejs

@@ -247,7 +247,7 @@
                                     <a class="nav-link" data-toggle="tab" href="#syfujian" role="tab" fujian-content="syfujian">所有附件</a>
                                 </li>
                                 <li class="nav-item ml-auto pt-1">
-                                    <a href="javascript:void(0);" id="bach-download" class="btn btn-sm btn-primary" type="curr">批量下载</a>
+                                    <button id="bach-download" class="btn btn-sm btn-primary" type="curr">批量下载</button>
                                     <!--所有附件 翻页-->
                                     <span id="showPage" style="display: none"><a href="javascript:void(0);" class="page-select ml-3" content="pre"><i class="fa fa-chevron-left"></i></a> <span id="currentPage">1</span>/<span id="totalPage">10</span> <a href="javascript:void(0);" class="page-select mr-3" content="next"><i class="fa fa-chevron-right"></i></a></span>
                                 </li>