Bladeren bron

fixbug 7773

reaper 4 jaren geleden
bovenliggende
commit
f8184ab4bc
2 gewijzigde bestanden met toevoegingen van 62 en 7 verwijderingen
  1. 4 0
      src/components/knowledgeExtra/AddNewRule.vue
  2. 58 7
      src/components/knowledgeExtra/AddNewRuleTable.vue

+ 4 - 0
src/components/knowledgeExtra/AddNewRule.vue

@@ -202,6 +202,7 @@
           @delGroupChild="delGroupChild"
           @setFormData="setFormData"
           @editKlRuleByIdSub="editKlRuleByIdSub"
+          @clearValidate="clearValidate"
         />
         <el-form-item>
           <div class="form_btn">
@@ -266,6 +267,9 @@ export default {
     }
   },
   methods: {
+    clearValidate(data){
+      this.$refs.ruleForm.clearValidate(data)
+    },
     // 编辑初始化
     async initEdidData() {
       // 规则术语类型初始化

+ 58 - 7
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -315,7 +315,7 @@
                         validator: (rule, value, callback) => {
                           subMaxOperator(scope, rule, value, callback);
                         },
-                        trigger: ['blur']
+                        trigger: ['change']
                       }
                     ]"
                   >
@@ -323,6 +323,7 @@
                       v-model="scope.row.subMaxOperator"
                       placeholder="请选择"
                       clearable
+                      @change="maxChange($event, scope.$index, 's')"
                       :ref="`klRuleByIdSub[${scope.$index}].subMaxOperator`"
                     >
                       <el-option
@@ -343,12 +344,14 @@
                         validator: (rule, value, callback) => {
                           subMaxValue(scope, rule, value, callback);
                         },
-                        trigger: ['blur']
+                        trigger: ['change']
                       }
                     ]"
                   >
                     <el-input
                       type="text"
+                      @input="maxChange($event, scope.$index, 'i')"
+                      :ref="`klRuleByIdSub[${scope.$index}].subMaxValue`"
                       v-model="scope.row.subMaxValue"
                       placeholder="填写数值"
                     />
@@ -384,7 +387,7 @@
                         validator: (rule, value, callback) => {
                           subMinOperatorRule(scope, rule, value, callback);
                         },
-                        trigger: ['blur']
+                        trigger: ['change']
                       }
                     ]"
                   >
@@ -393,6 +396,7 @@
                       placeholder="请选择"
                       clearable
                       :ref="`klRuleByIdSub[${scope.$index}].subMinOperator`"
+                      @change="minChange($event, scope.$index, 's')"
                     >
                       <el-option
                         v-for="item in operMinList"
@@ -412,12 +416,14 @@
                         validator: (rule, value, callback) => {
                           subMinValueRule(scope, rule, value, callback);
                         },
-                        trigger: ['blur']
+                        trigger: ['change']
                       }
                     ]"
                   >
                     <el-input
                       type="text"
+                      :ref="`klRuleByIdSub[${scope.$index}].subMinValue`"
+                      @input="minChange($event, scope.$index, 'i')"
                       v-model="scope.row.subMinValue"
                       placeholder="填写数值"
                     />
@@ -523,6 +529,52 @@ export default {
     };
   },
   methods: {
+    maxChange(e, val, type) {
+      console.log(e);
+      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
+      if (
+        type === "i" &&
+        this.klRuleByIdSub[val].subMaxOperator &&
+        this.klRuleByIdSub[val].subMaxOperator != ""
+      ) {
+        this.$emit("clearValidate", [
+          `klRuleByIdSub[${val}].subMinValue`,
+          `klRuleByIdSub[${val}].subMinOperator`
+        ]);
+      } else if (
+        type === "s" &&
+        this.klRuleByIdSub[val].subMaxValue &&
+        this.klRuleByIdSub[val].subMaxValue != ""
+      ) {
+        this.$emit("clearValidate", [
+          `klRuleByIdSub[${val}].subMinValue`,
+          `klRuleByIdSub[${val}].subMinOperator`
+        ]);
+      }
+    },
+    minChange(e, val, type) {
+      console.log(e);
+      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
+      if (
+        type === "i" &&
+        this.klRuleByIdSub[val].subMinOperator &&
+        this.klRuleByIdSub[val].subMinOperator != ""
+      ) {
+        this.$emit("clearValidate", [
+          `klRuleByIdSub[${val}].subMaxOperator`,
+          `klRuleByIdSub[${val}].subMaxValue`
+        ]);
+      } else if (
+        type === "s" &&
+        this.klRuleByIdSub[val].subMinValue &&
+        this.klRuleByIdSub[val].subMinValue != ""
+      ) {
+        this.$emit("clearValidate", [
+          `klRuleByIdSub[${val}].subMaxOperator`,
+          `klRuleByIdSub[${val}].subMaxValue`
+        ]);
+      }
+    },
     addGroup(scope) {
       this.$emit("addGroup", null, { groupId: scope.row.groupId });
       this.$refs.table.bodyWrapper.scrollLeft = 0;
@@ -635,7 +687,6 @@ export default {
     clearNumText(index) {
       let obj = JSON.parse(JSON.stringify(this.klRuleByIdSub));
 
-
       obj[index].subMaxOperator = "";
       obj[index].subMaxValue = "";
       obj[index].subMaxUnit = "";
@@ -646,7 +697,7 @@ export default {
       // this.$set(obj[index], "subEqValue", "");
       obj[index].subEqOperator = "";
       // this.klRuleByIdSub = obj;
-      this.$emit('editKlRuleByIdSub',obj)
+      this.$emit("editKlRuleByIdSub", obj);
     },
     //医学标准术语change
     subConceptIdfocus(index) {
@@ -675,7 +726,7 @@ export default {
         });
     },
     dataTypeChange(val, index) {
-      console.log(val,index);
+      console.log(val, index);
       this.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
       this.clearNumText(index);
       // TODO 新增的内容追踪不到