Parcourir la source

新增判断指标(清单_顶层父清单_ID)

TonyKang il y a 7 ans
Parent
commit
724a6e1693

+ 24 - 11
modules/reports/util/rpt_construct_data_util.js

@@ -437,9 +437,9 @@ function filterData(sourceData, handleCfg, prjData) {
                     rst = compVal.indexOf(src) >= 0;
                 } else {
                     //string,需要转类型
-                    let newCv = JSON.parse(compVal);
-                    if (newCv instanceof Array) {
-                        rst = newCv.indexOf(src) >= 0;
+                    let newInCv = JSON.parse(compVal);
+                    if (newInCv instanceof Array) {
+                        rst = newInCv.indexOf(src) >= 0;
                     } else {
                         rst = false;
                     }
@@ -450,9 +450,9 @@ function filterData(sourceData, handleCfg, prjData) {
                     rst = compVal.indexOf(src) < 0;
                 } else {
                     //string,需要转类型
-                    let newCv = JSON.parse(compVal);
-                    if (newCv instanceof Array) {
-                        rst = newCv.indexOf(src) < 0;
+                    let newNotInCv = JSON.parse(compVal);
+                    if (newNotInCv instanceof Array) {
+                        rst = (newNotInCv.indexOf(src) < 0);
                     } else {
                         rst = true;
                     }
@@ -465,12 +465,25 @@ function filterData(sourceData, handleCfg, prjData) {
     };
     let private_chkArrVal = function(arr, key, compVal, compStr){
         let rst = false;
-        for (let arrItem of arr) {
-            if (arrItem[key]) {
-                rst = private_chkVal(arrItem[key], compVal, compStr);
+        if (arr.length > 0) {
+            for (let arrItem of arr) {
+                if (arrItem[key]) {
+                    rst = private_chkVal(arrItem[key], compVal, compStr);
+                }
+                if (rst) {
+                    break;
+                }
             }
-            if (rst) {
-                break;
+        } else {
+            //在某些判断条件下(含有'非'判断),如arr没有数组项,默认结果反而是true
+            switch (compStr) {
+                case "!=" :
+                case "!==" :
+                case "not in":
+                    rst = true;
+                    break;
+                default:
+                    break;
             }
         }
         return rst;

+ 13 - 4
public/web/treeDataHelper.js

@@ -1,7 +1,8 @@
 /**
  * Created by Tony on 2017/1/23.
  */
-const NODE_ID = "ID", P_ID = "ParentID", NEXT_ID = "NextSiblingID", ADHOC_PRE_ID="Previous_ID", CHILDREN_NODE = "items", SUB_ID = "sub_ids", EMPTY_ID_VAL = -1, TREE_LEVEL = 'treeLevel';
+const NODE_ID = "ID", P_ID = "ParentID", NEXT_ID = "NextSiblingID", ADHOC_PRE_ID="Previous_ID", CHILDREN_NODE = "items", SUB_ID = "sub_ids",
+      EMPTY_ID_VAL = -1, TREE_LEVEL = 'treeLevel', TOP_BILL_ID = "topBillID";
 
 let tree_Data_Helper = {
     buildTreeNodeDirectly: function(data, addLevel) {
@@ -16,7 +17,7 @@ let tree_Data_Helper = {
             }
             return tmpNodeRst;
         };
-        let private_buildNodeData = function(parentItem, idArr, treeLevel) {
+        let private_buildNodeData = function(parentItem, idArr, treeLevel, tbID) {
             let iter = [], nextNode = private_getStartNode(idArr);
             while (nextNode !== null && nextNode !== undefined ) {
                 if (parentItem) {
@@ -25,11 +26,19 @@ let tree_Data_Helper = {
                     rst.push(nextNode);
                 }
                 iter.push(nextNode);
+                nextNode[TOP_BILL_ID] = tbID;
+                if (parentItem === null) {
+                    nextNode[TOP_BILL_ID] = nextNode[NODE_ID];
+                }
                 if (addLevel) nextNode[TREE_LEVEL] = treeLevel;
                 nextNode = tmpNodes[prefix + nextNode[NEXT_ID]];
             }
             for (let i = 0; i < iter.length; i++) {
-                private_buildNodeData(iter[i], iter[i][SUB_ID], (treeLevel + 1));
+                let rtbID = tbID;
+                if (parentItem === null) {
+                    rtbID = iter[i][NODE_ID];
+                }
+                private_buildNodeData(iter[i], iter[i][SUB_ID], (treeLevel + 1), rtbID);
             }
         };
 
@@ -52,7 +61,7 @@ let tree_Data_Helper = {
                 tmpNodes[prefix + data[i][P_ID]][SUB_ID].push(data[i][NODE_ID]);
             }
         }
-        private_buildNodeData(null, topArr, 0);
+        private_buildNodeData(null, topArr, 0, -1);
         //try to release and return
         tmpNodes = null;
         topArr.length = 0;

+ 34 - 24
web/maintain/report/js/rpt_tpl_pre_handle.js

@@ -35,6 +35,29 @@ const fixed_glj_types = [
     {Name: "主材(4)", Title: "", Value: 4},
     {Name: "设备(5)", Title: "", Value: 5}
 ];
+const fixed_top_bills_nodes = [
+    {Name: "分部分项工程(1)", Title: "", Value: 1}
+    ,{Name: "措施项目(2)", Title: "", Value: 2}
+    ,{Name: "其他项目(7)", Title: "", Value: 7}
+    ,{Name: "规费(15)", Title: "", Value: 15}
+    ,{Name: "税金(18)", Title: "", Value: 18}
+    ,{Name: "工程造价(19)", Title: "", Value: 19}
+];
+const fixed_other_bills_types = [
+    {Name: "施工技术措施项目(3)", Title: "", Value: 3}
+    ,{Name: "安全文明施工按实计算费用(4)", Title: "", Value: 4}
+    ,{Name: "施工组织措施专项费用(5)", Title: "", Value: 5}
+    ,{Name: "安全文明施工专项费用(6)", Title: "", Value: 6}
+    ,{Name: "暂列金额(8)", Title: "", Value: 8}
+    ,{Name: "暂估价(9)", Title: "", Value: 9}
+    ,{Name: "材料(工程设备)暂估价(10)", Title: "", Value: 10}
+    ,{Name: "专业工程暂估价(11)", Title: "", Value: 11}
+    ,{Name: "计日工(12)", Title: "", Value: 12}
+    ,{Name: "总承包服务费(13)", Title: "", Value: 13}
+    ,{Name: "索赔与现场签证(14)", Title: "", Value: 14}
+    ,{Name: "社会保险费及住房公积金(16)", Title: "", Value: 16}
+    ,{Name: "工程排污费(17)", Title: "", Value: 17}
+];
 const fixed_bills_flags = [
     {Name: "分部分项工程(1)", Title: "", Value: 1},
     {Name: "措施项目(2)", Title: "", Value: 2},
@@ -56,10 +79,19 @@ const fixed_bills_flags = [
     {Name: "税金(18)", Title: "", Value: 18},
     {Name: "工程造价(19)", Title: "", Value: 19}
 ];
+const fixed_bills_types = [
+    {Name: "大项费用(1)", Title: "", Value: 1},
+    {Name: "分部(2)", Title: "", Value: 2},
+    {Name: "分项(3)", Title: "", Value: 3},
+    {Name: "清单(4)", Title: "", Value: 4},
+    {Name: "补项(5)", Title: "", Value: 5},
+];
 const exposed_bills_properties = [
     {Name: "清单_所属项目ID", Title: "", Key: "projectID", Order: "ascend"}
     ,{Name: "清单_ID", Title: "", Key: "ID", Order: "ascend"}
+    ,{Name: "顶层父清单_ID", Title: "", Key: "topBillID", Order: "ascend", individualType: fixed_top_bills_nodes}
     ,{Name: "清单_层次", Title: "", Key: "treeLevel", Order: "ascend"}
+    ,{Name: "清单_类别", Title: "", Key: "type", Order: "ascend", individualType: fixed_bills_types}
     ,{Name: "清单_标记", Title: "", Key: "flags.flag", Order: "ascend", individualType: fixed_bills_flags}
 ];
 const exposed_ration_properties = [
@@ -90,29 +122,6 @@ const exposed_prj_glj_properties = [
     ,{Name: "项目人材机_三材类别", Title: "", Key: "materialType", Order: "ascend", individualType: fixed_material_types}
 ];
 const exposed_properties_arr = [exposed_bills_properties, exposed_ration_properties, exposed_ration_glj_properties, exposed_prj_glj_properties];
-const fixed_top_bills_nodes = [
-    {Name: "分部分项工程(1)", Title: "", Value: 1}
-    ,{Name: "措施项目(2)", Title: "", Value: 2}
-    ,{Name: "其他项目(7)", Title: "", Value: 7}
-    ,{Name: "规费(15)", Title: "", Value: 15}
-    ,{Name: "税金(18)", Title: "", Value: 18}
-    ,{Name: "工程造价(19)", Title: "", Value: 19}
-];
-const fixed_other_bills_types = [
-    {Name: "施工技术措施项目(3)", Title: "", Value: 3}
-    ,{Name: "安全文明施工按实计算费用(4)", Title: "", Value: 4}
-    ,{Name: "施工组织措施专项费用(5)", Title: "", Value: 5}
-    ,{Name: "安全文明施工专项费用(6)", Title: "", Value: 6}
-    ,{Name: "暂列金额(8)", Title: "", Value: 8}
-    ,{Name: "暂估价(9)", Title: "", Value: 9}
-    ,{Name: "材料(工程设备)暂估价(10)", Title: "", Value: 10}
-    ,{Name: "专业工程暂估价(11)", Title: "", Value: 11}
-    ,{Name: "计日工(12)", Title: "", Value: 12}
-    ,{Name: "总承包服务费(13)", Title: "", Value: 13}
-    ,{Name: "索赔与现场签证(14)", Title: "", Value: 14}
-    ,{Name: "社会保险费及住房公积金(16)", Title: "", Value: 16}
-    ,{Name: "工程排污费(17)", Title: "", Value: 17}
-];
 
 let preHandleObj = {
     treeObj: null,
@@ -395,6 +404,7 @@ let preHandleObj = {
                 let newNode = me.createNewNode(treeNode[JV.PROP_HANDLE_TYPE]);
                 newNode.Name = "子过滤";
                 newNode[JV.PROP_DATA_KEY] = treeNode[JV.PROP_DATA_KEY];
+                newNode.Title = "";
                 me.private_set_title(newNode);
                 newSubNodes.push(newNode);
                 treeNode.isParent = true;
@@ -760,7 +770,7 @@ let preHandleFilterObj = {
         if (src[JV.PROP_OTHER_SUB_FILTER] && src[JV.PROP_OTHER_SUB_FILTER].length > 0) {
             dest.items = [];
             for (let subFilter of src[JV.PROP_OTHER_SUB_FILTER]) {
-                let dtlRst = {Name: "子过滤"};
+                let dtlRst = {Name: "子过滤", Title: ""};
                 me.copyNode(subFilter, dtlRst);
                 dtlRst[JV.PROP_HANDLE_TYPE] = src[JV.PROP_HANDLE_TYPE];
                 dtlRst[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];