<template>
	<view :style="{height:'100vh',overflow:'hidden',backgroundColor: '#f0f0f0'}">
		<u-status-bar></u-status-bar>
		<u-navbar :title="list[0].typeName" :autoBack="true" :titleStyle="{
				fontSize:'18px'
			}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
		</u-navbar>
		<view class="" style="margin-top: 44px;border-top: 1px solid #f0f0f0;">
			<view class="" v-for="(item,i) in list" :key="i" style="margin: 10px;background-color: #fff;padding: 10px;">
				<view class="item">
					<text>{{item.typeName}}</text>
					<text>{{item.warnTime}}</text>
					
				</view>
				<view class="contentItem">
					<view class="itemC">
						<text>阈值上限:</text>
						<text>{{item.upperLimit}}</text>
					</view>
					<view class="itemC">
						<text>监测值({{getUnit(item.typeName)}}):</text>
						<text>{{item.val}}</text>
					</view>
					<view class="itemC">
						<text>阈值下限:</text>
						<text>{{item.lowerLimit}}</text>
					</view>
				</view>
			</view>

		</view>
		<u-calendar :show="show" mode="range" @confirm="confirm" @cancel='cancel'></u-calendar>
	</view>
</template>

<script>
	import moment from 'moment'

	export default {
		data() {
			return {
				show: false,
				model: {
					stm: '',
					etm: ''
				},
				customStyle: {
					background: '#000'
				},
				list: []
			};
		},
		onLoad(options){
			this.list = JSON.parse(decodeURIComponent(options.list))
		},
		methods: {
			confirm(e) {
				console.log(e);
				this.model.stm = e[0]
				this.model.etm = e[1]
				this.show = false
			},
			cancel() {
				this.show = false
			},
	      getUnit(type){
			let unit = 'm³/s';
			if(type == '闸后流量'){
				unit = 'm³/s';
			}else if(type == '结构缝开度'){
				unit = 'mm'
			}else{
				unit = 'm'
			}
			return unit;
		  }
		}
	}
</script>

<style lang="scss" scoped>
	.myTitleStyle {
		font-size: 30px;
		background-color: red;
		height: 200px;
	}

	.tabsClass {
		margin-top: 44px;
		height: 44px;
		padding: 0 40px;
		border-top: 1px solid #eee;
		border-bottom: 1px solid #eee;
	}

	.item {
		border-bottom: 1px solid #f0f0f0;
		padding-bottom: 10px;
		display: flex;
		justify-content: space-between;

		.title {
			border-width: 0px;
			font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
			font-weight: 700;
			font-style: normal;
			font-size: 15px;
			color: #666666
		}

		.titleRight {
			display: flex;

		}

	}
	.contentItem{
		display: flex;
		flex-wrap: wrap;
		.itemC{
			display: flex;
			justify-content: space-between;
			display: flex;
			color: #666666;
			padding: 10px;
		}
	}
</style>