Browse Source

多期比较,合计计算相关

MaiXinRong 8 months ago
parent
commit
c135b6d537
4 changed files with 31 additions and 2 deletions
  1. 20 0
      app/lib/rm/budget.js
  2. 2 2
      app/lib/ybp_tree.js
  3. 1 0
      app/public/js/measure_compare.js
  4. 8 0
      app/public/js/path_tree.js

+ 20 - 0
app/lib/rm/budget.js

@@ -33,6 +33,18 @@ class rptMemPaymentSafe extends RptMemBase {
             this.ctx.subProject = await this.ctx.service.subProject.getDataByCondition({ budget_id: id });
             this.ctx.subProject.info = await this.ctx.service.subProjInfo.getInfo4Report(this.ctx.subProject.id);
         }
+        if (budget.final_id) {
+            const finalInfo = await this.ctx.service.budgetFinalList.getDataById(budget.final_id);
+            this.ctx.budget.final_uid = finalInfo.uid;
+            this.ctx.budget.final_u_name = finalInfo.u_name;
+            this.ctx.budget.final_u_role = finalInfo.u_role;
+            this.ctx.budget.final_u_company = finalInfo.u_company;
+            this.ctx.budget.final_u_mobile = finalInfo.u_mobile;
+            this.ctx.budget.final_u_login = finalInfo.u_login;
+            this.ctx.budget.final_create_time = finalInfo.create_time;
+            this.ctx.budget.final_update_time = finalInfo.update_time;
+            this.ctx.budget.final_tender_info = finalInfo.tender_info ? JSON.parse(finalInfo.tender_info) : [];
+        }
     }
 
     async doBeforeLoadReport(params) {
@@ -72,6 +84,12 @@ class rptMemPaymentSafe extends RptMemBase {
         // return showLevel ? tree.getDefaultDatasByLevel(this.ctx.tender.rpt_show_level) : tree.getDefaultDatas();
         return tree.getDefaultDatas();
     }
+    async budgetFinalInfo(bid) {
+        const budget = this.ctx.budget && this.ctx.budget.id === bid
+            ? this.ctx.budget
+            : await this.ctx.service.budget.getDataById(bid);
+        return [finalInfo];
+    }
     async budgetFinal(bid, showLevel = false) {
         const budget = this.ctx.budget && this.ctx.budget.id === bid
             ? this.ctx.budget
@@ -90,6 +108,8 @@ class rptMemPaymentSafe extends RptMemBase {
                 return [this.ctx.subProject.info];
             case 'mem_qty_info':
                 return [...this.ctx.subProject.info.main_quantity, ...this.ctx.subProject.info.gcl_quantity];
+            case 'budget':
+                return [this.ctx.budget];
             case 'mem_budget_gu':
                 return this.budgetGu(this.ctx.budget.id);
             case 'mem_budget_gai':

+ 2 - 2
app/lib/ybp_tree.js

@@ -7,9 +7,9 @@ const YbpNodeKind = {
     bx: 5, // 补项
     cs: 6, // 分类
     dt: 7, // 费用明细
-    xmj: 8,
+    xmj: 8, // 项目节
 };
-const defaultMerge = [ YbpNodeKind.dxfy, YbpNodeKind.fb, YbpNodeKind.cs, YbpNodeKind.xmj ];
+const defaultMerge = [ YbpNodeKind.dxfy, YbpNodeKind.fb, YbpNodeKind.cs, YbpNodeKind.dt, YbpNodeKind.xmj ];
 const YbpImportType = { flow: 0, merge: 1 };
 
 class YbpTree {

+ 1 - 0
app/public/js/measure_compare.js

@@ -431,6 +431,7 @@ $(document).ready(() => {
         }
         if (loadData.length > 0) {
             postData(window.location.pathname + '/load', {stages: loadData}, function (result) {
+                cTree.clearSumData();
                 for (const aData of result.stages) {
                     calculateStageLedgerData(aData.bills);
                     cTree.loadMinorData(aData.bills, aData.order + '', ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp'], ['contract_tp', 'qc_tp', 'gather_tp']);

+ 8 - 0
app/public/js/path_tree.js

@@ -1644,6 +1644,14 @@ const createNewPathTree = function (type, setting) {
             }
             return loadedData;
         }
+
+        clearSumData() {
+            this.datas.forEach(d => {
+                for (const prop in d) {
+                    if (prop.indexOf('sum_') === 0) delete d[prop];
+                }
+            });
+        }
     }
 
     class FilterTree extends BaseTree {