Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuCost

chenshilong 7 years ago
parent
commit
90737cdf57
5 changed files with 60 additions and 11 deletions
  1. 5 3
      Dockerfile
  2. 5 3
      Dockerfile_pp
  3. 5 3
      Dockerfile_qa
  4. 6 1
      modules/reports/controllers/rpt_controller.js
  5. 39 1
      public/web/treeDataHelper.js

+ 5 - 3
Dockerfile

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=prod
 

+ 5 - 3
Dockerfile_pp

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=pp
 

+ 5 - 3
Dockerfile_qa

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=qa
 

+ 6 - 1
modules/reports/controllers/rpt_controller.js

@@ -255,7 +255,12 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
                         printCom.initialize(rptTpl);
                         printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
                         let maxPages = printCom.totalPages;
-                        let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
+                        let pageRst = null;
+                        if (maxPages > 0) {
+                            pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
+                        } else {
+                            pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
+                        }
                         if (pageRst) {
                             // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
                             cb(null, pageRst);

+ 39 - 1
public/web/treeDataHelper.js

@@ -18,7 +18,7 @@ let tree_Data_Helper = {
             return tmpNodeRst;
         };
         let private_buildNodeData = function(parentItem, idArr, treeLevel, tbID) {
-            let iter = [], nextNode = private_getStartNode(idArr);
+            let iter = [], nextNode = private_getStartNode(idArr), pushedIds = [];
             while (nextNode !== null && nextNode !== undefined ) {
                 if (parentItem) {
                     parentItem[CHILDREN_NODE].push(nextNode);
@@ -26,6 +26,7 @@ let tree_Data_Helper = {
                     rst.push(nextNode);
                 }
                 iter.push(nextNode);
+                pushedIds.push(nextNode[NODE_ID]);
                 nextNode[TOP_BILL_ID] = tbID;
                 if (parentItem === null) {
                     nextNode[TOP_BILL_ID] = nextNode[NODE_ID];
@@ -40,7 +41,44 @@ let tree_Data_Helper = {
                 }
                 if (addLevel) nextNode[TREE_LEVEL] = treeLevel;
                 nextNode = tmpNodes[prefix + nextNode[NEXT_ID]];
+                if (nextNode === null || nextNode === undefined) {
+                    //备注: 考虑到实际数据的健壮性,有些节点会掉链子,需要用 parentItem[SUB_ID] 比对已经加上的节点,如发现加上的节点数量不够,那就得在这里补充上去
+                    if (parentItem) {
+                        if (parentItem[SUB_ID].length > iter.length) {
+                            for (let subId of parentItem[SUB_ID]) {
+                                if (pushedIds.indexOf(subId) < 0) {
+                                    let restNode = tmpNodes[prefix + subId];
+                                    if (addLevel) restNode[TREE_LEVEL] = treeLevel;
+                                    restNode[TOP_BILL_ID] = tbID;
+                                    parentItem[CHILDREN_NODE].push(restNode);
+                                    iter.push(restNode);
+                                }
+                            }
+                        }
+                    } else {
+                        if (idArr.length > iter.length) {
+                            for (let topId of idArr) {
+                                if (pushedIds.indexOf(topId) < 0) {
+                                    let restNode = tmpNodes[prefix + topId];
+                                    if (addLevel) restNode[TREE_LEVEL] = treeLevel;
+                                    restNode[TOP_BILL_ID] = restNode[NODE_ID];
+                                    if (restNode.flags && restNode.flags.length > 0) {
+                                        for (let flag of restNode.flags) {
+                                            if (flag.fieldName === "fixed") {
+                                                restNode[TOP_BILL_ID] = flag.flag;
+                                                break;
+                                            }
+                                        }
+                                    }
+                                    rst.push(restNode);
+                                    iter.push(restNode);
+                                }
+                            }
+                        }
+                    }
+                }
             }
+            pushedIds = [];
             for (let i = 0; i < iter.length; i++) {
                 let rtbID = tbID;
                 if (parentItem === null) {