Browse Source

汇总接口增加编制说明

zhongzewei 6 years ago
parent
commit
08b072fa91
1 changed files with 21 additions and 7 deletions
  1. 21 7
      modules/pm/facade/pm_facade.js

+ 21 - 7
modules/pm/facade/pm_facade.js

@@ -666,7 +666,9 @@ function getBuildingArea(projFeature){
 async function getSummaryInfoByTender(tenderID, summaryType) {
     const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
     let tender = await projectModel.findOne({ID: tenderID, $or: notDeleted});
-    let parentName;
+    let parent,
+        parentName,
+        compilationIllustration;
     let summaryList = [];
     if(!tender){
         return null;
@@ -680,8 +682,8 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
         return null;
     }
     let summaryInfo = await getSummaryInfo([project.ID]);
-    if(summaryType === projectType.engineering){
-        parentName = engineering.name ? engineering.name : '';
+    if(summaryType === projectType.engineering){ // 汇总到单项工程级别
+        parent = engineering;
         let tenders = await projectModel.find({ParentID: engineering.ID, $or: notDeleted});
         for(let t of tenders){
             if(summaryInfo[t.ID]){
@@ -689,9 +691,8 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
                 summaryList.push(summaryInfo[t.ID]);
             }
         }
-    }
-    else {
-        parentName = project.name ? project.name : '';
+    } else { // 汇总到建设项目级别
+        parent = project;
         let engs = await projectModel.find({ParentID: project.ID, $or: notDeleted});
         for(let e of engs){
             if(summaryInfo[e.ID]){
@@ -700,7 +701,20 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
             }
         }
     }
-    return {parent: {name: parentName}, subList: summaryList};
+    // 项目名称
+    parentName = parent && parent.name
+                    ? parent.name
+                    : '';
+    // 编制说明
+    compilationIllustration = parent && parent.property && parent.property.compilationIllustration
+                                ? parent.property.compilationIllustration
+                                : '';
+    return {
+        parent: {
+            name: parentName,
+            compilationIllustration: compilationIllustration},
+        subList: summaryList
+    };
 }
 
 //获取单位工程的各标段费用信息(不进行汇总)