index.vue 9.24 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
<template>
	<div class="edit">
		<div class="tab-header">
			<div class="searchContent">
				<el-radio-group v-model="radio1">
					<el-radio-button class="radioBtn" label="1" border
						>实测</el-radio-button
					>
					<el-radio-button class="radioBtn" label="2" border
						>预测</el-radio-button
					>
				</el-radio-group>
				<el-input
					v-model="bdcdyh"
					class="searchInput"
					placeholder="输入不动产单元号"
				></el-input>
			</div>
			<div>
				<el-button class="radioBtn" label="1" @click="create" border
					>创建楼盘</el-button
				>
				<el-button class="radioBtn" label="2" border>实预测转换</el-button>
				<el-button class="radioBtn" label="3" border>批量户</el-button>
				<el-button class="radioBtn" label="4" border>批量层</el-button>
				<el-button class="radioBtn" label="5" border>批量室号</el-button>
				<el-button class="radioBtn" label="6" border>批量坐落</el-button>
				<el-button class="radioBtn" label="7" border>批量单元号</el-button>
			</div>
		</div>
		<div
			class="tab-content"
			ref="tabContent"
			:style="{ height: lpbContentHight + 'px' }"
		>
			<!-- 左侧树结构 -->
			<div class="lp-tree" :class="createFlag ? 'w260' : 'w0'">
				<LineTree :pd="pd" class="treeData" :islpb="islpb"></LineTree>
				<p
					@click="createFlag = false"
					style="width:20px;float:left;margin-top: 12px;margin-left:10px;cursor:pointer;"
				>
					X
				</p>
			</div>
			<!-- 楼盘表主体 -->
			<div class="lp-overview" :style="{ width: lpbContentwidth + 'px' }">
				<lpbContent></lpbContent> 
			</div>
			<!-- 右侧图例 -->
			<div class="lp-legend">
				<div class="handleCol">
					<div class="btn" @click="legendToggle">
						<i v-show="!legendToggleFlag" class="el-icon-d-arrow-left"></i>
						<i v-show="legendToggleFlag" class="el-icon-d-arrow-right"></i>
					</div>
					<div class="dyzt">
						<span>单元状态</span>
					</div>
					<div class="fwxz">
						<span>房屋性质</span>
					</div>
					<div class="fwyt">
						<span>房屋用途</span>
					</div>
				</div>
				<div
					class="legendTable-wrap"
					:style="{ width: legendToggleFlag ? '204px' : '0' }"
				>
					<table class="legendTable" cellspacing="1" cellpadding="1" border="1">
						<tr>
							<th>状态</th>
							<th>套数</th>
							<th>面积</th>
						</tr>
						<tr v-for="(item, index) in legendList" :key="index">
							<td>
								<i class="el-icon-star-on" :style="{ color: item.color }"></i
								>{{ item.name }}
							</td>
							<td>{{ item.ts }}</td>
							<td>{{ item.mj }}</td>
						</tr>
					</table>
				</div>
			</div>
		</div>

		<el-dialog title="添加" :visible.sync="dialogVisible" width="50%" center>
			<!-- 根据菜单类型(menuType)和右键点击的楼盘类型(treeData.type)来区分弹框内容  -->
			<div class="addCh" v-show="menuType == 'ljz'">
				<addLjz ref="ljz"></addLjz>
			</div>
			<div class="addCh" v-show="menuType == 'zdy'">
				<addZdy ref="zdy"></addZdy>
			</div>
			<div class="addCh" v-show="menuType == 'ch'">
				<addCh ref="ch" :dialogVisible="dialogVisible" :treeData="treeData"></addCh>
			</div>
			<div class="btnGroup">
				<el-button type="primary" @click="saveInfo">保存</el-button>
				<el-button type="primary" @click="resetInfo">重置</el-button>
				<el-button type="primary" @click="dialogVisible = false"
					>取消</el-button
				>
			</div>
		</el-dialog>
	</div>
</template>

<script>
import LineTree from "../../../../components/lineTree/lineTree";
import addLjz from "./ljz/index";
import addZdy from "./zdy/index";
import addCh from "./ch/index";
import lpbContent from "./lpbContent/index";
import { getLpbMenuTree } from "../../../../api/lpb";
export default {
	name: "",
	components: { LineTree, addLjz, addZdy, addCh, lpbContent },
	props: {},
	data() {
		return {
			radio1: "",
			radio2: "",
			createFlag: false,
			bdcdyh: "",
			islpb: true,
			pd: [], //创建楼盘的树结构数据
			dialogVisible: false,
			menuType: "",
			treeData: {},
			legendList: [
				{
					name: "未确权",
					color: "#2591FD",
					ts: "12",
					mj: "1633",
				},
				{
					name: "已确权",
					color: "#2591FD",
					ts: "22",
					mj: "3109",
				},
				{
					name: "已注销",
					color: "#2591FD",
					ts: "13",
					mj: "1457",
				},
				{
					name: "已备案",
					color: "#2591FD",
					ts: "3",
					mj: "409",
				},
				{
					name: "预抵押",
					color: "#2591FD",
					ts: "11",
					mj: "1466",
				},
				{
					name: "在建抵押",
					color: "#2591FD",
					ts: "13",
					mj: "1792",
				},
				{
					name: "抵押",
					color: "#2591FD",
					ts: "14",
					mj: "13",
				},
				{
					name: "查封",
					color: "#2591FD",
					ts: "9",
					mj: "1436",
				},
				{
					name: "异议",
					color: "#2591FD",
					ts: "34",
					mj: "4342",
				},
				{
					name: "限制",
					color: "#2591FD",
					ts: "2",
					mj: "285",
				},
			],
			legendToggleFlag: false,
			lpbContentHight: "",
			lpbContentwidth: "",
		};
	},
	created() {
		window.addEventListener("resize", this.getHeight);
		this.getHeight();
	},
	mounted() {
		this.getLpbMenuTree("1e0c83dfe2e73284f834a80a0947f0c9");
		// 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6
		setTimeout(() => {
			this.lpbContentwidth = this.$store.state.contentWidth - 34 - 6; 
		}, 100);
	},
	methods: {
		//获取高度计算lpb内容区高度
		getHeight() {
			this.lpbContentHight = window.innerHeight - 340;
		},
		//创建楼盘
		create() {
			this.createFlag = true;
		},
		//获取自然幢树结构数据
		getLpbMenuTree(zrzbsm) {
			getLpbMenuTree(zrzbsm)
				.then((res) => {
					this.pd = res.result;
				})
				.catch((error) => {});
		},
		//打开新建楼盘树结构右键菜单唤起的弹框
		openLpbDialog(data, type) {
			this.treeData = data;
			this.menuType = type;
			this.dialogVisible = true;
		},
		//弹框中的保存按钮,根据不同菜单点击类型调用不同子组件的保存方法
		saveInfo() {
			switch (this.menuType) {
				case "ljz":
					this.$refs.ljz.onSave(this.$refs.ljz.form, this.treeData.bsm);
					break;
				case "zdy":
					this.$refs.zdy.submitForm("form", this.pd[0].bsm, this.treeData.bsm);
					break;
				case "ch":
					this.$refs.ch.onSave(this.pd[0].bsm);
					break;
				default:
					break;
			}
		},
		//弹框中的重置按钮
		resetInfo() {
			switch (this.menuType) {
				case "ljz":
					this.$refs.ljz.reset();
					break;
				case "zdy":
					this.$refs.zdy.reset();
					break;
				case "ch":
					this.$refs.ch.reset();
					break;

				default:
					break;
			}
		},
		//关闭弹框
		closeDaialog() {
			this.dialogVisible = false;
		},
		//图例的展开收起
		legendToggle() {
			this.legendToggleFlag = !this.legendToggleFlag;
		},
	},
	computed: {
	},
	destroyed() {
		window.removeEventListener("resize", this.getHeight);
	},
	watch: {
		//树结构和图例伸缩时修改楼盘表主要内容区宽度
		legendToggleFlag(n) {
			if (n) {
				this.lpbContentwidth -= 204;
			} else {
				this.lpbContentwidth += 204;
			}
		},
		createFlag(n) {
			if (n) {
				this.lpbContentwidth -= 260;
			} else {
				this.lpbContentwidth += 260;
			}
		},
	},
};
</script>
<style scoped lang="less">
.edit {
	height: 100%;
	background-color: #eaedf5;
	.tab-header {
		border: 1px solid #dedede;
		border-top: 0;
		box-sizing: border-box;
		padding: 20px 0;
		background-color: #ffffff;
		margin-bottom: 20px;
		.searchContent {
			margin-bottom: 20px;
			.searchInput {
				width: 300px;
				margin-left: 20px;
				display: inline-block;
			}
		}
		.radioBtn {
			margin-left: 20px;
			/deep/.el-radio-button__inner {
				border: 1px solid #dcdfe6;
				border-radius: 4px;
				box-shadow: 0 0 0 0 #409eff !important;
			}
		}
	}
	.tab-content {
		background-color: #ffffff;
		display: flex;
		overflow-y: scroll;
		.lp-tree {
			height: 100%;
			overflow: hidden;
			transition: 0.5s;
			.treeData {
				margin-top: 20px;
				margin-left: 20px;
				float: left;
			}
		}
		.w0 {
			width: 0;
		}
		.w260 {
			width: 260px;
		}
		.lp-overview {
			transition: 0.5s;
			flex: 1;
		}
		.lp-legend {
			transition: 0.5s;
			height: 100%;
			font-size: 14px;
			.handleCol {
				width: 34px;
				float: right;
				height: 100%;
				.btn {
					cursor: pointer;
					height: 40px;
					line-height: 40px;
					text-align: center;
					border-bottom: 1px solid #e6e6e6;
				}
				.dyzt {
					height: 81px;
					line-height: 81px;
				}
				.fwxz,
				.fwyt {
					height: 122px;
				}
				.dyzt,
				.fwxz,
				.fwyt {
					border-bottom: 1px solid #e6e6e6;
					span {
						text-align: center;
						height: 100%;
						-webkit-writing-mode: vertical-rl;
						writing-mode: vertical-rl;
						line-height: 34px;
						letter-spacing: 2px;
					}
				}
			}
			.legendTable-wrap {
				transition: 0.5s;
				float: right;
				overflow: hidden;
				.legendTable {
					margin-top: -1px;
					tr {
						height: 40px;
						line-height: 40px;
						th:first-child {
							width: 80px;
						}
						th {
							width: 60px;
							height: 40px;
							white-space: nowrap;
						}
						td {
							height: 40px;
							text-align: center;
							white-space: nowrap;
						}
						td:first-child {
							text-align: left;
							text-indent: 2px;
						}
					}
				}
			}
		}
	}
	.btnGroup {
		margin: 20px auto 0;
		width: 230px;
	}
}
</style>