Browse Source

计量进度获取截止本期数据调整

ellisran 1 year ago
parent
commit
2d015c6c57
2 changed files with 8 additions and 10 deletions
  1. 2 7
      app/controller/schedule_controller.js
  2. 6 3
      app/public/js/schedule_stage_tp.js

+ 2 - 7
app/controller/schedule_controller.js

@@ -275,15 +275,10 @@ module.exports = app => {
                 tid: ctx.tender.id,
                 order: stageOrder,
             });
-            let preStageData;
+            await ctx.service.stage.loadPreCheckedStage(stageInfo);
             // 当前操作人查看最新数据,其他人查看历史数据
             const curStageData = await ctx.service.stageBills.getLastestStageData2(ctx.tender.id, stageInfo.id);
-            // 查询截止上期数据
-            if (stageInfo.order > 1) {
-                preStageData = await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, stageInfo.order - 1);
-            } else {
-                preStageData = [];
-            }
+            const preStageData = stageInfo.preCheckedStage ? await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, stageInfo.preCheckedStage.order) : [];
             const pcData = await ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: stageInfo.id } });
             this.ctx.helper.assignRelaData(ledgerData, [
                 { data: curStageData, fields: ['contract_qty', 'contract_expr', 'contract_tp', 'qc_qty', 'qc_tp', 'postil'], prefix: '', relaId: 'lid' },

+ 6 - 3
app/public/js/schedule_stage_tp.js

@@ -104,7 +104,10 @@ $(function () {
                 fullPath: 'full_path',
                 calcFields: calcList,
             };
-            baseLedgerTreeSetting.updateFields = ['year_contract_qty', 'year_gather_tp', 'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'final_contract_tp', 'final_qc_tp', 'final_pc_tp', 'postil', 'used', 'contract_expr'];
+            baseLedgerTreeSetting.updateFields = ['year_contract_qty', 'year_gather_tp', 'contract_qty', 'end_gather_qty',
+                'contract_tp', 'gather_tp', 'qc_qty', 'contract_pc_tp', 'qc_pc_tp', 'qc_tp', 'pc_tp', 'final_contract_tp',
+                'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp',
+                'final_qc_tp', 'final_pc_tp', 'postil', 'used', 'contract_expr'];
             baseLedgerTreeSetting.calcFun = function (node) {
                 if (!node.children || node.children.length === 0) {
                     node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
@@ -115,8 +118,8 @@ $(function () {
                 }
                 node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
                 node.gather_tp = ZhCalc.sum([node.contract_tp, node.qc_tp, node.pc_tp]);
-                node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
-                node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
+                node.end_contract_tp = ZhCalc.sum([node.pre_contract_tp, node.contract_tp, node.contract_pc_tp]);
+                node.end_qc_tp = ZhCalc.sum([node.pre_qc_tp, node.qc_tp, node.qc_pc_tp]);
                 node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
                 node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
                 if (!node.children || node.children.length === 0) {