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

This commit is contained in:
RuoYi 2021-08-13 14:50:35 +08:00
parent 3003bb0f50
commit f02743bde5
1 changed files with 9 additions and 10 deletions

View File

@ -108,7 +108,7 @@
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
:loading="exportLoading" :loading="exportLoading"
@click="handleExport" @click="handleExport"
v-hasPermi="['${moduleName}:${businessName}:export']" v-hasPermi="['${moduleName}:${businessName}:export']"
>导出</el-button> >导出</el-button>
@ -573,19 +573,18 @@ export default {
/** ${subTable.functionName}删除按钮操作 */ /** ${subTable.functionName}删除按钮操作 */
handleDelete${subClassName}() { handleDelete${subClassName}() {
if (this.checked${subClassName}.length == 0) { if (this.checked${subClassName}.length == 0) {
this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", }); this.msgError("请先选择要删除的${subTable.functionName}数据");
} else { } else {
this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1); const ${subclassName}List = this.${subclassName}List;
const checked${subClassName} = this.checked${subClassName};
this.${subclassName}List = ${subclassName}List.filter(function(item) {
return checked${subClassName}.indexOf(item.index) == -1
});
} }
}, },
/** 单选框选中数据 */ /** 选框选中数据 */
handle${subClassName}SelectionChange(selection) { handle${subClassName}SelectionChange(selection) {
if (selection.length > 1) { this.checked${subClassName} = selection.map(item => item.index)
this.$refs.${subclassName}.clearSelection();
this.$refs.${subclassName}.toggleRowSelection(selection.pop());
} else {
this.checked${subClassName} = selection;
}
}, },
#end #end
/** 导出按钮操作 */ /** 导出按钮操作 */