duy il y a 2 ans
Parent
commit
b4c69c8210
1 fichiers modifiés avec 52 ajouts et 7 suppressions
  1. 52 7
      src/views/manager/projectinfo/detail.vue

+ 52 - 7
src/views/manager/projectinfo/detail.vue

@@ -601,6 +601,13 @@ export default {
       isFirst:false,
       rightTreeData:[],//存储右边的试验树数据
       rightTreeData1:[],//存储右边的质检树数据
+    
+      rightObj:[
+        
+      ],
+      rightObj1:[
+       
+      ],
       nowref:{}
      
     }
@@ -1150,14 +1157,51 @@ export default {
         })
       })
     },
+//格式化wbsid
+  formatWbsId(orid){
+       let refId = orid;
+      let WbsId=''
+      if (this.projectForm.referenceWbsTemplateType === 'private'||this.projectForm.referenceWbsTemplateTypeTrial === 'private' && refId != null && refId.toString().length > 0) {
+        console.log(1111111111111);
+          console.log(refId,'ids');
+        // 私有库右边树形数据是通过 pkeyId 查询的
+        let ids = refId.toString().split(",");
+      console.log(ids,'ids');
+        if (ids.length > 1) {
+          refId = ids[0]
+          console.log(refId,'refId');
+            console.log(this.treeList,'treeList');
+          let list = this.treeList[1].options;
+          refId = list.filter(e => e.projectId == ids[1])[0].pkeyId;
+           WbsId=refId
+        }
+      }else{
+          console.log(3333333);
+        WbsId=refId
+      }
+
+    return WbsId
+   
 
+  },
     treeChang () {
-      console.log(this.$refs.treetotree.rightTreeData,'this.$refs.treetotree');
-      console.log(this.templateType,'this.templateType');
+     let recordid= this.formatWbsId(this.wbsId)
+     console.log(recordid,'recordid');
       if (this.templateType===2) {
-        this.rightTreeData=this.$refs.treetotree.rightTreeData
+        this.rightTreeData=this.$refs.treetotree.rightTreeData;
+        // this.rightObj.push({
+        //   wbsid:this.wbsId,objdata: this.rightTreeData
+        // })
+        this.rightObj.wbsId=recordid
+        this.rightObj.objdata=this.rightTreeData
       }else{
           this.rightTreeData1=this.$refs.treetotree.rightTreeData
+          //  this.rightObj1.push({
+          //   wbsid:this.wbsId,objdata: this.rightTreeData
+          // })
+          this.rightObj1.wbsId=recordid
+          this.rightObj1.objdata=this.rightTreeData1
+        
       }
     
       this.typeChang[2] = true;
@@ -1395,7 +1439,7 @@ export default {
         }
       }
       //引用被删会出现 wbsType -1
-      if (refId && refId > 0 && Number(this.projectForm.wbsType) > 0) {
+      if (refId && refId > 0) {
         let priv = {};
         if (this.projectForm.referenceWbsTemplateType == 'private') {
           //私有
@@ -1430,12 +1474,13 @@ export default {
      
   
        console.log(WbsId,'WbsId'); 
-   
+      console.log(this.rightObj1,'this.rightObj111111111');
+        console.log(this.rightObj,'this.rightObj000000000000');
     // findProjectTree(this.projectForm.id,  this.templateType === 1 ? WbsId : this.selectData.referenceWbsTemplateIdTrial).then((res) => {
      findProjectTree(this.projectForm.id, WbsId).then((res) => {
-      if (this.rightTreeData.length>0&&this.templateType===2) {
+      if (this.rightTreeData.length>0&&this.templateType===2&&this.rightObj.wbsId==WbsId) {
          this.$refs.treetotree.setRightTree(this.rightTreeData);
-      }else if(this.rightTreeData1.length>0&&this.templateType===1){
+      }else if(this.rightTreeData1.length>0&&this.templateType===1&&this.rightObj1.wbsId==WbsId){
           this.$refs.treetotree.setRightTree(this.rightTreeData1);
       }
       else{