<template>
	<view class=""> 
	<navInfo  :title="'隐患详情'"></navInfo>
	<view class="bgTopImg">
		<image  slot="right" :src="`${urls}/navBg@2x.png`" class="bgTopImg"></image> 
	</view>
	<view class="  uni-container">
		<view class=" flex  flex-direction width100">
			<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
			<u--form ref="uForm" :model="formData" labelPosition="left" labelWidth="90" labelAlign="left">
				<view class="" >
					<u-form-item label="检查项名称" prop="name" ref="item1">
						<text class="text-1cut padding-sm">{{formData.inspName}}</text>
					</u-form-item>
					<u-form-item label="检查日期" prop="inspectTime" ref="item1">
						<text class="text-1cut padding-sm"> {{formData.inspectTime}} </text>
					</u-form-item>
					<u-form-item label="检查内容" prop="description" ref="item1">
						<text class="  padding-sm"> {{formData.description}}</text>
					</u-form-item> 
					<view class="dashedBox">
						<view class="dashedLine">
						</view>
					</view>
					<u-form-item label="检查结果" prop="result" ref="item1" labelPosition="top">
						<view class="flex flex-wrap padding-top-sm ">
							<view v-for="(item,index) in formData.hisResultList" :key="index"
								class="flex flex-direction-row align-center padding-lr-sm">
								<u--image :showLoading="true" :src="item.resValue==1?zhengchang:moren" width="34rpx" height="34rpx"></u--image>
								<text class="text-1cut padding-left-sm ">{{item.resLable}}</text>
							</view>
						</view>
					</u-form-item>
					<view class="padding-top-sm">
						<view class="">
							<text>现场照片：</text>
							<view class="padding-tb-sm">
								<view class="dashedBox ">
									<view class="dashedLine">
									</view>
								</view>
							</view>
						<view class="  flex flex-direction-row"> 
							<view class="padding-lr-lg" v-for="(item,index) in formData.imgUrlList" :key="index">
								<image :src="item.imgUrl" style="width:120rpx;height: 120rpx;"></image>
								 <!-- <u-album :urls="item.imgUrl"></u-album> 不显示-->
							</view>
						</view>
						</view>
					</view>
				</view>
			</u--form>
		</view>
		<!-- 加载中 -->
		<isLodingModel></isLodingModel>
	</view>
	</view>
</template>
<script>
	import navInfo from '@/pagesA/components/my-nav/nav'
	import {
		getOneDenger, // 获得单个隐患详情
	} from "@/api/hiddenTrouble";
	import {
		dangerDetailbyFpd, //   隐患查看详情(消防设施)  
		dangerDetail //  隐患查看详情 
	} from "@/api/hiddenTrouble";
	import {
		uploadAvatar
	} from "@/api/system/user"
	import {
		DICT_TYPE,
		getDictDatas
	} from "@/utils/dict";
	let that = null;
	import config from '@/config'
	const baseUrlImg=config.baseUrlImg
	export default {
		components: {
			navInfo
		},
		data() {
			return {
				urls:baseUrlImg,
				moren: `${baseUrlImg}/checkActive/moren.png`, //默认图片
				zhengchang: `${baseUrlImg}/checkActive/zhengchang.png`,
				// 数据加载中
				loading: false,
				formData:{},
				// 自定义表单数据
				// formData: {
				// 	id: '',
				// 	name: '',
				// 	position: '',
				// 	time: '',
				// 	description: '',
				// 	status: '',
				// 	people: '',
				// 	imgUrlList: [],
				// },
			}
		},
		watch: {
			loading: {
				handler(newLength, oldLength) {
					this.$modal.isLoadingModel(this.loading)
				},
				immediate: true
			}
		},
		computed: {},
		//目的页面接收
		//这里用onshow()也可以
		onLoad(options) {
			console.log("options: ", options);
			var data = options.id;
			console.log(data)
			this.getData(data)
		}, 
		onReady() {},
		methods: {
			// =================数据转换================== 
			// =============获取数据===================s
			// =============获取数据===================s
			// 获取数据
			getData(id) {
				console.log('id', id);
				this.loading = true
				dangerDetail({
					dangerId: id
				}).then(response => {
					console.log(response);
					// 为数据赋值：通过展开运算符的形式，进行新旧数据的拼接 
					this.formData = response.data ? response.data : {},
					this.loading = false;
				});
			}, 
		}
	}
</script>
<style lang="scss">
	.buttomBorder {
		height: 0px;
		border: 1px dashed #CBD5E1;
	}

	.dashedBox {
		padding: 0px 30rpx;
	}

	.dashedLine {
		height: 3px;
		background-image: linear-gradient(to right, #d7d6d6 0%, #d7d6d6 50%, rgba(196, 196, 196, 0) 50%);
		background-size: 40px 2px;
		background-repeat: repeat-x;
	}

	.itemunirow {
		.uni-row {
			padding-bottom: 10px;
		}
	}
	.uni-container {
		padding: 10px;
		border-radius: 30px 30px 0px 0px;
		background: #fff;
		/*#ifdef H5*/
		margin-top: 50rpx;
		/* #endif */
		/* #ifdef  MP-WEIXIN*/
		margin-top: 100rpx;
		/* #endif */
		z-index: 9999999;
		position: relative;
	}
</style>
