Browse Source

fixbug: 7732 7724 7725

reaper 4 years ago
parent
commit
26dba0998e

+ 20 - 1
src/components/knowledgeExtra/AddNewRule.vue

@@ -184,7 +184,7 @@
               type="primary"
               size="medium "
               @click="submitForm('ruleForm')"
-              >立即创建</el-button
+              >确定</el-button
             >
           </div>
         </el-form-item>
@@ -323,6 +323,7 @@ export default {
           params.klRuleInfoSaveSub.forEach((ite) => {
             delete ite.groupId;
             delete ite.groupChildId;
+            delete ite.rowIndex;
             delete ite.baseTypes;
             delete ite.baseTermTypeList;
             delete ite.conceptList;
@@ -595,6 +596,24 @@ export default {
       });
     }
   },
+  watch: {
+    "form.klRuleByIdSub": {
+      handler(val) {
+        console.log("000000000");
+        this.form.klRuleByIdSub.forEach((item, i, arr) => {
+          if (i == 0) {
+            item.rowIndex = 1;
+          } else if (item.groupId == arr[i - 1].groupId) {
+            item.rowIndex = arr[i - 1].rowIndex;
+          } else {
+            item.rowIndex = arr[i - 1].rowIndex + 1;
+          }
+        });
+        console.log(this.form.klRuleByIdSub);
+      },
+      deep: true
+    }
+  },
   computed: {
     disable: function () {
       return Object.keys(this.firstPlace || {}).length > 0;

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

@@ -68,6 +68,9 @@
         }
       }
     }
+    /deep/ .el-input.is-disabled .el-input__inner {
+      color: #888;
+    }
   }
   .custom_table_header {
     vertical-align: middle;
@@ -78,19 +81,26 @@
       margin-right: 4px;
     }
   }
+  ::v-deep .el-table tbody tr:hover > td {
+    background-color: transparent;
+  }
+  /deep/ .el-table th {
+    background: transparent;
+  }
 }
 </style>
 
 <template>
   <!-- :prop="`klRuleByIdSub[${scope.$index}].subDescription`" -->
   <div class="AddNewRuleTable">
-    <h4 style="marginbottom: 20px">规则内容</h4>
+    <h4 style="margin-bottom: 20px">规则内容</h4>
     <el-table
       border
       :data="klRuleByIdSub"
       style="width: 100%"
       size="mini"
-      stripe
+      :row-style="rowStyle"
+      :header-row-style="{ background: '#E3EAF4' }"
       :span-method="ObjectSpanMethod"
     >
       <el-table-column width="80px" label="组" prop="groupType">
@@ -103,10 +113,9 @@
                 alt=""
               />
             </div>
-            <div class="btn_div">
+            <div class="btn_div" v-if="!isLastDate(scope.row.groupId)">
               <img
                 @click="$emit('delGroup', scope.row.groupId)"
-                v-if="!isLastDate(scope.row.groupId)"
                 src="../../images/add-new-rule-del.png"
                 alt=""
               />
@@ -122,9 +131,8 @@
       >
         <template slot-scope="scope">
           <div class="btn_box">
-            <div class="btn_div">
+            <div class="btn_div" v-if="!isMax(scope.row.groupId)">
               <img
-                v-if="!isMax(scope.row.groupId)"
                 @click="
                   $emit('addGroup', scope.row.groupId, { index: scope.$index })
                 "
@@ -132,10 +140,12 @@
                 alt=""
               />
             </div>
-            <div class="btn_div">
+            <div
+              class="btn_div"
+              v-if="klRuleByIdSub.length > 1 && !scope.row.disabled"
+            >
               <img
                 @click="$emit('delGroupChild', scope.row.groupChildId)"
-                v-if="klRuleByIdSub.length > 1 && !scope.row.disabled"
                 src="../../images/add-new-rule-del.png"
                 alt=""
               />
@@ -481,6 +491,14 @@ export default {
     };
   },
   methods: {
+    // table 隔行换色
+    rowStyle({ row }) {
+      if (row.rowIndex % 2 == 0) {
+        return {
+          background: "#DFF7EF"
+        };
+      }
+    },
     // 最大值 选择rule
     subMaxOperator(scope, rule, value, callback) {
       const { subMaxValue, subMinOperator, subMinValue } = scope.row;