reaper před 4 roky
rodič
revize
27752c1513

+ 17 - 14
src/components/knowledgeExtra/AddNewRule.vue

@@ -42,10 +42,10 @@
   .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
-  /deep/ .el-form-item.is-success .el-textarea__inner{
+  /deep/ .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
-  /deep/ .el-form-item.is-success .el-textarea__inner{
+  /deep/ .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
 }
@@ -192,6 +192,7 @@
         </div>
         <!-- 表格 -->
         <AddNewRuleTable
+          ref="tableView"
           v-if="form.parHasSub && tableShow"
           :klRuleByIdSub="form.klRuleByIdSub"
           :maxNum="subRuleMaxNum"
@@ -267,8 +268,8 @@ export default {
     }
   },
   methods: {
-    clearValidate(data){
-      this.$refs.ruleForm.clearValidate(data)
+    clearValidate(data) {
+      this.$refs.ruleForm.clearValidate(data);
     },
     // 编辑初始化
     async initEdidData() {
@@ -570,6 +571,9 @@ export default {
         });
         this.form.klRuleByIdSub.splice(i + 1, 0, obj);
       }
+      this.$nextTick(() => {
+        this.$refs.tableView.scrollFun();
+      });
     },
     // 删除分组
     delGroup(groupId) {
@@ -656,16 +660,16 @@ export default {
       },
       deep: true
     },
-    "form.parHasSub"(val) {
-      console.log(val);
-      console.log(this.form);
-      // if (!val || val == 0) {
-      //   // this.form.klRuleByIdSub = [];
-      //   this.$set(this.form, "klRuleByIdSub", []);
+    // "form.parHasSub"(val) {
+    //   console.log(val);
+    //   console.log(this.form);
+    //   // if (!val || val == 0) {
+    //   //   // this.form.klRuleByIdSub = [];
+    //   //   this.$set(this.form, "klRuleByIdSub", []);
 
-      //   console.log(this.form);
-      // }
-    }
+    //   //   console.log(this.form);
+    //   // }
+    // }
   },
   computed: {
     disable: function () {
@@ -679,7 +683,6 @@ export default {
       return str;
     },
     showMsg: function () {
-      console.log(this.ruleTermCodeStr, "???", this.msgDict);
       return (
         this.ruleTermCodeStr.length > 2 &&
         this.msgDict.indexOf(this.ruleTermCodeStr) > -1

+ 18 - 8
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -116,7 +116,7 @@
       :data="klRuleByIdSub"
       size="mini"
       style="min-height: 200px"
-      height="calc(100vh - 383px)"
+      height="calc(100vh - 393px)"
       :header-row-style="{ background: '#E3EAF4' }"
       :cell-style="cellStyle"
       :span-method="ObjectSpanMethod"
@@ -364,6 +364,7 @@
                   >
                     <el-input
                       type="text"
+                      @focus="setScrollRight"
                       v-model.trim="scope.row.subMaxUnit"
                       placeholder="填写单位"
                     />
@@ -436,6 +437,7 @@
                   >
                     <el-input
                       type="text"
+                      @focus="setScrollRight"
                       v-model.trim="scope.row.subMinUnit"
                       placeholder="填写单位"
                     />
@@ -447,7 +449,7 @@
             <el-form-item
               class="type_content_item"
               style="flex: 2"
-              v-show="scope.row.subType !== 6 && scope.row.dataType === '2'"
+              v-if="scope.row.subType !== 6 && scope.row.dataType === '2'"
               label="医学内容:"
               label-width="100px"
               :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
@@ -469,6 +471,7 @@
                 type="textarea"
                 rows="1"
                 placeholder="请输入医学内容"
+                @focus="setScrollRight"
                 v-model.trim="scope.row.subEqValue"
               ></el-input>
             </el-form-item>
@@ -478,7 +481,7 @@
               label="正则表达式:"
               label-width="120px"
               style="flex: 2"
-              v-show="scope.row.subType === 6"
+              v-if="scope.row.subType === 6"
               :prop="`klRuleByIdSub[${scope.$index}].subEqValue1`"
               :rules="[
                 {
@@ -498,6 +501,7 @@
                 type="textarea"
                 rows="1"
                 placeholder="请输入正则表达式"
+                @focus="setScrollRight"
                 v-model.trim="scope.row.subEqValue"
               ></el-input>
             </el-form-item>
@@ -529,9 +533,12 @@ export default {
     };
   },
   methods: {
+    setScrollRight() {
+      this.$nextTick(() => {
+        this.$refs.table.bodyWrapper.scrollLeft = this.$refs.table.bodyWrapper.scrollWidth;
+      });
+    },
     maxChange(e, val, type) {
-      console.log(e);
-      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
       if (
         type === "i" &&
         this.klRuleByIdSub[val].subMaxOperator &&
@@ -551,10 +558,9 @@ export default {
           `klRuleByIdSub[${val}].subMinOperator`
         ]);
       }
+      this.setScrollRight()
     },
     minChange(e, val, type) {
-      console.log(e);
-      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
       if (
         type === "i" &&
         this.klRuleByIdSub[val].subMinOperator &&
@@ -574,6 +580,7 @@ export default {
           `klRuleByIdSub[${val}].subMaxValue`
         ]);
       }
+      this.setScrollRight()
     },
     addGroup(scope) {
       this.$emit("addGroup", null, { groupId: scope.row.groupId });
@@ -583,6 +590,10 @@ export default {
       this.$emit("addGroup", scope.row.groupId, { index: scope.$index });
       this.$refs.table.bodyWrapper.scrollLeft = 0;
     },
+    scrollFun() {
+      this.$refs.table.bodyWrapper.scrollTop =
+        this.$refs.table.bodyWrapper.scrollTop + 60;
+    },
     // table 隔行换色
     // rowStyle({ row }) {
     //   if (row.rowIndex % 2 == 0) {
@@ -726,7 +737,6 @@ export default {
         });
     },
     dataTypeChange(val, index) {
-      console.log(val, index);
       this.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
       this.clearNumText(index);
       // TODO 新增的内容追踪不到