Selaa lähdekoodia

汇总工程量清单、汇总章级数据,兼容多期汇总表

MaiXinRong 5 vuotta sitten
vanhempi
commit
540d3e18fb
1 muutettua tiedostoa jossa 23 lisäystä ja 0 poistoa
  1. 23 0
      app/lib/rpt_data_analysis.js

+ 23 - 0
app/lib/rpt_data_analysis.js

@@ -168,6 +168,13 @@ const gatherGcl = {
             }
         }
     },
+    _loadStageSumInfo: function (gcl, data) {
+        for (const prop in data) {
+            if (/^s_[0-9]+_order$/.test(prop)) {
+                gcl[prop] = data[prop];
+            }
+        }
+    },
     _gatherFields: function(gcl, data, fields) {
         for (const f of fields) {
             if (data[f]) {
@@ -189,6 +196,7 @@ const gatherGcl = {
         const gatherOther = fields.indexOf('chapter') >= 0;
         const gclBills = [], other = {name: '未计入清单章节项', chapter: '10000'};
         if (tableName.indexOf('mem_gather_') >= 0) this._loadGatherInfo(other, gatherData[0]);
+        if (tableName.indexOf('mem_stage_sum_') >= 0) this._loadStageSumInfo(other, gatherData[0]);
 
         for (const b of gatherData) {
             const child = ctx.helper._.find(gatherData, {ledger_pid: b.ledger_id});
@@ -207,6 +215,7 @@ const gatherGcl = {
                         deal_bills_qty: b.deal_bills_qty, deal_bills_tp: b.deal_bills_tp,
                     };
                     if (tableName.indexOf('mem_gather_') >= 0) this._loadGatherInfo(gcl, b);
+                    if (tableName.indexOf('mem_stage_sum_') >= 0) this._loadStageSumInfo(gcl, b);
                     gclBills.push(gcl);
                 }
                 this._gatherCalcField(ctx, gcl, b);
@@ -394,6 +403,15 @@ const gatherChapter = {
             }
         }
     },
+    _completeStageSumInfo: function (chapters, source) {
+        for (const f in source) {
+            if (/^s_[0-9]*_order$/.test(f)) {
+                for (const chapter of chapters) {
+                    chapter[f] = source[f];
+                }
+            }
+        }
+    },
     _getGclChapter: function (chapter, data, field) {
         for (const c of chapter) {
             if (c.filter) {
@@ -518,6 +536,11 @@ const gatherChapter = {
             this._completeGatherInfo(otherChapter, sourceData[0]);
             this._completeGatherInfo(customChapter, sourceData[0]);
         }
+        if (fieldsKey[0].table.indexOf('mem_stage_sum_') >= 0) {
+            this._completeStageSumInfo(gclChapter, sourceData[0]);
+            this._completeStageSumInfo(otherChapter, sourceData[0]);
+            this._completeStageSumInfo(customChapter, sourceData[0]);
+        }
         const filter = [];
         for (const d of sourceData) {
             for (const c of customChapter) {