index.vue 28.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
<template>
	<div class="lpbContent-wrap" ref="lpbContentWrap">
		<div
			:class="
				lpbData.ljzs.length == 0 ? 'column-reverse lpbContent' : 'lpbContent'
			"
			ref="lpbContent"
			v-loading="loading"
		>
			<div
				:class="
					lpbData.cs.length == 0 && lpbData.zdys.length == 0
						? 'bottom40 ljz-wrap'
						: 'ljz-wrap'
				"
				:style="{'width':ljzWidth+'px'}"
				v-show="lpbData.ljzs.length > 0"
			>
				<!-- 循环逻辑幢数据 -->
				<div
					class="ljz"
					ref="ljz"
					v-for="(ljzs, ljzIndex) in lpbData.ljzs"
					:key="ljzIndex"
					:style="{'marginTop':ljzs.zdys.length>0?'0':'30px'}"
				>
					<!-- <div  class="ljz-zdy-wrap" :style="{'min-height':ljzzdyHeight+40+'px'}"> -->
					<!-- 循环逻辑幢下的幢单元 -->
					<div
						class="ljz-zdy"
						:style="{ 'min-height': ljzzdyHeight + 40 + 'px','marginRight':zdyIndex<(ljzs.zdys.length-1)?'20px':'0'}"
						ref="ljzzdy"
						v-show="ljzs.zdys.length > 0"
						v-for="(zdys, zdyIndex) in ljzs.zdys"
						:key="zdyIndex"
					>
						<!-- 循环幢单元下的层户 -->
						<!-- <div class="chTable-wrap"> -->
						<table
							class="chTable psr"
							:style="{ top: ljzzdyHeight - 1 - zdys.cs.length * 65 + 'px' }"
							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"
									ref="cBsm"
									@contextmenu.prevent="openMenu($event, cs, 'c')"
									@click="handleClickC($event, cs)"
								>
									{{ cs.sjc }}
								</td>
								<!-- 显示户 -->
								<td
									v-for="(hs, hsIndex) in cs.hs"
									:rowspan="hs.sjcs"
									:colspan="hs.sjhs"
									:data-bsm="hs.bsm"
									ref="hBsm"
									:key="hsIndex"
									:class="searchNum == hs.shbw || searchNum == hs.bdcdyh ? 'tdSelect' : ''"
									@click="handleTdClick($event, hs.bsm,hs)"
									@dblclick="dbclick(hs.bsm)"
									@contextmenu.prevent="openMenu($event, hs, 'h')"
								>
									{{ hs.shbw }}
									<span @click.stop="qsztClick" class="hqszt lin" v-show="hs.qszt == '0'"></span>
									<span @click.stop="qsztClick" class="hqszt zheng" v-show="hs.qszt == '1'"></span>
									<span @click.stop="qsztClick" class="hqszt xian" v-show="hs.qszt == '2'"  ></span>
								</td>
							</tr>
						</table>

						<!-- </div> -->
						<!-- 幢单元名称 -->
						<div class="zdy-name name">
							{{ zdys.zdymc }}
						</div>
					</div>
					<!-- 循环逻辑幢下的层户 -->
					<div
						class="ljz-ch"
						ref="ljzDlch"
						:style="{ height: 'auto' }"
						v-if="ljzs.cs.length > 0"
					>
						<table
							class="chTable"
							:style="{
								top:
									ljzzdyHeight + 40 - 1 - ljzs.cs.length * 65 < 0
										? 0
										: ljzzdyHeight + 40 - 1 - ljzs.cs.length * 65 + 'px',
							}"
							border="1"
							cellspacing="0"
							cellpadding="0"
						>
							<tr v-for="cs in ljzs.cs" :key="cs.bsm">
								<!-- 显示层数 -->
								<td
									class="floor"
									ref="cBsm"
									@contextmenu.prevent="openMenu($event, cs, 'c')"
									@click="handleClickC($event, cs)"
								>
									{{ cs.sjc }}
								</td>
								<!-- 显示户 -->
								<td
									v-for="(hs, hsIndex) in cs.hs"
									:rowspan="hs.sjcs"
									:colspan="hs.sjhs"
									:data-bsm="hs.bsm"
									ref="hBsm"
									:key="hsIndex"
									:class="searchNum == hs.shbw || searchNum == hs.bdcdyh ? 'tdSelect' : ''"
									@click="handleTdClick($event, hs.bsm,hs)"
									@dblclick="dbclick(hs.bsm)"
									@contextmenu.prevent="openMenu($event, hs, 'h')"
								>
									{{ hs.shbw }}
									<span @click.stop="qsztClick" class="hqszt lin" v-show="hs.qszt == '0'"></span>
									<span @click.stop="qsztClick" class="hqszt zheng" v-show="hs.qszt == '1'"></span>
									<span @click.stop="qsztClick" class="hqszt xian" v-show="hs.qszt == '2'"  ></span>
								</td>
							</tr>
						</table>
					</div>
					<!-- </div> -->

					<!-- 逻辑幢名称 -->
					<div class="ljz-name name">
						<p>
							{{ ljzs.ljzmc }}
						</p>
					</div>
				</div>
			</div>
			<div class="zdy-wrap" :style="{ width: zdyWidth + 'px' }">
				<!-- 循环自然幢下的幢单元 -->
				<div
					class="zdy column-reverse"
					ref="zdy"
					v-for="(zdys, zdyIndex) in lpbData.zdys"
					:key="zdyIndex"
					:style="{ 'min-height': zdyHeight + 'px' }"
				>
					<!-- 幢单元名称 -->
					<div class="zdy-name name">
						{{ zdys.zdymc }}
					</div>
					<!-- 循环幢单元下的层户 -->
					<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"
								ref="cBsm"
								@contextmenu.prevent="openMenu($event, cs, 'c')"
								@click="handleClickC($event, cs)"
							>
								{{ cs.sjc }}
							</td>
							<!-- 显示户 -->
							<td
								v-for="(hs, hsIndex) in cs.hs"
								:rowspan="hs.sjcs"
								:colspan="hs.sjhs"
								:data-bsm="hs.bsm"
								ref="hBsm"
								:key="hsIndex"
								:class="searchNum == hs.shbw || searchNum == hs.bdcdyh ? 'tdSelect' : ''"
								@click="handleTdClick($event, hs.bsm,hs)"
								@dblclick="dbclick(hs.bsm)"
								@contextmenu.prevent="openMenu($event, hs, 'h')"
							>
								{{ hs.shbw }}
									<span @click.stop="qsztClick" class="hqszt lin" v-show="hs.qszt == '0'"></span>
									<span @click.stop="qsztClick" class="hqszt zheng" v-show="hs.qszt == '1'"></span>
									<span @click.stop="qsztClick" class="hqszt xian" v-show="hs.qszt == '2'"  ></span>
							</td>
						</tr>
					</table>
				</div>
				<!-- 循环自然幢下的独立层户 -->
				<!-- <template > -->
				<div
					class="zdy column-reverse"
					:style="{ 'min-height': cHeight + 'px' }"
				>
					<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"
								ref="cBsm"
								@contextmenu.prevent="openMenu($event, cs, 'c')"
								@click="handleClickC($event, cs)"
							>
								{{ cs.sjc }}
							</td>
							<!-- 显示户 -->
							<td
								v-for="(hs, hsIndex) in cs.hs"
								:rowspan="hs.sjcs"
								:colspan="hs.sjhs"
								:data-bsm="hs.bsm"
								ref="hBsm"
								:key="hsIndex"
								:class="searchNum == hs.shbw || searchNum == hs.bdcdyh ? 'tdSelect' : ''"
								@click="handleTdClick($event, hs.bsm,hs)"
								@dblclick="dbclick(hs.bsm)"
								@contextmenu.prevent="openMenu($event, hs, 'h')"
							>
								{{ hs.shbw }}
									<span @click.stop="qsztClick" class="hqszt lin" v-show="hs.qszt == '0'"></span>
									<span @click.stop="qsztClick" class="hqszt zheng" v-show="hs.qszt == '1'"></span>
									<span @click.stop="qsztClick" class="hqszt xian" v-show="hs.qszt == '2'"  ></span>
							</td>
						</tr>
					</table>
				</div>
				<!-- </template> -->
			</div>
			<!-- <div class="ch-wrap">层户</div> -->
		</div>
		<div class="zrz" :style="{ width: lpbContentWidth + 'px' }">
			{{ lpbData.xmmc }}
		</div>
		<ul
			v-show="lpbChVisible"
			:style="{ left: lpbChLeft + 'px', top: lpbChTop + 'px' }"
			class="contextmenu"
		>
			<li v-show="rightClickFlag == 'h'" @click="handleAddH">添加</li>
			<li v-show="rightClickFlag == 'h'" @click="handleMoveH">移动</li>
			<li v-show="rightClickFlag == 'h'" @click="handleDeleteH">删除</li>
			<li v-show="rightClickFlag == 'h'" @click="handleSyczh">实预测转换</li>
			<li v-show="rightClickFlag == 'c'" @click="handleAddC('up')">
				向上添加层
			</li>
			<li v-show="rightClickFlag == 'c'" @click="handleAddC('down')">
				向下添加层
			</li>
			<li v-show="rightClickFlag == 'c'" @click="handleDeleteC">删除层</li>
			<!-- 合并 -->
			<li v-show="rightClickFlag == 'hb'" :class="canHb!='zyhb'? 'cantHb':''" @click="handleHb('zyhb')">左右合并</li>
			<li v-show="rightClickFlag == 'hb'" :class="canHb!='sxhb'? 'cantHb':''" @click="handleHb('sxhb')">上下合并</li>
			<!-- 分割 -->
			<li v-show="rightClickFlag == 'fg'"  @click="handleFg">户分割</li>
			<!-- <li v-show="rightClickFlag == 'fg'" :class="canHb!='sxhb'? 'cantHb':''" @click="handleHb('sxhb')">上下合并</li> -->

		</ul>
		<!-- 层操作弹框 -->
		<el-dialog
			:title="addCData.title"
			:visible.sync="addCVisible"
			width="50%"
		>
			<el-form :model="addCData">
				<el-form-item label="层号" :label-width="formLabelWidth">
					<el-input
						disabled
						v-model="addCData.sjc"
						autocomplete="off"
					></el-input>
				</el-form-item>
				<el-form-item label="实际层" :label-width="formLabelWidth">
					<el-input
						disabled
						v-model="addCData.sjc"
						autocomplete="off"
					></el-input>
				</el-form-item>
				<el-form-item label="添加的户数" :label-width="formLabelWidth">
					<el-input v-model="addCData.hcount" autocomplete="off"></el-input>
				</el-form-item>
			</el-form>
			<div class="btnGroup">
				<el-button type="primary" @click="saveAddC">保存</el-button>
				<el-button type="primary" @click="addCVisible = false">取消</el-button>
			</div>
		</el-dialog >
		<!-- 户分割弹框 -->
		<el-dialog
			title = "户分割"
			:visible.sync="hfgDialogVisible"
			width="800px"
		>
		<el-form :model="fgData">
			<el-form-item label="分割户数" required="" :label-width="formLabelWidth">
				<el-input
					:disabled="fgData.fgfx!=0"
					v-model="fgData.fghs"
					autocomplete="off"
				></el-input>
			</el-form-item>
		</el-form>
		<div class="btnGroup">
			<el-button type="primary" @click="savefgData">保存</el-button>
			<el-button type="primary" @click="hfgDialogVisible = false">取消</el-button>
		</div>
		</el-dialog>
		<move-h
			:hbsm="chData.bsm"
			@close="moveHClose"
			:move-hvisible="moveHvisible"
			:type="scyclx"
			@loading="loadingData($store.state.zrzbsm,$parent.scyclx)"
		></move-h>
	</div>
</template>
<script>
import moveH from "@components/moveH/moveH";
import { getLpb, insertUpDownC, deleteCByBsm } from "@api/lpb";
import { hhb,hfg } from "@api/h";
import { Message } from 'element-ui';
export default {
	name: "",
	components: { moveH },
	props: {
		isHbfg:{
			type:Boolean,
			default:false
		},
		zrzbsm:{
			type:String,
			default:''
		},
		isHb:{
			type:Boolean,
			default:true
		}
	},
	data() {
		return {
			moveHvisible: false,
			lpbData: {
				ljzs: [],
				cs: [],
				zdys: [],
			},
			lpbContentWidth: "",
			ljzWidth: 10000,
			zdyWidth: 1000,
			cHeight: 0, //独立层户的div高度
			zdyHeight: 0, //独立幢单元的div高度
			ljzcHeight: 0, //逻辑幢下层户的div高度
			ljzzdyHeight: 0, //逻辑幢下幢单元的div高度
			loading: true,
			hbsmList: [],
			cbsmList: [],
			time: null, //区分单双击事件的定时器
			searchNum: Math.random(),
			//接收父组件传入的根据单元状态/房屋性质/房屋用途筛选的户bsmList
			choosedList: [],
			borderColor: "#E6E6E6",
			lpbChVisible: false, //层户右键菜单显隐
			lpbChLeft: 100,
			lpbChTop: 100,
			//右键层户数据
			chData: "",
			rightClickFlag: "",
			//层操作数据
			addCVisible: false,
			addCData: {
				title: "",
				cbsm: "", //层标识码
				hcount: "", //添加户数
				scyclx: "", //实测预测类型
				sjc: "", //当前的层的SJC +1
			},
			formLabelWidth: "120px",
			yclpbData:{},
			sclpbData:{},
			fghbChoosedList:[],
			canHb:'',//判断合并类型
			hfgDialogVisible:false, //户分割弹框
			fgData:{
				fghs:"",
				oldbsm:'',
				fgfx:0
			}
		};
	},
	created() {},
	mounted() {
		this.getLpb(this.zrzbsm, "0");
		this.getLpb(this.zrzbsm, "1");
		setTimeout(() => {
			//tab-content宽度 - 右侧图例宽度 - lp-overview滚动条宽度 - lpbContent的pandingRight
			this.lpbContentWidth = this.$store.state.contentWidth - 34 - 20;
			//让滚动条滚动至最下面 -6是横向滚动条的高度
			this.$refs.lpbContent.scrollTop =
				this.$refs.lpbContent.scrollHeight -
				this.$refs.lpbContent.clientHeight -
				6;
		}, 200);
	},
	methods: {
		loadingData(zrzbsm,scyclx) {
			this.getLpb(zrzbsm,scyclx,true);
		},
		//获取楼盘表数据
		getLpb(zrzbsm, scyclx,actual) {
			getLpb(zrzbsm, scyclx).then((res) => {
				if (res.code == 200) {
					this.loading = false;
					res.result.ljzs = res.result.ljzs
						.sort(this.compare("place"))
						.reverse();
					// this.lpbData = res.result == null ? this.lpbData : res.result;
					//给实预测楼盘表对象赋值,默认加载预测楼盘表数据
					if(scyclx == 0){
						this.yclpbData = res.result == null ? this.yclpbData : res.result;
						this.lpbData = this.yclpbData;
					}else{
						this.sclpbData = res.result == null ? this.sclpbData : res.result;
					}
					if(actual){
						this.lpbData = res.result == null ? this.yclpbData : res.result;
					}
					this.$nextTick(() => {
						//渲染楼盘表
						this.dataChange();
					});
				} else {
					this.$message({
						message: res.message,
						type: "warning",
					});
				}
			});
		},
		compare(property) {
			return function(a, b) {
				var value1 = a[property];
				var value2 = b[property];
				return value1 - value2;
			};
		},
		//按照bdcdyh或shbw筛选户
		lpbDataMap(sh) {
			//清除之前选中户
			this.clearChoosedH();
			this.searchNum = sh;
			console.log("查询searchNum" + searchNum);
		},
		//自然幢下元素高度宽度计算
		dataChange() {
			//计算逻辑幢宽度  20为marginRight值
			this.ljzWidth = 20;
			if (this.$refs.ljzzdy != undefined) {
				this.$refs.ljzzdy.forEach((item) => {
					this.ljzWidth += item.offsetWidth + 20;
				});
			} else {
				if (this.$refs.ljzDlch != undefined) {
					this.$refs.ljzDlch.forEach((item) => {
						this.ljzWidth += item.offsetWidth + 20;
					});
				}
			}
			//计算独立幢单元和独立层户宽度
			//考虑this.$refs.zdy的length为0的情况,即自然幢下没有独立幢单元
			if (this.$refs.zdy != undefined && this.$refs.zdy.length > 0) {
				//判断自然幢下有没有比层户高的幢单元
				let higher = true;
				//记录最高的幢单元高度 默认为第一个幢单元高度
				let highest = this.$refs.zdy[0].offsetHeight;
				this.zdyWidth = 20;
				this.$refs.zdy.forEach((item) => {
					this.zdyWidth += item.offsetWidth + 21;
					this.cHeight =
						item.offsetHeight > this.cHeight ? item.offsetHeight : this.cHeight;
					highest = highest > item.offsetHeight ? highest : item.offsetHeight;
				});
				//判断有无独立层户
				if (this.$refs.ch != undefined) {
					//计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度
					higher = highest > this.$refs.ch.offsetHeight ? true : false;
					this.zdyHeight = higher ? highest : this.$refs.ch.offsetHeight;
					highest = 0;
					this.zdyWidth += this.$refs.ch.offsetWidth;
				} else {
					this.zdyHeight = highest;
					highest = 0;
				}
			} else {
				//有且仅有独立层户
				if (this.$refs.hBsm != undefined) {
					this.$refs.hBsm.forEach((item) => {
						this.zdyWidth += item.offsetWidth + 21;
					});
				}
			}

			//计算逻辑幢下的幢单元和层户的高度
			this.ljzzdyHeight = 1;
			if (this.$refs.ljzzdy != undefined && this.$refs.ljzzdy.length > 0) {
				//判断自然幢下有没有比层户高的幢单元
				let higher = true;
				//记录最高的幢单元高度 默认为第一个幢单元高度
				let highest = this.$refs.ljzzdy[0].offsetHeight;
				this.$refs.ljzzdy.forEach((item) => {
					this.ljzcHeight =
						item.offsetHeight > this.ljzcHeight
							? item.offsetHeight
							: this.ljzcHeight;
					highest = highest > item.offsetHeight ? highest : item.offsetHeight;
				});
				//判断有无独立层户
				if (this.$refs.ljzch != undefined) {
					//计算自然幢下的幢单元高度,如果有比层户高的幢单元,则幢单元高度设为最高的幢单元高度,如果没有,则设为层户高度
					higher = highest > this.$refs.ljzch.offsetHeight ? true : false;
					this.$nextTick(() => {
						this.ljzzdyHeight = higher
							? highest
							: this.$refs.ljzch.offsetHeight;
						highest = 0;
					});
				} else {
					this.$nextTick(() => {
						this.ljzzdyHeight = highest;
						highest = 0;
					});
				}
			} else {
				// this.zdyWidth = 124;
			}
		},
		//户单击事件
		handleTdClick(e, bsm,hs) {
			let self = this;
			// 开启延时器,200ms的间隔区分单击和双击,解决双击时执行两次单击事件
			clearTimeout(self.time);
			self.time = setTimeout(() => {
				//判断点击的户是否选中
				if (e.target.className.indexOf("tdSelect") == -1) {
					//未选中→选中
					e.target.className = "tdSelect"; //加边框
					if(this.isHbfg){
						this.fghbChoosedList.push(hs);
						this.hbsmList.push(bsm); // 将户bsm放进hbsmList
					}else{
						this.hbsmList.push(bsm); // 将户bsm放进hbsmList
					}
				} else {
					//选中→未选中
					e.target.className = "";
					if(this.isHbfg){
						this.deleteArrOption(this.fghbChoosedList, hs)
						this.deleteArrOption(this.hbsmList, bsm);
					}else{
						this.deleteArrOption(this.hbsmList, bsm);
					}
				}
				if(this.isHbfg){

				}else{
					this.$parent.getHbsm(this.hbsmList, false);
				}
			}, 200);
		},
		//户双击事件
		dbclick(bsm) {
			clearTimeout(this.time);
			if (this.isHbfg) {
				
			}else{
				// this.hbsmList.push(bsm); // 将户bsm放进hbsmList
				this.$parent.getHbsm(bsm, true);
			}
		},
		//删除多重数组中的某一项
		deleteArrOption(arr, item) {
			for (var i = arr.length; i > 0; i--) {
				if (arr[i - 1] == item) {
					arr.splice(i - 1, 1);
				}
			}
		},
		//清除选中户
		clearChoosedH() {
			// this.$nextTick(() => {
			//将每个选中的户的选中状态清除
			this.$refs.hBsm.forEach((item) => {
				if (item.className == "tdSelect") {
					item.className = "";
				}
			});
			// 清空hbsmList
			this.hbsmList = [];
			// });
		},
		//户右键点击事件
		openMenu(e, item, type) {
			this.lpbChLeft = e.pageX;
			this.lpbChTop = e.pageY;
			if (this.isHbfg) {
				this.rightClickFlag = this.isHb ? 'hb':'fg';
				if (this.fghbChoosedList.length>1) {
					//合并
					this.lpbChVisible = true;
					//判断选中户可以执行的合并类型
					let chIsSame = this.fghbChoosedList.every((item)=> {
						return item.ch == this.fghbChoosedList[0].ch;
					});
					let hhIsSame = this.fghbChoosedList.every((item)=> {
						return item.hh == this.fghbChoosedList[0].hh;
					});
					this.$nextTick(()=>{
						if(chIsSame){
							this.canHb = 'zyhb'
						}else if(hhIsSame){
							this.canHb = 'sxhb'
						}else{
							this.canHb = ''
						}
					})
				}else{
					//分割
					this.lpbChVisible = true;
					this.fgData.oldbsm = item.bsm;
					console.log(item,'item');
					//判断户的实际sjcs为1,只能水平分割
					this.fgData.fgfx = item.sjcs == 1 ? 0 : 1;
					if(item.sjcs == 1){
						//判断户的实际sjcs为1,只能水平分割
						this.fgData.fgfx = 0;
						this.fgData.fghs = '';
					}else{
						this.fgData.fgfx = 1;
						//判断户的实际sjhs不为1,分割户数为sjhs的值
						this.fgData.fghs = item.sjcs;
					}
				}
			}else{
				console.log(e, "e");
				this.chData = item;
				this.rightClickFlag = type;
				this.lpbChVisible = true;
			}
		},
		// 层选中事件
		handleClickC(e, item) {
			if (this.isHbfg) {
				
			}else{
				//判断点击的层是否选中
				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;
		},
		//户右键菜单 start
		handleAddH() {},
		handleMoveH() {
			// 移动户
			console.log(this.chData, "chData");
			console.log(this.$parent.scyclx, "实预测类型");
			this.moveHvisible = true;
		},
		moveHClose() {
			this.moveHvisible = false;
		},
		handleDeleteH() {},
		handleSyczh() {},
		//end
		// 层右键菜单 start
		//添加
		handleAddC(type) {
			this.addCData.title = type == "up" ? "向上添加层" : "向下添加层";
			this.addCVisible = true;
			this.addCData.sjc =
				type == "up"
					? Number(this.chData.sjc) + 1
					: Number(this.chData.sjc) - 1;
			this.addCData.cbsm = this.chData.bsm;
			this.addCData.scyclx = this.$parent.scyclx;
		},
		//删除
		handleDeleteC() {
			let params = {
				cbsm: this.chData.bsm,
				scyclx: this.$parent.scyclx,
			};
			this.$confirm("是否确认删除该层?", "提示", {
				confirmButtonText: "确定",
				cancelButtonText: "取消",
				type: "warning",
			})
				.then(() => {
					deleteCByBsm(params).then((res) => {
						if (res.code == 200) {
							this.$message({
								message: "删除成功",
								type: "success",
							});
							this.getLpb(this.$store.state.zrzbsm, this.$parent.scyclx);
						} else {
							this.$message({
								message: res.message,
								type: "warning",
							});
						}
					});
				})
				.catch(() => {});
		},
		//确认添加
		saveAddC() {
			insertUpDownC(this.addCData).then((res) => {
				if (res.code == 200) {
					this.$message({
						message: "添加成功",
						type: "success",
					});
					this.getLpb(this.$store.state.zrzbsm, this.$parent.scyclx);
					this.addCVisible = false;
				} else {
					this.$message({
						message: res.message,
						type: "warning",
					});
				}
			});
		},
		//end
		qsztClick(){

		},
		//户合并
		handleHb(type){
			let olbBsms = '';
			this.hbsmList.forEach((item,index)=>{
				olbBsms+= index<this.hbsmList.length-1? item+',':item
			})
			if (type == this.canHb) {
				this.$confirm("是否确认合并选中户?", "提示", {
					confirmButtonText: "确定",
					cancelButtonText: "取消",
					type: "warning",
				})
					.then(() => {
						//确定合并 调用合并接口 this.hbsmList为选中户bsm数组 TO DO 
						let params = {
							"newuserbsm": "",
							"oldBsms": olbBsms,
							"scyclx": this.$parent.scyclx,
							"ljzbsm": this.fghbChoosedList[0].ljzbsm,
							"zdybsm": this.fghbChoosedList[0].zdybsm,
							"zrzbsm": this.fghbChoosedList[0].zrzbsm
						}
						// console.log(params,'params');
						hhb(params).then((res) => {
							if(res.code == 200){
								Message.success('合并成功');
								// 清除选中户
								this.clearChoosedH();
								this.fghbChoosedList = [];
								// 更新楼盘表
								this.getLpb(this.zrzbsm, this.$parent.scyclx);
							}
						})
						.catch(() => {});
					})
					.catch(() => {});
			}else{

			}
		},
		//户分割
		handleFg(){
			this.hfgDialogVisible = true;
		},
		//户分割保存
		savefgData(){
			hfg(this.fgData).then((res) => {
				if(res.code == 200){
					Message.success('分割成功');
					// 清除选中户
					this.hfgDialogVisible = false
					this.clearChoosedH();
					this.fghbChoosedList = [];
					// 更新楼盘表
					this.getLpb(this.zrzbsm, this.$parent.scyclx);
				}
			})
			.catch(() => {});
		}
	},
	computed: {
		createFlagChange() {
			return this.$parent.createFlag;
		},
		legendToggleFlagChange() {
			return this.$parent.legendToggleFlag;
		},
		scyclx() {
			return this.$parent.scyclx;
		},
	},
	watch: {
		scyclx(n) {
			// this.getLpb(this.$store.state.zrzbsm, n);
			if(n == '0'){
				this.lpbData = this.yclpbData;
			}else{
				this.lpbData = this.sclpbData;
			}
		},
		createFlagChange: function(val) {
			setTimeout(() => {
				this.lpbContentWidth = this.$refs.lpbContent.offsetWidth - 6;
			}, 501);
		},
		legendToggleFlagChange: function(val) {
			setTimeout(() => {
				this.lpbContentWidth = this.$refs.lpbContent.offsetWidth - 6;
			}, 501);
		},
		//监听有无通过输入框查询选择到的户,如果有,将其bsm放入hbsmList
		searchNum(n) {
			// 渲染查询到的户
			this.$nextTick(() => {
				this.$refs.hBsm.forEach((item) => {
					if (item.className == "tdSelect") {
						console.log(item.dataset.bsm, "item.dataset.bsm");
						// 判断hbsmList中是否已经存在
						if (this.hbsmList.indexOf(item.dataset.bsm) == -1) {
							this.hbsmList.push(item.dataset.bsm); // 将户bsm放进hbsmList
						}
					}
				});
			});
		},
		//父组件中选择单元状态改变选中户的边框颜色
		choosedList(n) {
			this.$refs.hBsm.forEach((item) => {
				this.choosedList.forEach((i) => {
					if (item.dataset.bsm == i) {
						item.style.border = '1px solid '+this.borderColor;
					}
				});
			});
		},
		lpbChVisible(value) {
			if (value) {
				document.body.addEventListener("click", this.closeMenu);
			} else {
				document.body.removeEventListener("click", this.closeMenu);
			}
		},
	},
};
</script>
<style scoped lang="less">
.lpbContent-wrap {
	width: 100%;
	height: 100%;
	overflow: hidden;
	.lpbContent {
		width: 100%;
		height: 100%;
		position: relative;
		overflow: scroll;
		-webkit-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
		user-select: none;
		.ljz-wrap {
			height: auto;
			overflow: hidden;
			.ljz {
				// margin-bottom: 20px;
				display: table;
				// position: relative;
				// .ljz-zdy-wrap {
				// 	width: auto;
				// 	display: table;
				.ljz-zdy {
					height: auto;
					float: left;
					position: relative;
					.zdy-name {
						width: 100%;
						bottom: 0;
						position: absolute;
						height: 40px;
						// background-color: rosybrown;
						border:1px solid #E6E6E6
					}
					// .chTable-wrap{
					// 	position: absolute;
					// 	bottom: 40px;
					// }
				}
				div:last-child {
					margin-right: 0;
				}
				.ljz-ch {
					float: left;
				}
				.ljz-zdy:last-child {
					margin-right: 0;
				}
				.column-reverse {
					display: flex;
					flex-direction: column-reverse;
				}
				// }
				.ljz-name {
					width: calc(100% - 32px);
					height: 40px;
					// background-color: darkorange;
					p{
						width: 100%;
						height: 100%;
						border:1px solid #E6E6E6
					}
				}
			}
			div:last-child {
				margin-right: 0;
			}
		}
		.bottom40 {
			margin-bottom: -30px;
		}
		.zdy-wrap {
			height: auto;
			overflow: hidden;
			margin-bottom: 60px;
			margin-top: 30px;
			.zdy {
				float: left;
				margin-right: 20px;

				.zdy-zdy-wrap {
					.zdy-zdy {
						height: auto;
						margin-right: 20px;
						display: inline-table;
						.zdy-name {
							bottom: 0;
							// background-color: blanchedalmond;
							border:1px solid #E6E6E6
						}
					}
					.zdy-zdy:last-child {
						margin-right: 0;
					}
				}
				.zdy-name {
					width: calc;
					height: 40px;
					// background-color: rosybrown;
					border:1px solid #E6E6E6
				}
			}
			.column-reverse {
				display: flex;
				flex-direction: column-reverse;
			}
		}

		// 公共部分样式 start
		.chTable {
			// position: relative;
			tr {
				.floor {
					background-color: blanchedalmond;
				}
				td {
					min-width: 124px;
					height: 64px;
					line-height: 64px;
					text-align: center;
					cursor: pointer;
					position: relative;
					.hqszt{
						display: inline-block;
						width: 16px;
						height: 16px;
						font-size: 12px;
						line-height: 16px;
						position: absolute;
						left: 6px;
						top: 6px;
						border: 1px solid;
						border-radius: 8px;
					}
					.lin{
						color:#F7B500;
						border-color: #F7B500;
					}
					.zheng{
						color: #1AD6E1;
						border-color: #1AD6E1;
					}
					.xian{
						color: #45AEFD;
						border-color: #45AEFD;
					}
				}
				.tdSelect {
					border: 1px solid #006cff !important;
					background-image: url("../../../../../assets/tdSelect.png");
					background-repeat: no-repeat;
					background-position: right top;
					background-size: 30px;
				}
				.hasBorder {
					border-width: 1px;
					border-style: solid;
				}
			}
		}
		.name {
			line-height: 40px;
			text-align: center;
			display: table-footer-group;
		}
		// end
	}
	.column-reverse {
		display: flex;
		flex-direction: column-reverse;
	}
	.zrz {
		height: 60px;
		line-height: 60px;
		background-color: #ffffff;
		border:1px solid #E6E6E6;
		position: relative;
		bottom: 66px;
		text-align: center;
		transition: 0.5s;
	}
	.cantHb{
		opacity: .5;
		cursor: not-allowed;
	}
	.btnGroup {
		margin: 20px auto 0;
		width: 150px;
	}
}
</style>