Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 2 years ago
parent
commit
12248228f7
2 changed files with 39 additions and 34 deletions
  1. 26 21
      app/lib/rpt_data_analysis.js
  2. 13 13
      app/reports/util/rpt_calculation_data_util.js

+ 26 - 21
app/lib/rpt_data_analysis.js

@@ -370,7 +370,7 @@ const gatherChapter = {
             name: '合计',
             order: 4,
         },
-        filter: [{node_type: standard.nodeType.find(function (x) {return x.text === '计日工'}).value}, {field: 'name', part: '计日工'}],
+        filter: [{ node_type: standard.nodeType.find(function(x) { return x.text === '计日工'; }).value }, { field: 'name', part: '计日工' }],
     },
     customSetting1: {
         count: 7,
@@ -379,11 +379,11 @@ const gatherChapter = {
             order: 1,
         },
         custom: [
-            {name: '已包含在清单合计中的材料、工程设备、专业工程暂估价', order: 2, visible: false},
-            {name: '清单合计减去材料、工程设备、专业工程暂估价(即8-9=10)', order_calc: 'o1-o2', order: 3},
-            {name: '计日工合计', node_type: '计日工', order: 4},
-            {name: '暂列金额(不含计日工总额)(即10×暂列金额比列)', order: 5, match: [{node_type: '暂列金额'}, {field: 'name', part: '暂列金额'}, {field: 'name', all: '暂定金额'}]},
-            {name: '投标报价、台账价(8+11+12)=13', order_calc: 'o1+o4+o5', order: 6},
+            { name: '已包含在清单合计中的材料、工程设备、专业工程暂估价', order: 2, visible: false },
+            { name: '清单合计减去材料、工程设备、专业工程暂估价(即8-9=10)', order_calc: 'o1-o2', order: 3 },
+            { name: '计日工合计', node_type: '计日工', order: 4 },
+            { name: '暂列金额(不含计日工总额)(即10×暂列金额比列)', order: 5, match: [{ node_type: '暂列金额' }, { field: 'name', part: '暂列金额' }, { field: 'name', all: '暂定金额' }] },
+            { name: '投标报价、台账价(8+11+12)=13', order_calc: 'o1+o4+o5', order: 6 },
         ],
         rela: [
             {
@@ -439,7 +439,7 @@ const gatherChapter = {
         }
         if (options.sum) {
             otherChapter.push({
-                name: options.sum.name , cType: 41,
+                name: options.sum.name, cType: 41,
                 serialNo: serialNo + options.sum.order, order: options.sum.order,
                 visible: options.sum.visible,
             });
@@ -457,7 +457,7 @@ const gatherChapter = {
                     cc.match = JSON.parse(JSON.stringify(c.match));
                     for (const m of cc.match) {
                         if (m.node_type && m.node_type !== '') {
-                            const nodeType = standard.nodeType.find(function (x) {return x.text === m.node_type});
+                            const nodeType = standard.nodeType.find(function(x) { return x.text === m.node_type; });
                             m.node_type = nodeType.value;
                         }
                     }
@@ -699,7 +699,7 @@ const join = {
             }
         }
         for (const s of sub) {
-            let subR = result.filter(function(x) {
+            const subR = result.filter(function(x) {
                 for (const k of options.keyFields) {
                     switch (k.type) {
                         case 'string':
@@ -1206,10 +1206,16 @@ const gatherSelectConverse = {
 
         const gsDefine = csRela.tplDefine.gather_select;
         if (!gsDefine || !gsDefine.enable || !gsDefine.setting || gsDefine.setting === '') return;
+        if (typeof gsDefine.setting === 'string') {
+            gsDefine.setting = JSON.parse(gsDefine.setting);
+        }
         const gsCustom = csRela.cDefine ? csRela.cDefine.gather_select : null;
-        const count = gsDefine.setting.special
-            ? gsCustom.tenders.length - gsDefine.setting.special.length
-            : gsCustom.tenders.length;
+        let count = 0;
+        if (gsCustom) {
+            count = gsDefine.setting.special
+                ? gsCustom.tenders.length - gsDefine.setting.special.length
+                : gsCustom.tenders.length;
+        }
 
         for (const t of options.table) {
             switch (t) {
@@ -1527,10 +1533,10 @@ const loadCooperationData = {
         if (!auditor) return '';
         if (auditor.ass_user_id) {
             return auditor.sign_path ? 'public/upload/sign/' + auditor.sign_path : '';
-        } else {
-            if (!auditor.end_time) return '';
-            return auditor.sign_path ? 'public/upload/sign/' + auditor.sign_path : '';
         }
+        if (!auditor.end_time) return '';
+        return auditor.sign_path ? 'public/upload/sign/' + auditor.sign_path : '';
+
     },
     _loadImCooperationData(ctx, data, options, csRela) {
         let coSignOrder = [];
@@ -1706,7 +1712,7 @@ const getChangeLedger = {
                 end_contract_tp: b.end_contract_tp, end_qc_tp: b.end_qc_tp, end_gather_tp: b.end_gather_tp,
             };
             result.push(l);
-            const childGcl = bills.filter(x => { return x.ledger_pid === b.ledger_id && x.b_code});
+            const childGcl = bills.filter(x => { return x.ledger_pid === b.ledger_id && x.b_code; });
             if (!childGcl || childGcl.length === 0) continue;
 
             const gcl = bills.filter(x => { return x.full_path.indexOf(l.full_path + '-') === 0 && x.b_code; });
@@ -1740,8 +1746,7 @@ const getChangeLedger = {
             const calc = changeLedger.filter(x => { return x.full_path.indexOf(f.full_path) === 0 && x.changes && x.changes.length > 0; });
             if (!calc || calc.length === 0) continue;
 
-            if (options.level === '2-leaf')
-                if (f.level !== 2 && (!f.changes || f.changes.length === 0)) continue;
+            if (options.level === '2-leaf') { if (f.level !== 2 && (!f.changes || f.changes.length === 0)) continue; }
 
             result.push({
                 code: f.code, name: f.name, unit: f.unit,
@@ -1837,14 +1842,14 @@ const gatherGcl2 = {
 
         data.mem_gcl_gather_bills = gatherUtil.gclList;
         data.mem_gcl_gather_xmj = gatherUtil.leafXmjs;
-    }
+    },
 };
 const gatherMaterialGl = {
     name: '分类汇总调差工料',
     hint: '根据工程量清单分类汇总调差工料,要求先使用【工程量清单汇总2】处理得到工程量清单数据,并引入【调差工料明细】',
     _relaGl(source, data) {
         if (!source) return;
-        const gl = source.find(x => {return x.id === data.mb_id;});
+        const gl = source.find(x => { return x.id === data.mb_id; });
         if (gl) {
             data.gl_code = gl.code;
             data.gl_name = gl.name;
@@ -1898,7 +1903,7 @@ const gatherMaterialGl = {
             }
         }
         data.mem_material_gl_detail = result;
-    }
+    },
 };
 
 const analysisObj = {

+ 13 - 13
app/reports/util/rpt_calculation_data_util.js

@@ -25,11 +25,11 @@ const RELATION_TABLES_KEYS = {
 
 const change_CONST = require('../../const/change');
 const TRANSLATE_CONST = {
-    '变更令常量': {
-        '变更类型': { keys: [], values: [] },
-        '变更类别': { keys: [], values: [] },
-        '变更性质': { keys: [], values: [] },
-        '费用承担方' : { keys: [], values: [] },
+    变更令常量: {
+        变更类型: { keys: [], values: [] },
+        变更类别: { keys: [], values: [] },
+        变更性质: { keys: [], values: [] },
+        费用承担方: { keys: [], values: [] },
     },
 };
 
@@ -580,7 +580,7 @@ function preDefineProcess(ctx, tpl, preDefineCfg, rawDataObj, $CURRENT_RPT, cust
                 }
                 data_analyze_util[analysisKey].fun(ctx, rawDataObj, fields, preSetup, {
                     tplDefine: tpl[JV.NODE_CUSTOM_DEFINE],
-                    cDefine: customSelect
+                    cDefine: customSelect,
                 });
             } catch (err) {
                 ctx.helper.log(err);
@@ -771,7 +771,7 @@ function sortData(sourceData, sortCfg, prjData) {
             break;
         case 'self_define':
             if (sortCfg[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC]) {
-                let selfDefFuncA = null;
+                const selfDefFuncA = null;
                 eval('selfDefFuncA = ' + sortCfg[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC]);
                 if (selfDefFuncA !== null) {
                     tempRstArr.sort(selfDefFuncA);
@@ -811,7 +811,7 @@ function assembleFields(fieldList, rstDataArr, $PROJECT) {
                     // console.log(vrst);
                     if (vrst && vrst.length === 1) {
                         field.fixedPrecisionNum = vrst[0];
-                        vrst.splice(0,1);
+                        vrst.splice(0, 1);
                     }
                     // console.log(field);
                 } else if (field.Precision.type === 'flexible') {
@@ -1046,7 +1046,7 @@ function ext_getBlank(dataKey, dftVal) {
         const dtData = getActDataArr(dtObj);
         for (let i = 0; i < dtData.length; i++) {
             if (dftVal !== null && dftVal !== undefined) {
-                rst.push(dftVal)
+                rst.push(dftVal);
             } else rst.push('');
         }
     }
@@ -1101,8 +1101,8 @@ function pri_push_property(propKey, doc, rst) {
         // 备注:这里的key数组表示取value的优先级
         for (let pi = 0; pi < propKey.length; pi++) {
             if (doc.hasOwnProperty('property')) {
-                if (doc['property'].hasOwnProperty(propKey[pi])) {
-                    rst.push(doc['property'][propKey[pi]]);
+                if (doc.property.hasOwnProperty(propKey[pi])) {
+                    rst.push(doc.property[propKey[pi]]);
                     break;
                 }
             } else if (doc.hasOwnProperty(propKey[pi])) {
@@ -1122,8 +1122,8 @@ function pri_push_property(propKey, doc, rst) {
             if (pi === propKey.length - 1) rst.push('');
         }
     } else {
-        if (doc.hasOwnProperty('property') && doc['property'].hasOwnProperty(propKey)) {
-            rst.push(doc['property'][propKey]);
+        if (doc.hasOwnProperty('property') && doc.property.hasOwnProperty(propKey)) {
+            rst.push(doc.property[propKey]);
         } else if (doc.hasOwnProperty(propKey)) {
             rst.push(doc[propKey]);
         } else {