c2779c29 by 杨威

添加户的单击事件,获取选中的户bsm

1 parent 5ca85dc2
......@@ -290,6 +290,11 @@ export default {
legendToggle() {
this.legendToggleFlag = !this.legendToggleFlag;
},
//获取选中户bsm
getHbsm(data){
this.bsms = data;
// console.log(this.bsms);
}
},
computed: {
},
......
......@@ -13,7 +13,7 @@
<!-- 显示层数 -->
<td class="floor">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex">{{hs.hh}}</td>
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex" @click="handleTdClick($event,hs.bsm)">{{hs.hh}}</td>
</tr>
</table>
<!-- 幢单元名称 -->
......@@ -37,7 +37,7 @@
<!-- 显示层数 -->
<td class="floor">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex">{{hs.hh}}</td>
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex" @click="handleTdClick($event,hs.bsm)">{{hs.hh}}</td>
</tr>
</table>
<!-- 幢单元名称 -->
......@@ -53,7 +53,7 @@
<!-- 显示层数 -->
<td class="floor">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex">{{hs.hh}}</td>
<td v-for="(hs,hsIndex) in cs.hs" :key="hsIndex" @click="handleTdClick($event,hs.bsm)">{{hs.hh}}</td>
</tr>
</table>
</div>
......@@ -376,7 +376,8 @@ export default {
ljzWidth:10000,
zdyWidth:2000,
cHeight:0,
loading:true
loading:true,
hbsmList:[]
};
},
created() {
......@@ -396,10 +397,7 @@ export default {
getLpb(zrzbsm)
.then((res => {
if (res.code == 200) {
// console.log(this.lpbData,'前');
this.lpbData = res.result;
// this.lpbData.zdys.push(this.lpbData.zdys)
// console.log(this.lpbData,'后');
setTimeout(() => {
//计算逻辑幢宽度 20为marginRight值
this.ljzWidth -= 9980;
......@@ -422,7 +420,29 @@ export default {
});
}
}))
},
//td点击事件
handleTdClick(e,bsm){
//判断点击的户是否选中
if(e.target.className.indexOf('tdSelect') == -1){
//未选中
e.target.className = 'tdSelect'; //加边框
this.hbsmList.push(bsm) // 将户bsm放进hbsmList
}else{
//选中
e.target.className = '';
this.deleteArrOption(this.hbsmList,bsm);
}
this.$parent.getHbsm(this.hbsmList);
},
//删除多重数组中的某一项
deleteArrOption(arr, item) {
for (var i = arr.length; i > 0; i--) {
if (arr[i - 1] == item) {
arr.splice(i - 1, 1);
}
}
},
},
computed: {
createFlagChange() {
......@@ -536,6 +556,9 @@ export default {
line-height: 64px;
text-align: center;
}
.tdSelect{
border: 1px solid #0091FF!important;
}
}
}
.name{
......