Преглед изворни кода

关联台账,关联标段,台账金额应按总包单价重算

MaiXinRong пре 3 година
родитељ
комит
a841e0283b
2 измењених фајлова са 14 додато и 1 уклоњено
  1. 2 0
      app/controller/stage_rela_controller.js
  2. 12 1
      app/public/js/sr_detail.js

+ 2 - 0
app/controller/stage_rela_controller.js

@@ -175,6 +175,8 @@ module.exports = app => {
                             break;
                         case 'tag':
                             responseData.data.tags = await ctx.service.ledgerTag.getDatas(relaStage.rela_tid, relaStage.rela_sid);
+                        case 'sumDeal':
+                            responseData.data.sumDeal = await ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: ctx.tender.id } });
                             break;
                     }
                 }

+ 12 - 1
app/public/js/sr_detail.js

@@ -516,7 +516,18 @@ $(document).ready(() => {
     });
 
     // 加载计量单元数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
-    postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;tag' }, function (result) {
+    postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;tag;sumDeal' }, function (result) {
+        for (const l of result.ledgerData) {
+            const sd = result.sumDeal.find(x => { return x.code === l.b_code && x.name === l.name && x.unit === l.unit; });
+            if (sd) {
+                l.unit_price = sd.unit_price;
+                l.deal_tp = ZhCalc.mul(l.unit_price, l.deal_qty);
+                l.sgfh_tp = ZhCalc.mul(l.unit_price, l.sgfh_qty);
+                l.sjcl_tp = ZhCalc.mul(l.unit_price, l.sjcl_qty);
+                l.qtcl_tp = ZhCalc.mul(l.unit_price, l.qtcl_qty);
+                l.total_price = ZhCalc.mul(l.unit_price, l.quantity);
+            }
+        }
         // 加载树结构
         stageTree.loadDatas(result.ledgerData);
         treeCalc.calculateAll(stageTree);