Bläddra i källkod

首页增加删除行的功能

秦鹏 3 år sedan
förälder
incheckning
f992bdc36a
1 ändrade filer med 21 tillägg och 0 borttagningar
  1. 21 0
      src/views/adultInput.vue

+ 21 - 0
src/views/adultInput.vue

@@ -593,6 +593,9 @@
                 </div>
               </template>
             </div>
+            <div class="addoption" @click="removeRow(rowIndex, toindex)">
+              删除当前行
+            </div>
           </div>
         </div>
         <!-- </el-tab-pane> -->
@@ -884,6 +887,24 @@ export default {
   activated() {},
   // 方法集合
   methods: {
+    // 删除行
+    removeRow(index, toindex) {
+      // 里面是不是剩下最后一行了
+      if (this.question_list.cur_fn_data[toindex].table_list.length == 1) {
+        this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
+        this.question_list.cur_fn_data.splice(toindex, 1);
+      } else {
+        this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
+      }
+      this.question_list.cur_fn_data[toindex].table_list.forEach(
+        (item, rowIndex) => {
+          item.forEach((it, colIndex) => {
+            it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
+          });
+        }
+      );
+      this.$forceUpdate();
+    },
     changeCurrentTreeID(val) {
       this.currentTreeID = val;
     },