|  | @@ -40,6 +40,7 @@ module.exports={
 | 
	
		
			
				|  |  |      moveProject:moveProject,
 | 
	
		
			
				|  |  |      copyProject:copyProject,
 | 
	
		
			
				|  |  |      getSummaryInfo: getSummaryInfo,
 | 
	
		
			
				|  |  | +    getSummaryInfoByTender: getSummaryInfoByTender,
 | 
	
		
			
				|  |  |      getConstructionProject: getConstructionProject,
 | 
	
		
			
				|  |  |      getFullPath: getFullPath
 | 
	
		
			
				|  |  |  };
 | 
	
	
		
			
				|  | @@ -506,7 +507,29 @@ function getBuildingArea(projFeature){
 | 
	
		
			
				|  |  |  //根据单位工程ID获取汇总信息
 | 
	
		
			
				|  |  |  //@param {Number}tenderID {String}summaryType
 | 
	
		
			
				|  |  |  async function getSummaryInfoByTender(tenderID, summaryType) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    const projectType = {project: 'project', engineering: 'engineering'};
 | 
	
		
			
				|  |  | +    const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
 | 
	
		
			
				|  |  | +    let tender = await projectModel.findOne({ID: tenderID, $or: notDeleted});
 | 
	
		
			
				|  |  | +    let summaryItemID;
 | 
	
		
			
				|  |  | +    if(!tender){
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let engineering = await projectModel.findOne({ID: tender.ParentID, $or: notDeleted});
 | 
	
		
			
				|  |  | +    if(!engineering){
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let project = await projectModel.findOne({ID: engineering.ParentID, $or: notDeleted});
 | 
	
		
			
				|  |  | +    if(!project){
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if(summaryType === projectType.engineering){
 | 
	
		
			
				|  |  | +        summaryItemID = engineering.ID;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else {
 | 
	
		
			
				|  |  | +        summaryItemID = project.ID;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let summaryInfo = await getSummaryInfo([project.ID]);
 | 
	
		
			
				|  |  | +    return summaryInfo[summaryItemID];
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  async function getSummaryInfo(projectIDs){
 | 
	
	
		
			
				|  | @@ -521,9 +544,6 @@ async function getSummaryInfo(projectIDs){
 | 
	
		
			
				|  |  |      flagFieldMapping[billsFlags.OTHER] = 'other';
 | 
	
		
			
				|  |  |      flagFieldMapping[billsFlags.CHARGE] = 'charge';
 | 
	
		
			
				|  |  |      flagFieldMapping[billsFlags.TAX] = 'tax';
 | 
	
		
			
				|  |  | -   /* for(let projectID of projectIDs){
 | 
	
		
			
				|  |  | -        IDMapping[projectID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
 | 
	
		
			
				|  |  | -    }*/
 | 
	
		
			
				|  |  |      let projects = await projectModel.find({ID: {$in : projectIDs}, projType: projectType.project, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
 | 
	
		
			
				|  |  |      //设置建设项目的总建筑面积
 | 
	
		
			
				|  |  |      for(let project of projects){
 | 
	
	
		
			
				|  | @@ -608,7 +628,6 @@ async function getSummaryInfo(projectIDs){
 | 
	
		
			
				|  |  |                                    projectInfo.buildingArea.toString().trim() : scMathUtil.roundTo(projectInfo.engineeringCost / projectInfo.buildingArea, perCostDecimal);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    console.log(IDMapping);
 | 
	
		
			
				|  |  |      return IDMapping;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -648,7 +667,7 @@ async function getFullPath(projectID) {
 | 
	
		
			
				|  |  |          await getParent(project.ParentID);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      fullPath = fullPath.reverse();
 | 
	
		
			
				|  |  | -    return fullPath.join('\\');
 | 
	
		
			
				|  |  | +    return fullPath;
 | 
	
		
			
				|  |  |      async function getParent(ParentID) {
 | 
	
		
			
				|  |  |          if(ParentID != -1){
 | 
	
		
			
				|  |  |              let parent = await projectModel.findOne({ID: ParentID, $or: notDeleted}, '-_id ParentID name');
 |