作者 RuoYi

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

@@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
108 plain 108 plain
109 icon="el-icon-download" 109 icon="el-icon-download"
110 size="mini" 110 size="mini"
111 - :loading="exportLoading" 111 + :loading="exportLoading"
112 @click="handleExport" 112 @click="handleExport"
113 v-hasPermi="['${moduleName}:${businessName}:export']" 113 v-hasPermi="['${moduleName}:${businessName}:export']"
114 >导出</el-button> 114 >导出</el-button>
@@ -573,19 +573,18 @@ export default { @@ -573,19 +573,18 @@ export default {
573 /** ${subTable.functionName}删除按钮操作 */ 573 /** ${subTable.functionName}删除按钮操作 */
574 handleDelete${subClassName}() { 574 handleDelete${subClassName}() {
575 if (this.checked${subClassName}.length == 0) { 575 if (this.checked${subClassName}.length == 0) {
576 - this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", }); 576 + this.msgError("请先选择要删除的${subTable.functionName}数据");
577 } else { 577 } else {
578 - this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1); 578 + const ${subclassName}List = this.${subclassName}List;
  579 + const checked${subClassName} = this.checked${subClassName};
  580 + this.${subclassName}List = ${subclassName}List.filter(function(item) {
  581 + return checked${subClassName}.indexOf(item.index) == -1
  582 + });
579 } 583 }
580 }, 584 },
581 - /** 选框选中数据 */ 585 + /** 选框选中数据 */
582 handle${subClassName}SelectionChange(selection) { 586 handle${subClassName}SelectionChange(selection) {
583 - if (selection.length > 1) {  
584 - this.$refs.${subclassName}.clearSelection();  
585 - this.$refs.${subclassName}.toggleRowSelection(selection.pop());  
586 - } else {  
587 - this.checked${subClassName} = selection;  
588 - } 587 + this.checked${subClassName} = selection.map(item => item.index)
589 }, 588 },
590 #end 589 #end
591 /** 导出按钮操作 */ 590 /** 导出按钮操作 */