31935291 by 杨威

层选中事件

1 parent d2ab41b3

878 Bytes | W: | H:

1.34 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
......@@ -372,6 +372,7 @@ export default {
lpbContentwidth: "",
time: "",
dyztBsmList: {}, //单元状态bsmList
cbsmList:[], // 层bsmlist
};
},
created() {
......@@ -484,6 +485,11 @@ export default {
}
console.log(this.bsms);
},
//获取选中层bsmlist
getCbsm(data){
this.cbsmList = data;
console.log(this.cbsmList);
},
//不动产单元号输入框事件
inputFocus() {
this.inputWidth = 200;
......
......@@ -12,7 +12,7 @@
<table class="chTable" border="1" cellspacing="0" cellpadding="0" v-show="zdys.cs.length>0">
<tr v-for="(cs,csIndex) in zdys.cs" :key="csIndex">
<!-- 显示层数 -->
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')">{{cs.sjc}}</td>
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')" @click="handleClickC($event,cs)">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :data-bsm="hs.bsm" ref="hBsm" :key="hsIndex" :class="(searchNum == hs.shbw || searchNum == hs.bdcdyh) ? 'tdSelect':''" @click="handleTdClick($event,hs.bsm)" @dblclick="dbclick(hs.bsm)" @contextmenu.prevent="openMenu($event, hs,'h')">{{hs.shbw}}</td>
</tr>
......@@ -28,7 +28,7 @@
<table class="chTable" border="1" cellspacing="0" cellpadding="0">
<tr v-for="(cs) in ljzs.cs" :key="cs.bsm">
<!-- 显示层数 -->
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')">{{cs.sjc}}</td>
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')" @click="handleClickC($event,cs)">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :data-bsm="hs.bsm" ref="hBsm" :key="hsIndex" :class="(searchNum == hs.shbw || searchNum == hs.bdcdyh) ? 'tdSelect':''" @click="handleTdClick($event,hs.bsm)" @dblclick="dbclick(hs.bsm)" @contextmenu.prevent="openMenu($event, hs,'h')">{{hs.shbw}}</td>
</tr>
......@@ -53,7 +53,7 @@
<table class="chTable" border="1" cellspacing="0" cellpadding="0" v-show="zdys.cs.length>0">
<tr v-for="(cs,csIndex) in zdys.cs" :key="csIndex">
<!-- 显示层数 -->
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')">{{cs.sjc}}</td>
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')" @click="handleClickC($event,cs)">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :data-bsm="hs.bsm" ref="hBsm" :key="hsIndex" :class="(searchNum == hs.shbw || searchNum == hs.bdcdyh) ? 'tdSelect':''" @click="handleTdClick($event,hs.bsm)" @dblclick="dbclick(hs.bsm)" @contextmenu.prevent="openMenu($event, hs,'h')">{{hs.shbw}}</td>
</tr>
......@@ -65,7 +65,7 @@
<table class="chTable" ref="ch" border="1" cellspacing="0" cellpadding="0" v-show="lpbData.cs != null && lpbData.cs.length>0" >
<tr v-for="(cs,csIndex) in lpbData.cs" :key="csIndex">
<!-- 显示层数 -->
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')">{{cs.sjc}}</td>
<td class="floor" @contextmenu.prevent="openMenu($event, cs,'c')" @click="handleClickC($event,cs)">{{cs.sjc}}</td>
<!-- 显示户 -->
<td v-for="(hs,hsIndex) in cs.hs" :data-bsm="hs.bsm" ref="hBsm" :key="hsIndex" :class="(searchNum == hs.shbw || searchNum == hs.bdcdyh) ? 'tdSelect':''" @click="handleTdClick($event,hs.bsm)" @dblclick="dbclick(hs.bsm)" @contextmenu.prevent="openMenu($event, hs,'h')">{{hs.shbw}}</td>
</tr>
......@@ -117,6 +117,7 @@ export default {
ljzzdyHeight: 0, //逻辑幢下幢单元的div高度
loading: true,
hbsmList: [],
cbsmList:[],
time: null, //区分单双击事件的定时器
searchNum: Math.random(),
//接收父组件传入的根据单元状态/房屋性质/房屋用途筛选的户bsmList
......@@ -278,6 +279,7 @@ export default {
},
//户右键点击事件
openMenu(e,item,type){
debugger
console.log(e,'e');
this.lpbChLeft = e.pageX;
this.lpbChTop = e.pageY;
......@@ -285,6 +287,20 @@ export default {
this.rightClickFlag = type;
this.lpbChVisible = true;
},
// 层选中事件
handleClickC(e,item){
//判断点击的层是否选中
if (e.target.className.indexOf("tdSelect") == -1) {
//未选中→选中
e.target.className += " tdSelect"; //加边框
this.cbsmList.push(item.bsm); // 将户bsm放进hbsmList
} else {
//选中→未选中
e.target.className = "floor";
this.deleteArrOption(this.cbsmList,item.bsm);
}
this.$parent.getCbsm(this.cbsmList);
},
//关闭右键菜单
closeMenu(){
this.lpbChVisible = false
......@@ -485,6 +501,7 @@ export default {
background-image: url("../../../../../assets/tdSelect.png");
background-repeat: no-repeat;
background-position: right top;
background-size: 30px;
}
}
}
......