c58e4a32 by yangwei

楼盘表回显

1 parent 4ec0ed5c
1 <!-- 1 <!--
2 * @Author: yangwei 2 * @Author: yangwei
3 * @Date: 2023-02-28 15:47:12 3 * @Date: 2023-02-28 15:47:12
4 * @LastEditors: yangwei 4 * @LastEditors: vers
5 * @LastEditTime: 2023-09-20 17:14:39 5 * @LastEditTime: 2024-02-05 16:06:30
6 * @FilePath: \bdcdj-web\src\views\lpb\lpbContent\ch.vue 6 * @FilePath: \bdcdj-web\src\views\lpb\lpbContent\ch.vue
7 * @Description: 7 * @Description:
8 * 8 *
...@@ -16,14 +16,16 @@ ...@@ -16,14 +16,16 @@
16 border="1" 16 border="1"
17 cellspacing="0" 17 cellspacing="0"
18 cellpadding="0" 18 cellpadding="0"
19 v-show="ch.length"> 19 v-show="ch.length"
20 >
20 <tr v-for="(cs, csIndex) in ch" :key="csIndex"> 21 <tr v-for="(cs, csIndex) in ch" :key="csIndex">
21 <!-- 显示层数 --> 22 <!-- 显示层数 -->
22 <td 23 <td
23 class="floor" 24 class="floor"
24 ref="cBsm" 25 ref="cBsm"
25 @contextmenu.prevent="openMenu($event, cs, 'c')" 26 @contextmenu.prevent="openMenu($event, cs, 'c')"
26 @click="handleClickC($event, cs)"> 27 @click="handleClickC($event, cs)"
28 >
27 {{ cs.sjc }} 29 {{ cs.sjc }}
28 </td> 30 </td>
29 <!-- 显示户 --> 31 <!-- 显示户 -->
...@@ -35,15 +37,22 @@ ...@@ -35,15 +37,22 @@
35 :data-qszt="hs.qszt" 37 :data-qszt="hs.qszt"
36 ref="hBsm" 38 ref="hBsm"
37 :key="hsIndex" 39 :key="hsIndex"
38 :style="{'border-color': borderColor}" 40 :style="{ 'border-color': borderColor }"
39 :class="hs.select ? 'tdSelect' : ''" 41 :class="hs.select ? 'tdSelect' : ''"
40 @click="handleClickH($event.target, hs.bsm, hs)" 42 @click="handleClickH($event.target, hs.bsm, hs)"
41 @dblclick="dbclick(hs.bsm)" 43 @dblclick="dbclick(hs.bsm)"
42 @contextmenu.prevent="openMenu($event, hs, 'h')"> 44 @contextmenu.prevent="openMenu($event, hs, 'h')"
45 >
43 {{ hs.shbw }} 46 {{ hs.shbw }}
44 <span @click.stop="" class="hqszt lin" v-show="hs.qszt == '0'"></span> 47 <span @click.stop="" class="hqszt lin" v-show="hs.qszt == '0'"
45 <span @click.stop="" class="hqszt zheng" v-show="hs.qszt == '1'"></span> 48 ></span
46 <span @click.stop="" class="hqszt xian" v-show="hs.qszt == '2'"></span> 49 >
50 <span @click.stop="" class="hqszt zheng" v-show="hs.qszt == '1'"
51 ></span
52 >
53 <span @click.stop="" class="hqszt xian" v-show="hs.qszt == '2'"
54 ></span
55 >
47 <ul @click.stop="hDyztClick($event, hs.bsm, hs)" class="dyzt"> 56 <ul @click.stop="hDyztClick($event, hs.bsm, hs)" class="dyzt">
48 <li style="background-color: #6edee1" v-show="hs.qqzt == '1'"> 57 <li style="background-color: #6edee1" v-show="hs.qqzt == '1'">
49 58
...@@ -71,14 +80,16 @@ ...@@ -71,14 +80,16 @@
71 </template> 80 </template>
72 81
73 <script> 82 <script>
83 import { set } from "nprogress";
84
74 export default { 85 export default {
75 name: "BdcdjWebCh", 86 name: "BdcdjWebCh",
76 inject: { 87 inject: {
77 openMenu:{value:'openMenu',default:null}, 88 openMenu: { value: "openMenu", default: null },
78 selectAll:{value:'selectAll',default:null}, 89 selectAll: { value: "selectAll", default: null },
79 changeChoosedObj:{value:'changeChoosedObj',default:null}, 90 changeChoosedObj: { value: "changeChoosedObj", default: null },
80 clearChangeChoosedObj:{value:'clearChangeChoosedObj',default:null}, 91 clearChangeChoosedObj: { value: "clearChangeChoosedObj", default: null },
81 getBsmList:{value:'getBsmList',default:null} 92 getBsmList: { value: "getBsmList", default: null },
82 }, 93 },
83 props: { 94 props: {
84 ch: { 95 ch: {
...@@ -87,10 +98,10 @@ export default { ...@@ -87,10 +98,10 @@ export default {
87 return []; 98 return [];
88 }, 99 },
89 }, 100 },
90 onlyShow:{ 101 onlyShow: {
91 type: Boolean, 102 type: Boolean,
92 default: true, 103 default: true,
93 } 104 },
94 }, 105 },
95 data() { 106 data() {
96 return { 107 return {
...@@ -101,26 +112,27 @@ export default { ...@@ -101,26 +112,27 @@ export default {
101 //区分单双击事件的定时器 112 //区分单双击事件的定时器
102 time: null, 113 time: null,
103 // 边框颜色 114 // 边框颜色
104 borderColor:'rgb(230, 230, 230)', 115 borderColor: "rgb(230, 230, 230)",
105 // 申请单元列表数据 116 // 申请单元列表数据
106 unitIdList:[], 117 unitIdList: [],
107 // 组件标识 118 // 组件标识
108 compFlag:Math.random() 119 compFlag: Math.random(),
109 }; 120 };
110 }, 121 },
111 mounted() { 122 mounted() {
112 // 根据申请单元列表数据处理选中户 123 // 根据申请单元列表数据处理选中户
113 console.log("window.unitData",window.unitData); 124 console.log("window.unitData", window.unitData);
114 if(window.unitData && window.unitData.length){ 125 if (window.unitData && window.unitData.length) {
115 window.unitData.forEach(e => { 126 window.unitData.forEach((e) => {
116 this.unitIdList.push(e.bdcdyid) 127 this.unitIdList.push(e.bdcdyid);
117 }) 128 });
129 console.log(this.unitIdList, "this.unitIdList");
118 this.ch.forEach((c) => { 130 this.ch.forEach((c) => {
119 c.hs.forEach((h) => { 131 c.hs.forEach((h) => {
120 if (h.dyhbsm.indexOf(this.unitIdList) > -1) { 132 if (this.unitIdList.indexOf(h.dyhbsm) > -1) {
121 h.select = true; 133 h.select = true;
122 // 使用hbsmList时,需要去重 134 // 使用hbsmList时,需要去重
123 this.hbsmList.push(h.bsm) 135 this.hbsmList.push(h.bsm);
124 } 136 }
125 }); 137 });
126 }); 138 });
...@@ -144,7 +156,7 @@ export default { ...@@ -144,7 +156,7 @@ export default {
144 e.target.className += " tdSelect"; 156 e.target.className += " tdSelect";
145 h.select = true; 157 h.select = true;
146 // 使用hbsmList时,需要去重 158 // 使用hbsmList时,需要去重
147 this.hbsmList.push(h.bsm) 159 this.hbsmList.push(h.bsm);
148 }); 160 });
149 } else { 161 } else {
150 //选中→未选中 162 //选中→未选中
...@@ -217,84 +229,86 @@ export default { ...@@ -217,84 +229,86 @@ export default {
217 * @param {*} flag 229 * @param {*} flag
218 * @author: renchao 230 * @author: renchao
219 */ 231 */
220 zdySelectAll(val,flag) { 232 zdySelectAll(val, flag) {
221 // 手动点击全部取消选中 233 // 手动点击全部取消选中
222 !flag && this.clearChangeChoosedObj() 234 !flag && this.clearChangeChoosedObj();
223 this.ch.forEach((c) => { 235 this.ch.forEach((c) => {
224 c.hs.forEach((h) => { 236 c.hs.forEach((h) => {
225 if (val) { 237 if (val) {
226 h.select = true; 238 h.select = true;
227 // 使用hbsmList时,需要去重 239 // 使用hbsmList时,需要去重
228 this.hbsmList.push(h.bsm) 240 this.hbsmList.push(h.bsm);
229 } else { 241 } else {
230 h.select = false; 242 h.select = false;
231 this.borderColor = 'rgb(230, 230, 230)' 243 this.borderColor = "rgb(230, 230, 230)";
232 this.hbsmList = [] 244 this.hbsmList = [];
233 } 245 }
234 }); 246 });
235 }); 247 });
236 this.$refs.hBsm && this.$refs.hBsm.forEach((item) => { 248 this.$refs.hBsm &&
249 this.$refs.hBsm.forEach((item) => {
237 // item.style.borderColor = this.borderColor 250 // item.style.borderColor = this.borderColor
238 item.style.backgroundColor = '#fff'; 251 item.style.backgroundColor = "#fff";
239 // item.style.border = `1px solid ${this.borderColor}` 252 // item.style.border = `1px solid ${this.borderColor}`
240 }); 253 });
241 }, 254 },
242 //清除选中 255 //清除选中
243 clearChoosed(){ 256 clearChoosed() {
244 //清除选中户 257 //清除选中户
245 this.zdySelectAll(false) 258 this.zdySelectAll(false);
246 //清除选中层 259 //清除选中层
247 this.cbsmList = []; 260 this.cbsmList = [];
248 this.$refs.cBsm && this.$refs.cBsm.forEach((item)=>{ 261 this.$refs.cBsm &&
249 item.className = 'floor' 262 this.$refs.cBsm.forEach((item) => {
250 }) 263 item.className = "floor";
264 });
251 }, 265 },
252 }, 266 },
253 watch: { 267 watch: {
254 selectAll: { 268 selectAll: {
255 handler(val) { 269 handler(val) {
256 this.zdySelectAll(val.selectAll); 270 this.zdySelectAll(val.selectAll);
257 val.cancelChoosed && this.clearChoosed() 271 val.cancelChoosed && this.clearChoosed();
258 }, 272 },
259 immediate: true, 273 immediate: true,
260 deep: true, 274 deep: true,
261 }, 275 },
262 hbsmList(val){ 276 hbsmList(val) {
263 let list = [] 277 let list = [];
264 val.length && val.forEach((i)=>{ 278 val.length &&
279 val.forEach((i) => {
265 this.ch.forEach((c) => { 280 this.ch.forEach((c) => {
266 c.hs.forEach((h) => { 281 c.hs.forEach((h) => {
267 if (i == h.bsm) { 282 if (i == h.bsm) {
268 list.push( 283 list.push({
269 { 284 bdcdyh: h.bdcdyh,
270 bdcdyh:h.bdcdyh, 285 bsm: h.bsm,
271 bsm:h.bsm, 286 dyhbsm: h.dyhbsm,
272 dyhbsm:h.dyhbsm, 287 bdcdyid: h.dyhbsm,
273 bdcdyid:h.dyhbsm,
274 zl: h.zl, 288 zl: h.zl,
275 bdcdylx:'7', 289 bdcdylx: "7",
276 flag:this.compFlag 290 flag: this.compFlag,
277 } 291 });
278 )
279 } 292 }
280 }); 293 });
281 }); 294 });
282 }) 295 });
283 this.getBsmList(list,this.compFlag) 296 this.getBsmList(list, this.compFlag);
284 }, 297 },
285 changeChoosedObj: { 298 changeChoosedObj: {
286 handler(val) { 299 handler(val) {
287 this.borderColor = 'rgb(230, 230, 230)'; 300 this.borderColor = "rgb(230, 230, 230)";
288 if (val.bsms.length) { 301 if (val.bsms.length) {
289 //清除选中户 302 //清除选中户
290 this.zdySelectAll(false,true) 303 this.zdySelectAll(false, true);
291 this.$refs.hBsm.forEach((item) => { 304 this.$refs.hBsm.forEach((item) => {
292 val.bsms.forEach((i,ind) => { 305 val.bsms.forEach((i, ind) => {
293 if (item.dataset.bsm == i) { 306 if (item.dataset.bsm == i) {
294 if (ind == 0) { 307 if (ind == 0) {
295 //定位到第一个户所在位置 308 //定位到第一个户所在位置
296 window.lpbContent.$refs.lpbContent.scrollTop = item.offsetTop; 309 window.lpbContent.$refs.lpbContent.scrollTop = item.offsetTop;
297 window.lpbContent.$refs.lpbContent.scrollLeft = item.offsetLeft; 310 window.lpbContent.$refs.lpbContent.scrollLeft =
311 item.offsetLeft;
298 } 312 }
299 // item.style.border = '1px solid '+ val.color; 313 // item.style.border = '1px solid '+ val.color;
300 // 背景色高亮 314 // 背景色高亮
...@@ -306,12 +320,12 @@ export default { ...@@ -306,12 +320,12 @@ export default {
306 }, 320 },
307 immediate: true, 321 immediate: true,
308 deep: true, 322 deep: true,
309 } 323 },
310 }, 324 },
311 }; 325 };
312 </script> 326 </script>
313 <style lang="scss" scoped> 327 <style lang="scss" scoped>
314 .ch-wrap { 328 .ch-wrap {
315 display: flex; 329 display: flex;
316 flex-direction: column-reverse; 330 flex-direction: column-reverse;
317 .chTable { 331 .chTable {
...@@ -396,5 +410,5 @@ export default { ...@@ -396,5 +410,5 @@ export default {
396 } 410 }
397 } 411 }
398 } 412 }
399 } 413 }
400 </style> 414 </style>
......