<script>
export default {
data(){
return{
multipleSelection:[],
selectAllNum:0
}
},
watch: {
multipleSelection(newValue){
console.log(newValue);
if(newValue.length === this.tableData.length){
this.excludes();
}
}
},
methods:{
handleSelectionAll(val){
this.$refs.ewTable.clearSelection();
this.selectAllNum++;
if((this.selectAllNum)%2===0){
this.$refs.ewTable.clearSelection();
}else{
this.multipleSelection = val;
}
console.log(this.multipleSelection);
},
excludes(){
if(this.multipleSelection.length > 0){
let notOverhulaedList = this.multipleSelection.filter(item=>{
return item["检修状态"]==="未检修";
})
// console.log(notOverhulaedList);
this.toggleSelection(notOverhulaedList);
}else{
this.toggleSelection();
}
},
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.ewTable.toggleRowSelection(row);
});
// 全选选中的未处理的数据
this.notFishedList = rows;
} else {
this.$refs.ewTable.clearSelection();
}
},
}
}
</script>
el-table点击全选框只选择部分行
最新推荐文章于 2024-08-04 10:53:30 发布