elementui多层嵌套表格循环删除表格选中项
<el-collapse-transition>
<div v-show="isUnfoldProfessional"> <el-table
:data="formData.budgetTypes[0].budgetLines"
style="width: 100%"
>
<el-table-column type="expand"
>value)
<template slot-scope="props">
<div class="bl">
<div class="bl-head">
<el-button
plain
class="tl-btn amt-border-fadeout"
@click="
deletSubject(
props.row.budgetSubjects,
props.row.oid
)
"
>删除科目</el-button
>
<el-button
type="primary"
class="tl-btn amt-bg-slip"
@click="addSubject(props.row.budgetSubjects)"
>新增科目</el-button
>
</div>
<el-table
ref="multipleTable"
:data="props.row.budgetSubjects"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection">
</el-table-column>
<el-table-column label="序号">
<template slot-scope="scope">
{{ scope.$index }}
</template>
</el-table-column>
<el-table-column label="科目名称">
<template slot-scope="scope">
<el-input
v-model="scope.row.subjectName"
></el-input>
</template>
</el-table-column>
<el-table-column label="预算(元)">
<template slot-scope="scope">
<el-input
v-model="scope.row.budgetAmount"
></el-input>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="序号" prop="oid"> </el-table-column>
<el-table-column label="部门名称" prop="itemName">
</el-table-column>
<el-table-column label="预算">
<template slot-scope="props">
<el-input v-model="props.row.budgetAmount"></el-input>
</template>
</el-table-column>
<el-table-column label="二级部门负责人" prop="desc">
</el-table-column>
<el-table-column label="部门综合岗人员"> </el-table-column>
</el-table>
</div>
</el-collapse-transition>
//删除
deletSubject(value, oid) {
console.log(value, oid); if (this.multipleSelection.length > 0) {
this.multipleSelection.forEach((item) => {
value.forEach((itemI, indexI) => {
if (item.id === itemI.id) {
value.splice(indexI, 1);
}
});
});
} else {
this.$message('还没有选择任何选项');
}
},
// 选择科目列表
handleSelectionChange(val) { this.multipleSelection = val;
console.log(val, event);
},
直接上代码.循环出的表格用了一个删除和监听变动方法当第一个表格选中不点击删除到第二个表格删除的时候就会把第二个表格的数据删掉如何解决求大神相救
以上是 elementui多层嵌套表格循环删除表格选中项 的全部内容, 来源链接: utcz.com/p/936477.html