ソースを参照

后管试验功能

iZaiZaiA 2 年 前
コミット
61d536e9dc

+ 2 - 1
src/views/manager/projectinfo/list.vue

@@ -258,7 +258,8 @@ export default {
         path: '/project/tree',
         query: {
           pid: this.curProjiect.id,
-          wbsid: this.curProjiect.referenceWbsTemplateId
+          wbsid: this.curProjiect.referenceWbsTemplateId,
+          type: 2
         }
       });
     },

+ 83 - 14
src/views/manager/projectinfo/tree.vue

@@ -400,7 +400,7 @@
   <el-row class="h-100p" v-show="showType == 2">
     <el-col :span="6" class="h-100p">
       <basic-container>
-        <el-scrollbar class="h-100p">          
+        <el-scrollbar class="h-100p">
           <el-tree
             class="filter-tree"
             lazy
@@ -723,7 +723,7 @@
         ref="nodeDetail"
         :model="nodeDetail"
         :rules="rules"
-        label-width="110px"
+        label-width="140px"
       >
         <el-form-item
           label="节点名称"
@@ -748,6 +748,7 @@
             disabled
             placeholder="请选择"
             class="w-100p"
+            @change="nodeTypeChange"
           >
             <el-option
               v-for="item in nodeTypelist"
@@ -757,7 +758,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="划分编号">
+        <el-form-item label="划分编号" v-if="wbsType !== 2">
           <el-input v-model="nodeDetail.partitionCode"></el-input>
         </el-form-item>
         <el-form-item label="唯一编码">
@@ -795,7 +796,7 @@
             </el-radio-group>
           </el-form-item>
         </template>
-        <el-form-item label="内业资料类型" prop="majorDataType">
+        <el-form-item label="内业资料类型" prop="majorDataType" v-if="wbsType !== 2">
           <el-select
             v-model="nodeDetail.majorDataType"
             disabled
@@ -810,6 +811,25 @@
             ></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="勾选相关联试验" prop="mixRatioTestIds" v-if="wbsType === 2 && nodeDetail.nodeType === 53">
+          <div style="position: relative; height: 300px; border: 1px solid #dddfe6;">
+            <el-scrollbar class="h-100p">
+              <div v-loading="testTreeLoad">
+                <el-tree class="filter-tree"
+                         :data="testTreeData"
+                         :props="defaultProps"
+                         :expand-on-click-node="false"
+                         highlight-current
+                         node-key="id"
+                         ref="treeall"
+                         show-checkbox
+                         :default-checked-keys="mixRatioTestIds"
+                         @check="TestTreeCheckChange"
+                />
+              </div>
+            </el-scrollbar>
+          </div>
+        </el-form-item>
       </el-form>
       <span
         slot="footer"
@@ -1687,7 +1707,7 @@ export default {
       aliasVisible:false,//别名
       aliasInput:'',
       aliasArr:[],
-      
+
       formulaCompVisible:false,//公式弹框
       formulaCurRow:{},//当前元素
 
@@ -1706,6 +1726,9 @@ export default {
 
       showType:1,
       typeTreeData:[],
+      testTreeLoad: false,
+      testTreeData: [],
+      mixRatioTestIds: []
     };
   },
   computed: {
@@ -1728,8 +1751,13 @@ export default {
   methods: {
     //#region
     init () {
-      this.id = this.$route.query.wbsid;
-      this.projectid = this.$route.query.pid;
+      //this.id = this.$route.query.wbsid;
+      //this.projectid = this.$route.query.pid;
+      const {id, projectid, type} = this.$route.query;
+      this.id = id
+      this.projectid = projectid
+      this.wbsType = Number(type)
+
       this.getNodeTypelist();
       this.getTableTypelist();
       this.getDataTypelist();
@@ -1770,12 +1798,30 @@ export default {
       this.getExpandedKeys(node);
     },
     saveNode () {
+      const type = this.wbsType
       this.$refs['nodeDetail'].validate((valid) => {
         if (valid) {
-          if (this.editType == 1) {
-            this.addNode();
-          } else if (this.editType == 2) {
-            this.updateNode();
+          const { mixRatioTestIds, nodeType } = this.nodeDetail
+          if (type === 2 && nodeType === 53) {
+            if (mixRatioTestIds) {
+              if (this.editType == 1) {
+                this.addNode();
+              } else if (this.editType == 2) {
+                this.updateNode();
+              }
+            } else {
+              this.$message({
+                type: "error",
+                message: '请先选择节点'
+              });
+              return false;
+            }
+          } else {
+            if (this.editType == 1) {
+              this.addNode();
+            } else if (this.editType == 2) {
+              this.updateNode();
+            }
           }
         } else {
           console.log('error submit!!');
@@ -1807,7 +1853,9 @@ export default {
         });
       })
     },
-
+    toSplit(val) {
+      return val ? String(val).split(',') : '';
+    },
     setLeftType (type, data, node) {
       this.jiedianId = data.id
       if (type == 4 || type == 5) {
@@ -1838,6 +1886,7 @@ export default {
           };
         } else {
           this.nodeDetail = Object.assign({}, res.data.data);
+          this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds)
         }
         this.nodeDetail.type = 1;//	'1'节点 '2'表单
         this.nodeDetail.wbsId = this.id;
@@ -2079,7 +2128,26 @@ export default {
         });
       }
     },
-
+    nodeTypeChange(val) {
+      if (val === 53) {
+        if (this.testTreeData.length > 0) {
+          return;
+        }
+        this.testTreeLoad = true;
+        getAlltree(this.userInfo.tenant_id, 1, this.id).then((res) => {
+          this.testTreeLoad = false;
+          this.testTreeData = res.data.data;
+        })
+      }
+    },
+    //根据逗号联合
+    toJoin(arr) {
+      return arr ? arr.join() : '';
+    },
+    TestTreeCheckChange(_, {checkedKeys, halfCheckedKeys}) {
+      const newarr = [...checkedKeys, ...halfCheckedKeys]
+      this.nodeDetail.mixRatioTestIds = this.toJoin(newarr)
+    },
     filterChange () {
       //console.log(this.$refs)
       //debugger
@@ -2828,6 +2896,7 @@ export default {
         })
         return;
       }
+      this.mixRatioTestIds = []
       this.setLeftType(2,this.curTreeData,this.curTreeNode)
     },
     copyNodeHandle(){
@@ -2885,7 +2954,7 @@ export default {
           this.syncBtnLoad = false;
         })
       })
-      
+
     },