Przeglądaj źródła

代码生成主子表多选行数据

RuoYi 4 lat temu
rodzic
commit
0e7c45173c

+ 8 - 9
ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm

@@ -570,19 +570,18 @@ export default {
570 570
     /** ${subTable.functionName}删除按钮操作 */
571 571
     handleDelete${subClassName}() {
572 572
       if (this.checked${subClassName}.length == 0) {
573
-        this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", });
573
+        this.msgError("请先选择要删除的${subTable.functionName}数据");
574 574
       } else {
575
-        this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1);
575
+        const ${subclassName}List = this.${subclassName}List;
576
+        const checked${subClassName} = this.checked${subClassName};
577
+        this.${subclassName}List = ${subclassName}List.filter(function(item) {
578
+          return checked${subClassName}.indexOf(item.index) == -1
579
+        });
576 580
       }
577 581
     },
578
-    /** 单选框选中数据 */
582
+    /** 选框选中数据 */
579 583
     handle${subClassName}SelectionChange(selection) {
580
-      if (selection.length > 1) {
581
-        this.$refs.${subclassName}.clearSelection();
582
-        this.$refs.${subclassName}.toggleRowSelection(selection.pop());
583
-      } else {
584
-        this.checked${subClassName} = selection;
585
-      }
584
+      this.checked${subClassName} = selection.map(item => item.index)
586 585
     },
587 586
 #end
588 587
     /** 导出按钮操作 */