<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="预警基本信息" titleFontSize="0.8rem" type="line" style="width: 100%;">
				<uCard :is-shadow="false" title="预警名称">
					<text class="uni-body">{{warnInfo.warnName}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警时间">
					<text class="uni-body">{{warnInfo.warnTime}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警等级">
					<text class="uni-body">{{warnInfo.warnLevelCode}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警信息">
					<text class="uni-body">{{warnInfo.warnInfo}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警状态">
					<text class="uni-body">{{warnInfo.warnStatusText}}</text>
				</uCard>
				<uCard :is-shadow="false" title="审核状态">
					<text class="uni-body">{{warnInfo.reviewStatusText}}</text>
				</uCard>
				<uCard :is-shadow="false" title="站类">
					<text class="uni-body">{{warnInfo.typeText}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警类别">
					<text class="uni-body">{{warnInfo.warnSort}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警定位">
					<text class="uni-body">{{warnInfo.warnLocation}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警政区">
					<text class="uni-body">{{warnInfo.warnAdcd}}</text>
				</uCard>
				<uCard :is-shadow="false" title="用户政区">
					<text class="uni-body">{{warnInfo.userAdcd}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警点经度">
					<text class="uni-body">{{warnInfo.warnLgtd}}</text>
				</uCard>
				<uCard :is-shadow="false" title="预警点纬度">
					<text class="uni-body">{{warnInfo.warnLttd}}</text>
				</uCard>
				<uCard :is-shadow="false" title="备注">
					<text class="uni-body">{{warnInfo.remark}}</text>
				</uCard>
			</uSection>
			<uSection title="雨情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
				<uCard :is-shadow="false" title="雨量站预警频率">
					<text class="uni-body">{{warnInfo.rainWarnRateText}}</text>
				</uCard>
				<uCard :is-shadow="false" title="降雨时段">
					<text class="uni-body">{{warnInfo.intv}}</text>
				</uCard>
				<uCard :is-shadow="false" title="时段降水">
					<text class="uni-body">{{warnInfo.drp}}</text>
				</uCard>
			</uSection>
			<uSection title="河道水情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
				<uCard :is-shadow="false" title="河道水位">
					<text class="uni-body">{{warnInfo.z}}</text>
				</uCard>
				<uCard :is-shadow="false" title="河道流量">
					<text class="uni-body">{{warnInfo.q}}</text>
				</uCard>
				<uCard :is-shadow="false" title="河道水势">
					<text class="uni-body">{{warnInfo.wptn}}</text>
				</uCard>
			</uSection>
			<uSection title="水库水情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
				<uCard :is-shadow="false" title="库上水位">
					<text class="uni-body">{{warnInfo.rz}}</text>
				</uCard>
				<uCard :is-shadow="false" title="水库水势">
					<text class="uni-body">{{warnInfo.rwptn}}</text>
				</uCard>
				<uCard :is-shadow="false" title="水库流量">
					<text class="uni-body">{{warnInfo.inq}}</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.id = options.id;
			console.log("iiiiiiiiiiiii " + this.id)
			this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;

			this.getWarnInfo();
		},
		data() {
			return {
				id: '',
				baseURL: '',

				warnInfo: {

				},
				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;
			},
			getWarnInfo() {
				var that = this;
				var postData = {};
				postData['id'] = this.id;
				console.log("iiiiiiiiiiiii " + this.id)
				http.request({
					url: '/galaxy-test/rtu/warning/original/detail',
					method: 'GET',
					data: postData
				}).then(res => {
					console.log(res)
					if (res.data != null) {
						that.warnInfo = res.data;
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>
	/* page {
		background-color: rgb(240, 242, 244);
	} */
	.uni-body {
		font-size: 0.7rem;
	}

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

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

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

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

	.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;
	}
</style>

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

	.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>
