Quellcode durchsuchen

修改 增加行

秦鹏 vor 3 Jahren
Ursprung
Commit
d468673a21
1 geänderte Dateien mit 62 neuen und 2 gelöschten Zeilen
  1. 62 2
      src/views/adultInput.vue

+ 62 - 2
src/views/adultInput.vue

@@ -617,8 +617,24 @@
                 </div>
               </template>
             </div>
-            <div class="addoption" @click="removeRow(rowIndex, toindex)">
-              删除当前行
+            <div style="display: flex">
+              <div class="addoption" @click="removeRow(rowIndex, toindex)">
+                删除当前行
+              </div>
+              <div
+                style="margin-left: 10px"
+                @click="addRow('front', rowIndex, toindex)"
+                class="addoption"
+              >
+                在当前行前增加行
+              </div>
+              <div
+                style="margin-left: 10px"
+                @click="addRow('behind', rowIndex, toindex)"
+                class="addoption"
+              >
+                在当前行后增加行
+              </div>
             </div>
           </div>
         </div>
@@ -940,6 +956,50 @@ export default {
   activated() {},
   // 方法集合
   methods: {
+    // 增加列
+    addCol(tyoe,rowindex,colindex,toindex){
+    
+    },
+    // 添加行
+    addRow(type, rowindex, toindex) {
+      let arr = [
+        {
+          text: ``,
+          is_add_module: true,
+          is_edit: true,
+        },
+      ];
+      if (type == "front") {
+        //  加到当前行前面
+        if (rowindex == 0) {
+          this.question_list.cur_fn_data[toindex].table_list.splice(0, 0, arr);
+        } else {
+          this.question_list.cur_fn_data[toindex].table_list.splice(
+            rowindex - 1,
+            0,
+            arr
+          );
+        }
+      } else {
+        //  加到当前行后面
+        this.question_list.cur_fn_data[toindex].table_list.splice(
+          rowindex + 1,
+          0,
+          arr
+        );
+      }
+      this.question_list.cur_fn_data[toindex].table_list.forEach(
+        (item, rowIndex) => {
+          item.forEach((it, colIndex) => {
+            it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
+          });
+        }
+      );
+      this.TopicIndex = null;
+      this.RowIndex = null;
+      this.LineIndex = null;
+      this.$forceUpdate();
+    },
     // 删除行
     removeRow(index, toindex) {
       // 里面是不是剩下最后一行了