6f5dcc4a by 杨威

幢单元下的户全选和清除

1 parent 99f1ad87
......@@ -36,7 +36,8 @@
<!-- 幢单元名称 -->
<div class="zdy-name name">
<p>
{{ zdys.zdymc }}
<!-- {{ zdys.zdymc }} -->
<el-checkbox @change='zdySelectAll($event,zdys.cs)'>{{ lpbData.xmmc }}</el-checkbox>
</p>
</div>
......@@ -171,7 +172,8 @@
<!-- 幢单元名称 -->
<div class="zdy-name name">
<p>
{{ zdys.zdymc }}
<!-- {{ zdys.zdymc }} -->
<el-checkbox @change='zdySelectAll($event,zdys.cs)'>{{ lpbData.xmmc }}</el-checkbox>
</p>
</div>
<!-- 循环幢单元下的层户 -->
......@@ -957,8 +959,8 @@ export default {
this.hcxlzVisible = true
},
//楼盘表户全选
lpbSelectAll(value){
if(value){
lpbSelectAll(val){
if(val){
this.$refs.hBsm.forEach((item) => {
item.className = "tdSelect";
this.hbsmList.push(item.dataset.bsm); // 将户bsm放进hbsmList
......@@ -969,6 +971,40 @@ export default {
this.hbsmList = [];
});
}
},
//幢单元全选
zdySelectAll(val,cs){
let zdyHbsmList = [];
cs.forEach(i=>{
i.hs.forEach(j=>{
zdyHbsmList.push(j.bsm)
})
});
if (val) {
this.$nextTick(()=>{
console.log(zdyHbsmList);
this.$refs.hBsm.forEach((item) => {
console.log(item.dataset.bsm);
if (zdyHbsmList.indexOf(item.dataset.bsm)>-1) {
item.className = "tdSelect";
this.hbsmList = zdyHbsmList; // 将户bsm放进hbsmList
}
});
})
}else{
this.$refs.hBsm.forEach((item) => {
console.log(item.dataset.bsm);
if (zdyHbsmList.indexOf(item.dataset.bsm)>-1) {
item.className = "";
}
zdyHbsmList.forEach(j=>{
if (item.dataset.bsm == j) {
this.hbsmList = this.hbsmList.filter(i=>i!=j)
}
})
});
}
}
},
computed: {
......