Browse Source

修改删除按钮显隐

wyq 4 years ago
parent
commit
a816d32ec9
1 changed files with 32 additions and 75 deletions
  1. 32 75
      src/components/knowledgeExtra/AddDiagBase.vue

+ 32 - 75
src/components/knowledgeExtra/AddDiagBase.vue

@@ -31,7 +31,7 @@
           <el-form-item label="诊断依据描述:" class="item">
             <el-input
               class="inps"
-              max-length="200"
+              maxlength="200"
               placeholder="请输入诊断依据描述"
               v-model.trim="form.description"
             ></el-input>
@@ -49,6 +49,7 @@
             :span-method="dataSpanMethod"
             :data="form.klDiagnoseTypeVO"
             border
+            ref="tableList"
             style="min-height: 200px"
             height="calc(100vh - 450px)"
             :header-cell-style="{background:'#E3EAF4'}"
@@ -129,7 +130,7 @@
                     width="18"
                     class="icon"
                     @click="delGroup(scope.row.depart_id,scope.$index)"
-                    v-show="groupL[scope.row.depart_id]&&groupL[scope.row.depart_id].id>1"
+                    v-show="isMax(scope.row.depart_id)"
                   />
                 </el-form-item>
               </template>
@@ -185,10 +186,10 @@
                     <div class="box-2" v-if="v.title == '基础依据名称'">
                       <el-form-item
                         :prop="'klDiagnoseTypeVO.' +
-                          scope.$index +
-                          '.groupVO.' +
-                          index +
-                          '.klDiagnoseDetail.'+i+'.basDescription'"
+                        scope.$index +
+                        '.groupVO.' +
+                        index +
+                        '.klDiagnoseDetail.'+i+'.basDescription'"
                         :rules="[{required:true,message:'请输入基础依据名称',trigger:'blur'}]"
                       >
                         <el-input
@@ -331,6 +332,7 @@
                           </el-form-item>
 
                           <el-form-item
+                            class="num"
                             :prop="'klDiagnoseTypeVO.' +
                               scope.$index +
                               '.groupVO.' +
@@ -373,11 +375,12 @@
                           </el-form-item>
 
                           <el-form-item
+                            class="minnum"
                             :prop="'klDiagnoseTypeVO.' +
-                              scope.$index +
-                              '.groupVO.' +
-                              index +
-                              '.klDiagnoseDetail.'+i+'.minVal'"
+                            scope.$index +
+                            '.groupVO.' +
+                            index +
+                            '.klDiagnoseDetail.'+i+'.minVal'"
                           >
                             <el-input v-model="items.minVal" placeholder="填写数值"></el-input>
                           </el-form-item>
@@ -387,6 +390,7 @@
                           </el-form-item>
                         </div>
                       </el-form-item>
+                      
                       <el-form-item
                         :prop="'klDiagnoseTypeVO.' +
                         scope.$index +
@@ -714,40 +718,15 @@ export default {
         }
       }
       return dest;
-    },
-    groupL() {
-      let map = {},
-        dest = [];
-      let arr = [];
-      var formData = JSON.parse(JSON.stringify(this.form));
-      for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
-        let ai = formData.klDiagnoseTypeVO[i];
-        if (!map[ai.depart_id]) {
-          dest.push({
-            depart_id: ai.depart_id,
-            conditionType: ai.conditionType,
-            groupVO: ai.groupVO
-          });
-          map[ai.depart_id] = ai;
-        } else {
-          for (let j = 0; j < dest.length; j++) {
-            var dj = dest[j];
-            if (dj.depart_id == ai.depart_id) {
-              dj.groupVO = dj.groupVO.concat(ai.groupVO);
-              break;
-            }
-          }
-        }
-      }
-      dest.forEach((item, index) => {
-        item.depart_id = index;
-        let arr1 = { id: item.groupVO.length };
-        arr.push(arr1);
-      });
-      return arr;
     }
   },
   methods: {
+    isMax(id) {
+      const typeNum = this.form.klDiagnoseTypeVO.filter(
+        item => item.depart_id === id
+      ).length;
+      return typeNum > 1;
+    },
     getData(data) {
       let arr = data;
       let str = [];
@@ -843,17 +822,17 @@ export default {
     addDiag(id) {
       let temp = this.getInitData();
       var i = -1;
-      console.log(id);
       this.form.klDiagnoseTypeVO.forEach((item, inx) => {
         if (item.depart_id == id) {
           i = inx;
-          console.log(inx);
         }
       });
-
+      this.$nextTick(() => {
+        this.$refs.tableList.bodyWrapper.scrollLeft = 0;
+        //  this.$refs.form.clearValidate();
+      });
       this.form.klDiagnoseTypeVO.splice(i + 1, 0, temp);
       this.setRules();
-      console.log(this.form.klDiagnoseTypeVO);
     },
     //复制依据
     copyDiag(id, inx) {
@@ -938,28 +917,6 @@ export default {
       this.setRules();
     },
     delGroup(id, i) {
-      const formData = JSON.parse(JSON.stringify(this.form));
-      let map = {},
-        dest = [];
-      for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
-        let ai = formData.klDiagnoseTypeVO[i];
-        if (!map[ai.depart_id]) {
-          dest.push({
-            depart_id: ai.depart_id,
-            conditionType: ai.conditionType,
-            groupVO: ai.groupVO
-          });
-          map[ai.depart_id] = ai;
-        } else {
-          for (let j = 0; j < dest.length; j++) {
-            var dj = dest[j];
-            if (dj.depart_id == ai.depart_id) {
-              dj.groupVO = dj.groupVO.concat(ai.groupVO);
-              break;
-            }
-          }
-        }
-      }
       this.form.klDiagnoseTypeVO.splice(i, 1);
       this.setRules();
     },
@@ -1027,6 +984,9 @@ export default {
       this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
         i
       ].dataType = '';
+      this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
+        i
+      ].conceptList = [];
       this.clearConcept(val, inx, index, i); //清空医学标准术语
       this.clearNumText(val, inx, index, i); //清空数值、医学内容
       var index2 = this.baseTermTypeList.findIndex(item => item.type === val);
@@ -1072,6 +1032,9 @@ export default {
       // this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
       //   i
       // ].dataType = '';
+      this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
+        i
+      ].conceptList = [];
       if ((this.numTypes + ',').indexOf(val + ',') > -1) {
         this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
           i
@@ -1491,10 +1454,10 @@ export default {
     }
     .discDesc {
       margin-bottom: 20px;
-      .el-form-item__error {
+      /deep/ .el-form-item__error {
         top: 38px;
+        left: 100px !important;
         white-space: nowrap;
-        background: #fff;
       }
     }
     .el-popper[x-placement^='bottom'] {
@@ -1548,7 +1511,6 @@ export default {
           top: 38px;
           left: 10px;
           white-space: nowrap;
-          background: #fff;
         }
       }
       .last-box-s {
@@ -1557,14 +1519,12 @@ export default {
           top: 38px;
           left: 0px;
           white-space: nowrap;
-          background: #fff;
         }
       }
       /deep/ .el-form-item__error {
         top: 38px;
         left: 10px;
         white-space: nowrap;
-        background: #fff;
       }
       /deep/ .inp {
         width: 600px !important;
@@ -1606,9 +1566,6 @@ export default {
       color: #ff545b;
     }
   }
-  .description .el-form-item__error {
-    top: auto;
-  }
   .Butn {
     display: flex;
     justify-content: center;