a53bda53 by 杨威

户选中效果修改

1 parent 6a96103d
...@@ -83,9 +83,8 @@ ...@@ -83,9 +83,8 @@
83 </div> 83 </div>
84 </div> 84 </div>
85 </template> 85 </template>
86
87 <script> 86 <script>
88 import {getLpb} from "../../../../../api/lpb" 87 import { getLpb } from "../../../../../api/lpb";
89 export default { 88 export default {
90 name: "", 89 name: "",
91 components: {}, 90 components: {},
...@@ -93,47 +92,48 @@ export default { ...@@ -93,47 +92,48 @@ export default {
93 data() { 92 data() {
94 return { 93 return {
95 lpbData: { 94 lpbData: {
96 ljzs:[], 95 ljzs: [],
97 cs:[], 96 cs: [],
98 zdys:[] 97 zdys: [],
99 }, 98 },
100 lpbContentWidth: "", 99 lpbContentWidth: "",
101 ljzWidth:10000, 100 ljzWidth: 10000,
102 zdyWidth:1000, 101 zdyWidth: 1000,
103 cHeight:0, //独立层户的div高度 102 cHeight: 0, //独立层户的div高度
104 zdyHeight:0, //独立幢单元的div高度 103 zdyHeight: 0, //独立幢单元的div高度
105 ljzcHeight:0, //逻辑幢下层户的div高度 104 ljzcHeight: 0, //逻辑幢下层户的div高度
106 ljzzdyHeight:0, //逻辑幢下幢单元的div高度 105 ljzzdyHeight: 0, //逻辑幢下幢单元的div高度
107 loading:true, 106 loading: true,
108 hbsmList:[], 107 hbsmList: [],
109 time:null, //区分单双击事件的定时器 108 time: null, //区分单双击事件的定时器
110 searchNum:Math.random(), 109 searchNum: Math.random(),
111 //接收父组件传入的根据单元状态/房屋性质/房屋用途筛选的户bsmList 110 //接收父组件传入的根据单元状态/房屋性质/房屋用途筛选的户bsmList
112 choosedList:[] 111 choosedList: [],
113 }; 112 };
114 }, 113 },
115 created() { 114 created() {},
116 },
117 mounted() { 115 mounted() {
118 this.getLpb(this.$store.state.zrzbsm); 116 this.getLpb(this.$store.state.zrzbsm);
119 setTimeout(() => { 117 setTimeout(() => {
120 //tab-content宽度 - 右侧图例宽度 - lp-overview滚动条宽度 - lpbContent的pandingRight 118 //tab-content宽度 - 右侧图例宽度 - lp-overview滚动条宽度 - lpbContent的pandingRight
121 this.lpbContentWidth = this.$store.state.contentWidth - 34 - 20; 119 this.lpbContentWidth = this.$store.state.contentWidth - 34 - 20;
122 //让滚动条滚动至最下面 -6是横向滚动条的高度 120 //让滚动条滚动至最下面 -6是横向滚动条的高度
123 this.$refs.lpbContent.scrollTop = this.$refs.lpbContent.scrollHeight - this.$refs.lpbContent.clientHeight - 6; 121 this.$refs.lpbContent.scrollTop =
122 this.$refs.lpbContent.scrollHeight -
123 this.$refs.lpbContent.clientHeight -
124 6;
124 }, 200); 125 }, 200);
125 }, 126 },
126 methods: { 127 methods: {
127 //获取楼盘表数据 128 //获取楼盘表数据
128 getLpb(zrzbsm){ 129 getLpb(zrzbsm) {
129 getLpb(zrzbsm) 130 getLpb(zrzbsm).then((res) => {
130 .then((res => {
131 if (res.code == 200) { 131 if (res.code == 200) {
132 this.loading = false; 132 this.loading = false;
133 this.lpbData = res.result == null ? this.lpbData:res.result; 133 this.lpbData = res.result == null ? this.lpbData : res.result;
134 setTimeout(() => { 134 setTimeout(() => {
135 //渲染楼盘表 135 //渲染楼盘表
136 this.dataChange() 136 this.dataChange();
137 }, 200); 137 }, 200);
138 } else { 138 } else {
139 this.$message({ 139 this.$message({
...@@ -141,98 +141,101 @@ export default { ...@@ -141,98 +141,101 @@ export default {
141 type: "warning", 141 type: "warning",
142 }); 142 });
143 } 143 }
144 })) 144 });
145 }, 145 },
146 //按照bdcdyh或shbw筛选户 146 //按照bdcdyh或shbw筛选户
147 lpbDataMap(sh){ 147 lpbDataMap(sh) {
148 //清除之前选中户 148 //清除之前选中户
149 this.clearChoosedH(); 149 this.clearChoosedH();
150 this.searchNum = sh; 150 this.searchNum = sh;
151 console.log('查询searchNum'+searchNum); 151 console.log("查询searchNum" + searchNum);
152 }, 152 },
153 //自然幢下元素高度宽度计算 153 //自然幢下元素高度宽度计算
154 dataChange(){ 154 dataChange() {
155 //计算逻辑幢宽度 20为marginRight值 155 //计算逻辑幢宽度 20为marginRight值
156 this.ljzWidth -= 9980; 156 this.ljzWidth -= 9980;
157 if(this.$refs.ljz!=undefined){ 157 if (this.$refs.ljz != undefined) {
158 this.$refs.ljz.forEach(item=>{ 158 this.$refs.ljz.forEach((item) => {
159 this.ljzWidth += item.offsetWidth + 20 159 this.ljzWidth += item.offsetWidth + 20;
160 }) 160 });
161 }else{ 161 } else {
162
163 } 162 }
164 //计算独立幢单元和独立层户宽度 163 //计算独立幢单元和独立层户宽度
165 //考虑this.$refs.zdy的length为0的情况,即自然幢下没有独立幢单元 164 //考虑this.$refs.zdy的length为0的情况,即自然幢下没有独立幢单元
166 if(this.$refs.zdy != undefined && this.$refs.zdy.length > 0){ 165 if (this.$refs.zdy != undefined && this.$refs.zdy.length > 0) {
167 //判断自然幢下有没有比层户高的幢单元 166 //判断自然幢下有没有比层户高的幢单元
168 let higher = true; 167 let higher = true;
169 //记录最高的幢单元高度 默认为第一个幢单元高度 168 //记录最高的幢单元高度 默认为第一个幢单元高度
170 let highest = this.$refs.zdy[0].offsetHeight; 169 let highest = this.$refs.zdy[0].offsetHeight;
171 this.zdyWidth -= 980; 170 this.zdyWidth -= 980;
172 this.$refs.zdy.forEach(item=>{ 171 this.$refs.zdy.forEach((item) => {
173 this.zdyWidth += item.offsetWidth + 21; 172 this.zdyWidth += item.offsetWidth + 21;
174 this.cHeight = item.offsetHeight > this.cHeight ? item.offsetHeight : this.cHeight; 173 this.cHeight =
175 highest = highest > item.offsetHeight ? highest:item.offsetHeight; 174 item.offsetHeight > this.cHeight ? item.offsetHeight : this.cHeight;
176 }) 175 highest = highest > item.offsetHeight ? highest : item.offsetHeight;
176 });
177 //判断有无独立层户 177 //判断有无独立层户
178 if(this.$refs.ch != undefined){ 178 if (this.$refs.ch != undefined) {
179 //计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度 179 //计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度
180 higher = highest > this.$refs.ch.offsetHeight ? true:false; 180 higher = highest > this.$refs.ch.offsetHeight ? true : false;
181 this.zdyHeight = higher ? highest : this.$refs.ch.offsetHeight 181 this.zdyHeight = higher ? highest : this.$refs.ch.offsetHeight;
182 this.zdyWidth += this.$refs.ch.offsetWidth; 182 this.zdyWidth += this.$refs.ch.offsetWidth;
183 }else{ 183 } else {
184 this.zdyHeight = highest; 184 this.zdyHeight = highest;
185 } 185 }
186 }else{ 186 } else {
187 // this.zdyWidth = 124; 187 // this.zdyWidth = 124;
188 } 188 }
189 189
190 //计算逻辑幢下的幢单元和层户的高度 190 //计算逻辑幢下的幢单元和层户的高度
191 if(this.$refs.ljzzdy != undefined && this.$refs.ljzzdy.length > 0){ 191 if (this.$refs.ljzzdy != undefined && this.$refs.ljzzdy.length > 0) {
192 //判断自然幢下有没有比层户高的幢单元 192 //判断自然幢下有没有比层户高的幢单元
193 let higher = true; 193 let higher = true;
194 //记录最高的幢单元高度 默认为第一个幢单元高度 194 //记录最高的幢单元高度 默认为第一个幢单元高度
195 let highest = this.$refs.ljzzdy[0].offsetHeight; 195 let highest = this.$refs.ljzzdy[0].offsetHeight;
196 this.$refs.ljzzdy.forEach(item=>{ 196 this.$refs.ljzzdy.forEach((item) => {
197 this.ljzcHeight = item.offsetHeight > this.ljzcHeight ? item.offsetHeight : this.ljzcHeight; 197 this.ljzcHeight =
198 highest = highest > item.offsetHeight ? highest:item.offsetHeight; 198 item.offsetHeight > this.ljzcHeight
199 }) 199 ? item.offsetHeight
200 : this.ljzcHeight;
201 highest = highest > item.offsetHeight ? highest : item.offsetHeight;
202 });
200 //判断有无独立层户 203 //判断有无独立层户
201 if(this.$refs.ljzch != undefined){ 204 if (this.$refs.ljzch != undefined) {
202 //计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度 205 //计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度
203 higher = highest > this.$refs.ljzch.offsetHeight ? true:false; 206 higher = highest > this.$refs.ljzch.offsetHeight ? true : false;
204 this.ljzzdyHeight = higher ? highest : this.$refs.ljzch.offsetHeight 207 this.ljzzdyHeight = higher ? highest : this.$refs.ljzch.offsetHeight;
205 }else{ 208 } else {
206 this.ljzzdyHeight = highest; 209 this.ljzzdyHeight = highest;
207 } 210 }
208 }else{ 211 } else {
209 // this.zdyWidth = 124; 212 // this.zdyWidth = 124;
210 } 213 }
211 }, 214 },
212 //户单击事件 215 //户单击事件
213 handleTdClick(e,bsm){ 216 handleTdClick(e, bsm) {
214 let self = this; 217 let self = this;
215 // 开启延时器,200ms的间隔区分单击和双击,解决双击时执行两次单击事件 218 // 开启延时器,200ms的间隔区分单击和双击,解决双击时执行两次单击事件
216 clearTimeout(self.time); 219 clearTimeout(self.time);
217 self.time = setTimeout(() => { 220 self.time = setTimeout(() => {
218 //判断点击的户是否选中 221 //判断点击的户是否选中
219 if(e.target.className.indexOf('tdSelect') == -1){ 222 if (e.target.className.indexOf("tdSelect") == -1) {
220 //未选中→选中 223 //未选中→选中
221 e.target.className = 'tdSelect'; //加边框 224 e.target.className = "tdSelect"; //加边框
222 this.hbsmList.push(bsm) // 将户bsm放进hbsmList 225 this.hbsmList.push(bsm); // 将户bsm放进hbsmList
223 }else{ 226 } else {
224 //选中→未选中 227 //选中→未选中
225 e.target.className = ''; 228 e.target.className = "";
226 this.deleteArrOption(this.hbsmList,bsm); 229 this.deleteArrOption(this.hbsmList, bsm);
227 } 230 }
228 this.$parent.getHbsm(this.hbsmList,false); 231 this.$parent.getHbsm(this.hbsmList, false);
229 }, 200); 232 }, 200);
230 }, 233 },
231 //户双击事件 234 //户双击事件
232 dbclick(bsm){ 235 dbclick(bsm) {
233 clearTimeout(this.time); 236 clearTimeout(this.time);
234 this.hbsmList.push(bsm) // 将户bsm放进hbsmList 237 this.hbsmList.push(bsm); // 将户bsm放进hbsmList
235 this.$parent.getHbsm(this.hbsmList,true); 238 this.$parent.getHbsm(this.hbsmList, true);
236 }, 239 },
237 //删除多重数组中的某一项 240 //删除多重数组中的某一项
238 deleteArrOption(arr, item) { 241 deleteArrOption(arr, item) {
...@@ -243,18 +246,18 @@ export default { ...@@ -243,18 +246,18 @@ export default {
243 } 246 }
244 }, 247 },
245 //清除选中户 248 //清除选中户
246 clearChoosedH(){ 249 clearChoosedH() {
247 this.$nextTick(()=>{ 250 this.$nextTick(() => {
248 //将每个选中的户的选中状态清除 251 //将每个选中的户的选中状态清除
249 this.$refs.hBsm.forEach(item=>{ 252 this.$refs.hBsm.forEach((item) => {
250 if(item.className == 'tdSelect'){ 253 if (item.className == "tdSelect") {
251 item.className = ''; 254 item.className = "";
252 } 255 }
253 }); 256 });
254 // 清空hbsmList 257 // 清空hbsmList
255 this.hbsmList = []; 258 this.hbsmList = [];
256 }) 259 });
257 } 260 },
258 }, 261 },
259 computed: { 262 computed: {
260 createFlagChange() { 263 createFlagChange() {
...@@ -267,39 +270,39 @@ export default { ...@@ -267,39 +270,39 @@ export default {
267 watch: { 270 watch: {
268 createFlagChange: function(val) { 271 createFlagChange: function(val) {
269 setTimeout(() => { 272 setTimeout(() => {
270 this.lpbContentWidth = this.$refs.lpbContent.offsetWidth -6; 273 this.lpbContentWidth = this.$refs.lpbContent.offsetWidth - 6;
271 }, 501); 274 }, 501);
272 }, 275 },
273 legendToggleFlagChange: function(val) { 276 legendToggleFlagChange: function(val) {
274 setTimeout(() => { 277 setTimeout(() => {
275 this.lpbContentWidth = this.$refs.lpbContent.offsetWidth -6; 278 this.lpbContentWidth = this.$refs.lpbContent.offsetWidth - 6;
276 }, 501); 279 }, 501);
277 }, 280 },
278 //监听有无通过输入框查询选择到的户,如果有,将其bsm放入hbsmList 281 //监听有无通过输入框查询选择到的户,如果有,将其bsm放入hbsmList
279 searchNum(n){ 282 searchNum(n) {
280 // 渲染查询到的户 283 // 渲染查询到的户
281 this.$nextTick(()=>{ 284 this.$nextTick(() => {
282 this.$refs.hBsm.forEach(item=>{ 285 this.$refs.hBsm.forEach((item) => {
283 if(item.className == 'tdSelect'){ 286 if (item.className == "tdSelect") {
284 console.log(item.dataset.bsm,'item.dataset.bsm'); 287 console.log(item.dataset.bsm, "item.dataset.bsm");
285 // 判断hbsmList中是否已经存在 288 // 判断hbsmList中是否已经存在
286 if(this.hbsmList.indexOf(item.dataset.bsm) == -1){ 289 if (this.hbsmList.indexOf(item.dataset.bsm) == -1) {
287 this.hbsmList.push(item.dataset.bsm) // 将户bsm放进hbsmList 290 this.hbsmList.push(item.dataset.bsm); // 将户bsm放进hbsmList
288 } 291 }
289 } 292 }
290 }) 293 });
291 }) 294 });
292 }, 295 },
293 //父组件中选择单元状态改变choosedList 296 //父组件中选择单元状态改变choosedList
294 choosedList(n){ 297 choosedList(n) {
295 this.$refs.hBsm.forEach(item=>{ 298 this.$refs.hBsm.forEach((item) => {
296 this.choosedList.forEach(i=>{ 299 this.choosedList.forEach((i) => {
297 if(item.dataset.bsm == i){ 300 if (item.dataset.bsm == i) {
298 item.className = 'tdSelect' 301 item.className = "tdSelect";
299 } 302 }
300 }) 303 });
301 }) 304 });
302 } 305 },
303 }, 306 },
304 }; 307 };
305 </script> 308 </script>
...@@ -314,26 +317,26 @@ export default { ...@@ -314,26 +317,26 @@ export default {
314 height: 100%; 317 height: 100%;
315 position: relative; 318 position: relative;
316 overflow: scroll; 319 overflow: scroll;
317 -webkit-user-select:none; 320 -webkit-user-select: none;
318 -moz-user-select:none; 321 -moz-user-select: none;
319 -ms-user-select:none; 322 -ms-user-select: none;
320 user-select:none; 323 user-select: none;
321 .ljz-wrap { 324 .ljz-wrap {
322 height: auto; 325 height: auto;
323 overflow: hidden; 326 overflow: hidden;
324 margin-bottom: 20px; 327 margin-bottom: 20px;
325 .ljz{ 328 .ljz {
326 float: left; 329 float: left;
327 margin-right: 20px; 330 margin-right: 20px;
328 // position: relative; 331 // position: relative;
329 .ljz-zdy-wrap{ 332 .ljz-zdy-wrap {
330 .ljz-zdy{ 333 .ljz-zdy {
331 height: auto; 334 height: auto;
332 margin-right: 20px; 335 margin-right: 20px;
333 float: left; 336 float: left;
334 position: relative; 337 position: relative;
335 .zdy-name{ 338 .zdy-name {
336 width: 100%; 339 width: 100%;
337 bottom: 0; 340 bottom: 0;
338 position: absolute; 341 position: absolute;
339 height: 40px; 342 height: 40px;
...@@ -344,28 +347,28 @@ export default { ...@@ -344,28 +347,28 @@ export default {
344 // bottom: 40px; 347 // bottom: 40px;
345 // } 348 // }
346 } 349 }
347 .ljz-ch{ 350 .ljz-ch {
348 float: left; 351 float: left;
349 } 352 }
350 .ljz-zdy:last-child{ 353 .ljz-zdy:last-child {
351 margin-right: 0; 354 margin-right: 0;
352 } 355 }
353 .column-reverse{ 356 .column-reverse {
354 display:flex; 357 display: flex;
355 flex-direction: column-reverse; 358 flex-direction: column-reverse;
356 } 359 }
357 } 360 }
358 .ljz-name{ 361 .ljz-name {
359 width: 100%; 362 width: 100%;
360 height: 40px; 363 height: 40px;
361 background-color: darkorange; 364 background-color: darkorange;
362 } 365 }
363 } 366 }
364 div:last-child{ 367 div:last-child {
365 margin-right: 0; 368 margin-right: 0;
366 } 369 }
367 } 370 }
368 .bottom40{ 371 .bottom40 {
369 position: absolute; 372 position: absolute;
370 bottom: 40px; 373 bottom: 40px;
371 } 374 }
...@@ -373,56 +376,59 @@ export default { ...@@ -373,56 +376,59 @@ export default {
373 height: auto; 376 height: auto;
374 overflow: hidden; 377 overflow: hidden;
375 margin-bottom: 60px; 378 margin-bottom: 60px;
376 .zdy{ 379 .zdy {
377 float: left; 380 float: left;
378 margin-right: 20px; 381 margin-right: 20px;
379 382
380 .zdy-zdy-wrap{ 383 .zdy-zdy-wrap {
381 .zdy-zdy{ 384 .zdy-zdy {
382 height: auto; 385 height: auto;
383 margin-right: 20px; 386 margin-right: 20px;
384 display: inline-table; 387 display: inline-table;
385 .zdy-name{ 388 .zdy-name {
386 bottom: 0; 389 bottom: 0;
387 background-color: blanchedalmond; 390 background-color: blanchedalmond;
388 } 391 }
389 } 392 }
390 .zdy-zdy:last-child{ 393 .zdy-zdy:last-child {
391 margin-right: 0; 394 margin-right: 0;
392 } 395 }
393 } 396 }
394 .zdy-name{ 397 .zdy-name {
395 width: 100%; 398 width: 100%;
396 height: 40px; 399 height: 40px;
397 background-color: rosybrown; 400 background-color: rosybrown;
398 } 401 }
399 } 402 }
400 .column-reverse{ 403 .column-reverse {
401 display:flex; 404 display: flex;
402 flex-direction: column-reverse; 405 flex-direction: column-reverse;
403 } 406 }
404 } 407 }
405 408
406 // 公共部分样式 start 409 // 公共部分样式 start
407 .chTable{ 410 .chTable {
408 position: relative; 411 position: relative;
409 tr{ 412 tr {
410 .floor{ 413 .floor {
411 background-color: blanchedalmond; 414 background-color: blanchedalmond;
412 } 415 }
413 td{ 416 td {
414 width: 124px; 417 width: 124px;
415 height: 64px; 418 height: 64px;
416 line-height: 64px; 419 line-height: 64px;
417 text-align: center; 420 text-align: center;
418 cursor: pointer; 421 cursor: pointer;
419 } 422 }
420 .tdSelect{ 423 .tdSelect {
421 border: 1px solid #0091FF!important; 424 border: 1px solid #006cff !important;
425 background-image: url("../../../../../assets/tdSelect.png");
426 background-repeat: no-repeat;
427 background-position: right top;
422 } 428 }
423 } 429 }
424 } 430 }
425 .name{ 431 .name {
426 line-height: 40px; 432 line-height: 40px;
427 text-align: center; 433 text-align: center;
428 } 434 }
......