duy před 2 roky
rodič
revize
35d8ff76ce
1 změnil soubory, kde provedl 48 přidání a 12 odebrání
  1. 48 12
      src/views/manager/projectinfo/detail.vue

+ 48 - 12
src/views/manager/projectinfo/detail.vue

@@ -575,6 +575,7 @@ export default {
       rightloading:false,
       logleftloading:false,
       logrightloading:false,
+      selectData:{}
     }
   },
   computed: {
@@ -696,6 +697,11 @@ export default {
         const data = res.data.data
         console.log(data)
         this.projectForm = data;
+        this.selectData={
+          referenceWbsTemplateId:data.referenceWbsTemplateId,//质检
+          referenceWbsTemplateIdTrial:data.referenceWbsTemplateIdTrial//试验
+
+        }
         if (Number(this.projectForm.estimatedAmount) < 0) {
           this.projectForm.estimatedAmount = 0
         }
@@ -713,6 +719,7 @@ export default {
     },
 
     async saveQuit () {
+      console.log('保存2',this.selectData);
       this.btnLoad = true;
       this.saveBtnLoad = true;
       this.saveBtnBackDisabled = true
@@ -747,6 +754,7 @@ export default {
       this.$router.go(-1);
     },
     async saveNext (type) {
+         console.log('保存',this.activeType,this.selectData);
       this.btnLoad = true;
       if (type == 'n') {
         this.saveBtnNextLoad = true;
@@ -809,6 +817,7 @@ export default {
     },
 
     saveProject () {
+         console.log('保存3',this.selectData);
       return new Promise((resolve, reject) => {
         this.$refs['projectForm'].validate((valid) => {
           if (valid) {
@@ -978,7 +987,13 @@ export default {
       })
     },
     wbsChange (value) {
-      //console.log(value)
+      console.log(value,'WBS节点更换')
+      console.log(this.templateType);
+      if(this.templateType==1){
+        this.selectData.referenceWbsTemplateId=value
+      }else{
+        this.selectData.referenceWbsTemplateIdTrial=value
+      }
       this.leftloading = true;
       if (value.toString().indexOf(',') >= 0) {
         //私有库
@@ -996,6 +1011,7 @@ export default {
         getAlltree(this.userInfo.tenant_id, '1', value).then((res) => {
           if (Array.isArray(res.data.data)) {
             this.leftTreeData = res.data.data;
+            console.log("this.leftTreeData", this.leftTreeData)
           } else {
             this.leftTreeData = [];
           }
@@ -1032,6 +1048,7 @@ export default {
     },
 
     getTreeList () {
+      console.log('getTreeList');
       return new Promise((resolve) => {
         if (this.treeList.length) {
           resolve();
@@ -1061,6 +1078,8 @@ export default {
             arr[1].options = data.wbsTreePrivates;
           }
           this.treeList = arr;
+          this.wbsId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
+          this.wbsChange(this.wbsId)
         }).finally(() => {
           resolve();
         })
@@ -1076,6 +1095,8 @@ export default {
     },
 
     templateTypeChange () {
+      console.log(this.wbsId,'this.wbsId');
+      console.log(this.templateType,'this.wbsId');
       findWbsTreeList(this.templateType).then((res) => {
         let arr = [
           {label: '公有库', options: []},
@@ -1097,17 +1118,21 @@ export default {
           arr[1].options = data.wbsTreePrivates;
         }
         this.treeList = arr;
+        console.log(this.treeList,'this.treeList');
+        this.wbsId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
+      
+         this.wbsChange(this.wbsId)
 
-        if(this.treeList[0].options.length > 0){
-          this.wbsId = this.treeList[0].options[0].value;
-          this.wbsChange(this.wbsId)
-        }else if(this.treeList[1].options.length > 0){
-          this.wbsId = this.treeList[1].options[0].value;
-          this.wbsChange(this.wbsId)
-        }else{
-          this.wbsId = '';
-          this.leftTreeData = [];
-        }
+        // if(this.treeList[0].options.length > 0){
+        //   this.wbsId = this.treeList[0].options[0].value;
+        //   this.wbsChange(this.wbsId)
+        // }else if(this.treeList[1].options.length > 0){
+        //   this.wbsId = this.treeList[1].options[0].value;
+        //   this.wbsChange(this.wbsId)
+        // }else{
+        //   this.wbsId = '';
+        //   this.leftTreeData = [];
+        // }
       })
 
     },
@@ -1197,7 +1222,18 @@ export default {
 
     getRightTree() {
       this.rightloading = true;
-      let WbsId = this.templateType === 1 ? this.projectForm.referenceWbsTemplateId : this.projectForm.referenceWbsTemplateIdTrial
+     
+      let WbsId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
+      findProjectTree(this.projectForm.id, WbsId).then((res) => {
+        if (Array.isArray(res.data.data)) {
+          this.$refs.treetotree.setRightTree(res.data.data);
+        } else {
+          this.$refs.treetotree.setRightTree([]);
+        }
+        this.rightloading = false;
+      })
+    
+      
       findProjectTree(this.projectForm.id, WbsId).then((res) => {
         if (Array.isArray(res.data.data)) {
           this.$refs.treetotree.setRightTree(res.data.data);