浏览代码

报表,中间计量,计量单元-清单,中间计量清单数据源

MaiXinRong 5 年之前
父节点
当前提交
d13a9f42fe
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      app/lib/stage_im.js

+ 15 - 0
app/lib/stage_im.js

@@ -442,6 +442,9 @@ class StageIm {
 
     _addBwBillsGclBills(im, bills) {
         const helper = this.ctx.helper;
+        if (!im.imBills) im.imBills = [];
+        im.imBills.push(bills);
+
         if (!im.gclBills) im.gclBills = [];
         let gcl = im.gclBills.find(function (x) {
             return (!bills.b_code || bills.b_code === x.b_code) &&
@@ -551,13 +554,25 @@ class StageIm {
         }
         if (imDefault.contract_jl || imDefault.qc_jl) {
             imDefault.jl = this.ctx.helper.add(imDefault.contract_jl, imDefault.qc_jl);
+            imDefault.id = this.ImData.length + 1;
             this.ImData.push(imDefault);
+            for (const b of imDefault.imBills) {
+                b.imid = imDefault.id;
+                this.ImBillsData.push(b);
+            }
+            delete imDefault.imBills;
         }
         for (const im of nodeImData) {
             this._calculateBwBillsIm(im);
             im.drawing_code = this.ctx.helper._.uniq(im.drawing_code).join(mergeChar);
             im.position = this.ctx.helper._.uniq(im.position).join(mergeChar);
+            im.id = this.ImData.length + 1;
             this.ImData.push(im);
+            for (const b of im.imBills) {
+                b.imid = im.id;
+                this.ImBillsData.push(b);
+            }
+            delete im.imBills;
         }
     }