reaper 4 lat temu
rodzic
commit
3abdf865a0
1 zmienionych plików z 12 dodań i 5 usunięć
  1. 12 5
      src/components/knowledgeExtra/AddNewRuleTable.vue

+ 12 - 5
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -113,13 +113,14 @@
       :header-row-style="{ background: '#E3EAF4' }"
       :cell-style="cellStyle"
       :span-method="ObjectSpanMethod"
+      ref="table"
     >
       <el-table-column width="80px" label="组" prop="groupType" fixed="left">
         <template slot-scope="scope">
           <div class="btn_box">
             <div class="btn_div">
               <img
-                @click="$emit('addGroup', null, { groupId: scope.row.groupId })"
+                @click="addGroup(scope)"
                 src="../../images/add-new-rule-sub.png"
                 alt=""
               />
@@ -145,9 +146,7 @@
           <div class="btn_box">
             <div class="btn_div" v-if="!isMax(scope.row.groupId)">
               <img
-                @click="
-                  $emit('addGroup', scope.row.groupId, { index: scope.$index })
-                "
+                @click="addChildGroup(scope)"
                 src="../../images/add-new-rule-sub.png"
                 alt=""
               />
@@ -399,7 +398,7 @@
                         validator: (rule, value, callback) => {
                           subMinValueRule(scope, rule, value, callback);
                         },
-                        trigger: [ 'blur']
+                        trigger: ['blur']
                       }
                     ]"
                   >
@@ -510,6 +509,14 @@ export default {
     };
   },
   methods: {
+    addGroup(scope) {
+      this.$emit("addGroup", null, { groupId: scope.row.groupId });
+      this.$refs.table.bodyWrapper.scrollLeft = 0;
+    },
+    addChildGroup(scope) {
+      this.$emit("addGroup", scope.row.groupId, { index: scope.$index });
+      this.$refs.table.bodyWrapper.scrollLeft = 0;
+    },
     // table 隔行换色
     rowStyle({ row }) {
       if (row.rowIndex % 2 == 0) {