<template>
	<view class="container">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
				<text style="color: white;font-size: 1rem;">{{title}}</text>
			</view>
		</uni-nav-bar>
		<uni-forms ref="baseForm">
			<uSection title="巡检总结情况" ftitleFontSize="0.8rem" type="line" style="width: 100%;">
				<uCard :is-shadow="false">
					<text class="uni-body">{{reportInfo.reportDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.basePhoto1Take ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.basePhoto1Url)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">图片一</text>
							</view>
						</view>
					</template>
				</uCard>
				<uCard v-if="reportInfo.basePhoto2Take ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.basePhoto2Url)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">图片二</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection title="RTU设备信息" ftitleFontSize="0.8rem" type="line" style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.rtuStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="品牌" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rtuBrand}}</text>
				</uCard>
				<uCard title="型号" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rtuModel}}</text>
				</uCard>
				<uCard title="更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rtuReplaceDate}}</text>
				</uCard>
				<uCard title="上报到县市省" :is-shadow="false">
					<view style="display: flex; flex-direction: row;align-items: center;">
						<view v-if="reportInfo.datagramToLevel1">
							<text>发往县</text>
							<text style="margin-left: 5px;margin-right: 5px;">/</text>
						</view>
						<view v-if="reportInfo.datagramToLevel2">
							<text>发往市</text>
							<text style="margin-left: 5px;margin-right: 5px;">/</text>
						</view>
						<view v-if="reportInfo.datagramToLevel3">
							<text>发往省</text>
							<text style="margin-left: 5px;margin-right: 5px;">/</text>
						</view>
					</view>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rtuDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.rtuPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.rtuPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">RTU图片</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection v-if="reportInfo.rainSensorActive ==1" title="雨量传感器" ftitleFontSize="0.8rem" type="line"
				style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.rainSensorStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="品牌" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rainSensorBrand}}</text>
				</uCard>
				<uCard title="型号" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rainSensorModel}}</text>
				</uCard>
				<uCard title="更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rainSensorReplaceDate}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.rainSensorDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.rainSensorPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.rainSensorPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">雨量传感器图片</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection v-if="reportInfo.waterLevelSensorActive ==1" title="水位传感器" ftitleFontSize="0.8rem" type="line"
				style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.waterLevelSensorStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="品牌" :is-shadow="false">
					<text class="uni-body">{{reportInfo.waterSensorBrand}}</text>
				</uCard>
				<uCard title="型号" :is-shadow="false">
					<text class="uni-body">{{reportInfo.waterSensorModel}}</text>
				</uCard>
				<uCard title="传感器类型" :is-shadow="false">
					<text class="uni-body">{{reportInfo.waterSensorTypeText}}</text>
				</uCard>
				<uCard title="更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.waterSensorReplaceDate}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.waterSensorDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.waterSensorPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.waterSensorPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">水位传感器图片</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection v-if="reportInfo.groundWaterSensorActive ==1" title="墒情传感器" ftitleFontSize="0.8rem" type="line"
				style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.groundWaterSensorStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="品牌" :is-shadow="false">
					<text class="uni-body">{{reportInfo.groundSensorBrand}}</text>
				</uCard>
				<uCard title="型号" :is-shadow="false">
					<text class="uni-body">{{reportInfo.groundSensorModel}}</text>
				</uCard>
				<uCard title="传感器类型" :is-shadow="false">
					<text class="uni-body">{{reportInfo.groundSensorTypeText}}</text>
				</uCard>
				<uCard title="更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.groundSensorReplaceDate}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.groundSensorDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.groundSensorPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.groundSensorPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">墒情传感器图片</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection title="供电系统" ftitleFontSize="0.8rem" type="line" style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.powerStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="蓄电池容量(AH)" :is-shadow="false">
					<text class="uni-body">{{reportInfo.batteryModel}}</text>
				</uCard>
				<uCard title="蓄电池更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.batteryReplaceDate}}</text>
				</uCard>
				<uCard title="太阳能板功率(W)" :is-shadow="false">
					<text class="uni-body">{{reportInfo.sunPowerModel}}</text>
				</uCard>
				<uCard title="太阳能板更换时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.sunPowerReplaceDate}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.powerDesc}}</text>
				</uCard>
				<uCard v-if="reportInfo.batteryPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.batteryPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">蓄电池图片</text>
							</view>
						</view>
					</template>
				</uCard>
				<uCard v-if="reportInfo.sunPhotoTake ==1" padding="0" spacing="0" :is-shadow="false">
					<template v-slot:cover>
						<view class="custom-cover">
							<image class="cover-image" style="width: 100%;" mode="aspectFill"
								:src="toOss(reportInfo.sunPhotoUrl)">
							</image>
							<view class="cover-content" style="text-align: center;">
								<text class="uni-subtitle uni-white" style="color: gray;">太阳能板图片</text>
							</view>
						</view>
					</template>
				</uCard>
			</uSection>
			<uSection v-if="reportInfo.networkActive ==1" title="4G移动网络" ftitleFontSize="0.8rem" type="line"
				style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.networkStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="SIM卡号" :is-shadow="false">
					<text class="uni-body">{{reportInfo.simCcid}}</text>
				</uCard>
				<uCard title="开卡单位" :is-shadow="false">
					<text class="uni-body">{{reportInfo.simPay}}</text>
				</uCard>
				<uCard title="缴费截止时间" :is-shadow="false">
					<text class="uni-body">{{reportInfo.simPayEndDate}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.networkDesc}}</text>
				</uCard>
			</uSection>
			<uSection v-if="reportInfo.satelliteActive ==1" title="北斗通讯" ftitleFontSize="0.8rem" type="line"
				style="width: 100%;">
				<template v-slot:right>
					<view style="padding-right: 15px;">
						<text style="font-size: 0.7rem;color: gray;">运行状态:</text>
						<text v-if="reportInfo.satelliteStatus == 0"
							style="font-size: 0.7rem;color: green;margin-left: 4px;">正常</text>
						<text v-else style="font-size: 0.7rem;color: orangered;margin-left: 4px;">故障</text>
					</view>
				</template>
				<uCard title="通讯模式" :is-shadow="false">
					<text class="uni-body">{{reportInfo.satelliteModelText}}</text>
				</uCard>
				<uCard title="备注说明" :is-shadow="false">
					<text class="uni-body">{{reportInfo.satelliteDesc}}</text>
				</uCard>
			</uSection>
		</uni-forms>
	</view>
</template>

<script>
	import http from '@/http/api.js';
	import {
		pathToBase64,
		base64ToPath
	} from '@/js_sdk/mmmm-image-tools/index.js';
	import {
		oss,
		devUrl,
		prodUrl
	} from '@/common/setting';

	import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
	import uDataPicker from '@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue'
	import uGroup from '@/uni_modules/uni-group/uni-group.vue'
	import uSection from '@/uni_modules/uni-section/uni-section.vue'
	import uPagination from '@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue'
	import uBreadcrumb from '@/uni_modules/uni-breadcrumb/components/uni-breadcrumb/uni-breadcrumb.vue'
	import uList from '@/uni_modules/uni-list/components/uni-list/uni-list.vue'
	import uListItem from '@/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue'
	import uIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
	import uCard from '@/uni_modules/uni-card/components/uni-card/uni-card.vue'
	export default {
		components: {
			uNavBar,
			uDataPicker,
			uPagination,
			uBreadcrumb,
			uList,
			uListItem,
			uIcons,
			uGroup,
			uSection,
			uCard,
		},
		onLoad(options) {
			this.reportId = options.id;
			//this.rtuCode = options.rtuCode;
			this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
			//初始化巡检填报字典
			//this.getReportDict();
			//查询计划信息
			//this.getPlanInfo();
			this.getReportInfo();
		},
		data() {
			return {
				baseURL: '',
				reportId: 0,
				reportInfo: {
					reportDesc: '测试测试',
					basePhoto1Url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					basePhoto1Take: true,
					basePhoto2Url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					basePhoto2Take: true,

					rtuStatus: 0,
					rtuDesc: '测试测试',
					rtuBrand: '测试测试',
					rtuModel: '测试测试',
					rtuReplaceDate: '2022-08-15 12:00:00',
					datagramToLevel1: 1,
					datagramToLevel2: 0,
					datagramToLevel3: 1,
					rtuPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					rtuPhotoTake: true,

					rainSensorActive: 1,
					rainSensorStatus: 0,
					rainSensorDesc: '测试测试',
					rainSensorReplaceDate: '2022-08-15 12:00:00',
					rainSensorBrand: '测试测试',
					rainSensorModel: '测试测试',
					rainSensorPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					rainSensorPhotoTake: true,

					waterSensorBrand: '测试测试',
					waterSensorModel: '测试测试',
					waterSensorTypeText: '测试测试',
					waterSensorReplaceDate: '2022-08-15 12:00:00',
					waterSensorDesc: '测试测试',
					waterSensorPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					waterSensorPhotoTake: true,
					waterLevelSensorActive: 1,
					waterLevelSensorStatus: 1,

					groundSensorBrand: '测试测试',
					groundSensorModel: '测试测试',
					groundSensorTypeText: '测试测试',
					groundSensorReplaceDate: '2022-08-15 12:00:00',
					groundSensorDesc: '测试测试',
					groundSensorPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					groundSensorPhotoTake: true,
					groundWaterSensorActive: 1,
					groundWaterSensorStatus: 0,

					batteryModel: '测试测试',
					batteryReplaceDate: '2022-08-15 12:00:00',
					sunPowerModel: '测试测试',
					sunPowerReplaceDate: '2022-08-15 12:00:00',
					batteryPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					batteryPhotoTake: true,
					sunPhotoUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
					sunPhotoTake: true,
					powerDesc: '测试测试',
					powerStatus: 0,

					simCcid: '11111111111',
					simPay: '测试测试',
					simPayEndDate: '2022-08-15 12:00:00',
					networkDesc: '111',
					networkStatus: 0,
					networkActive: 1,

					satelliteModelText: '测试测试',
					satelliteStatus: 0,
					satelliteDesc: '测试测试',
					satelliteActive: 1,
				},
				title: '巡检填报详情',
				desc: '',
			}
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			},
		},
		onShow() {},
		created() {

		},
		methods: {
			toOss(path) {
				return oss + path;
			},
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			dateFormat(dt) {
				var text = "" + dt.getFullYear();
				text += "-";
				text += ((dt.getMonth() + 1) < 10) ? ("0" + (dt.getMonth() + 1)) : (dt
					.getMonth() +
					1);
				text += "-";
				text += dt.getDate() < 10 ? "0" + dt.getDate() : dt.getDate();
				text += " ";
				text += dt.getHours() < 10 ? "0" + dt.getHours() : dt.getHours();
				text += ":";
				text += dt.getMinutes() < 10 ? "0" + dt.getMinutes() : dt.getMinutes();
				text += ":";
				text += dt.getSeconds() < 10 ? "0" + dt.getSeconds() : dt.getSeconds();
				return text;
			},
			getReportInfo() {
				var that = this;
				var postData = {};
				postData['id'] = this.reportId;
				http.request({
					url: '/galaxy-test/equipment/inspection/report/detail',
					method: 'GET',
					data: postData
				}).then(res => {
					console.log(res)
					if (res.data != null) {
						that.reportInfo = res.data;
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>
	/* page {
		background-color: rgb(240, 242, 244);
	} */
</style>

<style lang="scss" scoped>
	.container {
		padding: 0 0 50rpx;
	}

	.cell-hover-class {
		background-color: rgb(235, 237, 238);
	}

	.view-flex-rs {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
	}

	.view-flex-rc {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}

	.view-flex-re {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: center;
	}

	.view-flex-cs {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	.view-flex-cc {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.view-flex-ce {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
	}

	.line-body {
		padding-left: 10px;
		padding-right: 10px;
	}

	.required-star {
		color: #FF0000;
		font-size: 15px;
		width: 20px;
		text-align: center;
		padding-left: 0px;
		padding-right: 2px;
	}

	.item-title {
		color: #909399;
		font-size: 15px;
	}

	.mline-text {
		padding-left: 2px;
		width: 100%;
		/* background-color:#909399; */
		height: 70px;
		border: 1px solid #FF5A5F;
		border-radius: 5px;
	}

	.uni-body {
		font-size: 0.7rem;
	}


	.u-cell-icon {
		width: 36rpx;
		height: 36rpx;
		margin-right: 8rpx;
	}

	.slot-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
	}

	.slot-image {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		margin-right: 10px;
		width: 30px;
		height: 30px;
	}

	.slot-text {
		flex: 1;
		font-size: 14px;
		color: #4cd964;
		margin-right: 10px;
	}

	.img-container {
		margin-bottom: 0px;
		width: 100px;
		height: 100px;

		.note-image-box {
			margin-top: 0px;
			display: flex;
			flex-wrap: wrap;
			padding: 10px;

			.note-image-item {
				position: relative;
				width: 100%;
				height: 0;
				padding-top: 100%;
				box-sizing: border-box;
				// background-color: #18B566;


				.close-icon {
					display: flex;
					justify-content: center;
					align-items: center;
					position: absolute;
					right: 0px;
					top: 0px;
					width: 22px;
					height: 22px;
					border-radius: 50%;
					background-color: #d5d5d5;
					z-index: 2;
				}

				.image-box {
					display: flex;
					justify-content: center;

					align-items: center;
					position: absolute;
					top: 5px;
					right: 5px;
					border: 5px;
					left: 5px;
					border: 1px #eee solid;
					border-radius: 5px;
					overflow: hidden;
					width: 98%;
					height: 98%;

				}


			}
		}
	}

	.input-body {
		background-color: #fff;
		padding: 10px;
	}
</style>
