效果图
//添加电站
addStation(){
this.stationpower.map(v=>{
this.tableData.push(v);
let arr=this.tableData
console.log(arr) //添加的电站-已放到右边
let newArr=[];
//去重
for(var i=0;i<arr.length;i++){
for(var j=i+1;j<arr.length;j++){
if(arr[i].buildName===arr[j].buildName){
console.log((arr[i]));
console.log((arr[i].buildId));
i++;
j=i
}
}
newArr.push(arr[i])
}
console.log(newArr)
this.tableData=newArr; //右边的电站
})
},
//获取电站数据
searchBuildsClick() {
this.$post(selectBuildByPower, {
page: 1,
size: 50000,
provinceCode: this.provinceCode,
cityCode: this.cityCode,
buildName:this.formInline.buildName,
buildStatus:this.formInline.buildStatus,
})
.then((res) => {
if (res.data.status == 1) {
this.StiontableData = res.data.rows;
}
this.$nextTick(()=>{
this.StiontableData.forEach(item=>{
this.tableData.forEach(row => {
if(item.buildName == row.buildName){
this.$refs.multipleTable.toggleRowSelection(item,true);
}
});
})
})
})
.catch((err) => {});
},