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

报表,1#指标相关问题

MaiXinRong пре 3 година
родитељ
комит
71bb3dadad
2 измењених фајлова са 9 додато и 4 уклоњено
  1. 1 1
      app/lib/ledger.js
  2. 8 3
      app/service/report_memory.js

+ 1 - 1
app/lib/ledger.js

@@ -270,7 +270,7 @@ class baseTree {
         if (fun) {
             fun(node);
         } else if (this.setting.calc) {
-            this.setting.calc(node, this.ctx.helper);
+            this.setting.calc(node, this.ctx.helper, this.ctx.tender.info.decimal);
         }
     }
     calculateAll(fun) {

+ 8 - 3
app/service/report_memory.js

@@ -410,7 +410,9 @@ module.exports = app => {
                 ]);
                 if (this._checkFieldsExist(fields, billsFields.final1)) {
                     const preMinusChange = await this.ctx.service.stageChangeFinal.getPreMinusChange(this.ctx.stage.tid, this.ctx.stage.order);
-                    const changeData = await this._getStageChangeData(this.ctx);
+                    const changeData = this.ctx.stage.readOnly
+                        ? await this.ctx.service.stageChange.getAuditorAllStageData(this.ctx.tender.id, this.ctx.stage.id, this.ctx.stage.curTimes, this.ctx.stage.curOrder)
+                        : await this.ctx.service.stageChange.getLastestAllStageData(this.ctx.tender.id, this.ctx.stage.id);
                     const minusChange = changeData.filter(x => { return x.minus });
                     this.ctx.helper.assignSumRelaData(billsData, 'id', [
                         {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'lid'},
@@ -432,7 +434,8 @@ module.exports = app => {
 
                 return billsTree.getDefaultDatas();
             } catch(err) {
-                return []
+                this.ctx.log(err);
+                return [];
             }
         }
 
@@ -485,7 +488,9 @@ module.exports = app => {
                 ]);
                 if (this._checkFieldsExist(fields, posFields.final1)) {
                     const preMinusChange = await this.ctx.service.stageChangeFinal.getPreMinusChange(this.ctx.stage.tid, this.ctx.stage.order);
-                    const changeData = await this._getStageChangeData(this.ctx);
+                    const changeData = this.ctx.stage.readOnly
+                        ? await this.ctx.service.stageChange.getAuditorAllStageData(this.ctx.tender.id, this.ctx.stage.id, this.ctx.stage.curTimes, this.ctx.stage.curOrder)
+                        : await this.ctx.service.stageChange.getLastestAllStageData(this.ctx.tender.id, this.ctx.stage.id);
                     const minusChange = changeData.filter(x => { return x.minus });
                     this.ctx.helper.assignSumRelaData(posData, 'id', [
                         {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'pid'},