|
@@ -33,13 +33,15 @@ const projectType = {
|
|
|
project: 'Project',
|
|
|
engineering: 'Engineering',
|
|
|
};
|
|
|
+const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
|
|
|
|
|
|
|
module.exports={
|
|
|
moveProject:moveProject,
|
|
|
copyProject:copyProject,
|
|
|
getSummaryInfo: getSummaryInfo,
|
|
|
- getConstructionProject: getConstructionProject
|
|
|
+ getConstructionProject: getConstructionProject,
|
|
|
+ getFullPath: getFullPath
|
|
|
};
|
|
|
|
|
|
async function copyProject(userID, compilationID,data) {
|
|
@@ -607,7 +609,6 @@ async function getSummaryInfo(projectIDs){
|
|
|
//根据项目ID获取所属建设项目
|
|
|
//@param {Number}projectID @return {Object}
|
|
|
async function getConstructionProject(projectID){
|
|
|
- const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
|
function returnProject(project){
|
|
|
if(!project || project.projType === projectType.folder){
|
|
|
return null;
|
|
@@ -629,4 +630,26 @@ async function getConstructionProject(projectID){
|
|
|
let grandParent = await projectModel.findOne({ID: parent.ParentID, $or: notDeleted});
|
|
|
returnV = returnProject(grandParent);
|
|
|
return returnV !== undefined ? returnV : null;
|
|
|
+}
|
|
|
+
|
|
|
+//获取单位工程完整目录结构
|
|
|
+//@param {Number}projectID @return {Arry}
|
|
|
+async function getFullPath(projectID) {
|
|
|
+ let fullPath = [];
|
|
|
+ let project = await projectModel.findOne({ID: projectID, $or: notDeleted}, '-_id ParentID name');
|
|
|
+ if(project){
|
|
|
+ fullPath.push(project.name);
|
|
|
+ await getParent(project.ParentID);
|
|
|
+ }
|
|
|
+ fullPath = fullPath.reverse();
|
|
|
+ return fullPath.join('\\');
|
|
|
+ async function getParent(ParentID) {
|
|
|
+ if(ParentID != -1){
|
|
|
+ let parent = await projectModel.findOne({ID: ParentID, $or: notDeleted}, '-_id ParentID name');
|
|
|
+ if(parent){
|
|
|
+ fullPath.push(parent.name);
|
|
|
+ await getParent(parent.ParentID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|