<template>
	<view class=" uni-container">
		<view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
			<!-- 自定义表单校验 1-->
			<u--form :model="formData" labelPosition="top" labelWidth="300" labelAlign="left">
				<view class=" flex  flex-direction width100">
					<u-form-item label="名称 (示例:Xx宾馆)" :required="true" prop="mc">
						<u-input v-model="formData.mc" disabled placeholder="名称" />
					</u-form-item>
					<u-form-item label="所在建筑名称 (示例:Xx商住楼)" :required="true">
						<u-input v-model="formData.szjzmc" disabled placeholder="所在建筑名称" />
					</u-form-item>
					<u-form-item label="消防安全管理人及联系电话" :required="true" prop="xfaqglr">
						<u-input v-model="formData.xfaqglr" disabled placeholder="消防安全管理人及联系电话" />
					</u-form-item>
					<u-form-item label="消防安全责任人及联系电话	" :required="true" prop="xfaqzrr">
						<u-input v-model="formData.xfaqzrr" disabled placeholder="消防安全责任人及联系电话" />
					</u-form-item>
					<u-form-item label="类别 (示例:宾馆)">
						<u-input v-model="formData.lb" placeholder="类别" disabled />
					</u-form-item>
					<u-form-item label="性质 (示例:其他个体工商户)">
						<u-input v-model="formData.xz" disabled placeholder="性质" />
					</u-form-item>
					<u-form-item label="地址"><u-input v-model="formData.dz" disabled placeholder="地址" /></u-form-item>
					<u-form-item label="使用楼层、面积">
						<u-input v-model="formData.sylcmj" disabled placeholder="使用楼层、面积" />
					</u-form-item>
					<u-form-item label="消防设施器材情况">
						<u-input v-model="formData.xfssqc" disabled placeholder="消防设施器材情况" />
					</u-form-item>
					<u-form-item label="备注">
						<u-textarea auto-height maxlength="-1" disabled v-model="formData.remark"
							placeholder="备注"></u-textarea>
					</u-form-item>
				</view>
			</u--form>
		</view>
		<uni-row class="heigthButton">
			<u-button
						@click="gotoEditArchive(formData)"
						shape="circle"
						size="large"
						color="#4cb2b6"
						text="修改信息"
						style="width: 60%;"
					></u-button>
		</uni-row>
	</view>
</template>
<script>

var that = null;
export default {
	data() {
		return {
		formData: {
			orgName: ''
		},
		screenHeight: this.$screenHeight,
		wheight: '',
		};
	},
	mounted() {
		uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
			this.wheight = data.height
		}).exec()
	},
	onLoad: function(option) {
		that = this;
		var data = option.id;
		// 接收来自上个页面传递的参数
		const eventChannel = this.getOpenerEventChannel();
		eventChannel.on('acceptDataFromOpenerPage', function(val) {
			that.formData = val;
			console.log('val+++++++++++++++++++', that.formData);
		});
		this.formData.orgName = option.orgName;
		console.log('option: ', that.formData);
	},

	methods: {
		// 传递当前页面数据到 ‘修改信息’
		gotoEditArchive(val) {
			uni.navigateTo({
				url: '/pagesA/fire/archive/edit_archive/edit_archive3',
				events: {
					// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
					acceptDataFromOpenedPage: function(val) {
						this.formData = val;
					}
				},
				success: function(res) {
					// 通过eventChannel向被打开页面传送数据
					res.eventChannel.emit('acceptDataFromOpenerPage', val);
				}
			});
		}
	}
};
</script>
<style lang="scss" scoped>
	page{
		background-color: #F5F7F9;
	}
.container {
	position: relative;
	// height: 220vh;
	background-color: rgb(245, 247, 249);
	overflow: auto;
	.buju {
		margin: 40rpx 0;
	}
}

.cont {
}

.weiwan {
	color: #d51a52;
	background: rgba(213, 26, 82, 0.2);
	padding: 5rpx 20rpx;
	border-radius: 2px;
	border: 1px solid #d51a52;
}

.yiwan {
	color: #4cb2b6;
	background: rgba(76, 178, 182, 0.2);
	padding: 5rpx 20rpx;
	border-radius: 2px;
	border: 1px solid #4cb2b6;
}

.miaoshu {
	margin-right: 20rpx;
	color: #274647;
	font-weight: 600;
}
</style>
