<el-table :data="tableData" stripe border style=" 100%" @selection-change="changeFun"> //这里做一个事件 checkbox发生改变时触发
<el-table-column type="selection" width="55" ref="multipleTable"></el-table-column>
<el-table-column prop="index" label="序号" width="180"></el-table-column>
<el-table-column prop="flowmeterType" label="设备类型"></el-table-column>
<el-table-column prop="flowmeterNo" label="设备编号"></el-table-column>
<el-table-column prop="flowmeterModel" label="设备型号"></el-table-column>
<el-table-column prop="userName" label="用户姓名"></el-table-column>
<el-table-column prop="phone" label="联系方式"></el-table-column>
<el-table-column prop="installationLocation" label="所属小区"></el-table-column>
<el-table-column prop="regionMap.level1" label="所属二级分区"></el-table-column>
<el-table-column prop="regionMap.level2" label="所属一级分区"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改</el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
data{
return {
multipleSelection: [] //返回的是选中的列的数组集合 这里接收用户选中的id 默认放在这个数组里面
}
}
methods: {
changeFun(val) { //获取用户的选中
console.log(val);
//this.multipleSelection = val // 返回的是选中的列的数组集合
val.forEach(item => {
this.multipleSelection.push(item.flowmeterId); //把所有的id放进multipleSelection
})
console.log(this.multipleSelection)
},
PLdelete() { //批量删除流量计
console.log(this.multipleSelection)
this.$ajax.delete("/dataManagement/basic/deletedBatch",{flowmeterIds:this.multipleSelection})
.then(res => {
console.log(res);
})
},