<!--
 * @Title: 
 * @Description: 设备异常信息
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="container">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view class="nav-title">
				<text>{{title}}</text>
			</view>
		</uni-nav-bar>
		<uni-section title="预警基本信息" titleFontSize="0.8rem" type="line" style="width: 100%;">
			<uni-card :is-shadow="false" title="预警名称">
				<text class="uni-body">{{warnInfo.warnName}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警时间">
				<text class="uni-body">{{warnInfo.warnTime}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警等级">
				<text class="uni-body">{{warnInfo.warnLevelCode}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警信息">
				<text class="uni-body">{{warnInfo.warnInfo}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警状态">
				<text class="uni-body">{{warnInfo.warnStatusText}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="审核状态">
				<text class="uni-body">{{warnInfo.reviewStatusText}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="站类">
				<text class="uni-body">{{warnInfo.typeText}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警类别">
				<text class="uni-body">{{warnInfo.warnSort}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警定位">
				<text class="uni-body">{{warnInfo.warnLocation}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警政区">
				<text class="uni-body">{{warnInfo.warnAdcd}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="用户政区">
				<text class="uni-body">{{warnInfo.userAdcd}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警点经度">
				<text class="uni-body">{{warnInfo.warnLgtd}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="预警点纬度">
				<text class="uni-body">{{warnInfo.warnLttd}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="备注">
				<text class="uni-body">{{warnInfo.remark}}</text>
			</uni-card>
		</uni-section>
		<uni-section title="雨情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
			<uni-card :is-shadow="false" title="雨量站预警频率">
				<text class="uni-body">{{warnInfo.rainWarnRateText}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="降雨时段">
				<text class="uni-body">{{warnInfo.intv}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="时段降水">
				<text class="uni-body">{{warnInfo.drp}}</text>
			</uni-card>
		</uni-section>
		<uni-section title="河道水情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
			<uni-card :is-shadow="false" title="河道水位">
				<text class="uni-body">{{warnInfo.z}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="河道流量">
				<text class="uni-body">{{warnInfo.q}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="河道水势">
				<text class="uni-body">{{warnInfo.wptn}}</text>
			</uni-card>
		</uni-section>
		<uni-section title="水库水情数据" titleFontSize="0.8rem" type="line" style="width: 100%;">
			<uni-card :is-shadow="false" title="库上水位">
				<text class="uni-body">{{warnInfo.rz}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="水库水势">
				<text class="uni-body">{{warnInfo.rwptn}}</text>
			</uni-card>
			<uni-card :is-shadow="false" title="水库流量">
				<text class="uni-body">{{warnInfo.inq}}</text>
			</uni-card>
		</uni-section>

	</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';


	export default {
		components: {

		},
		onLoad(options) {
			this.id = options.id;
			this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
			this.getWarnInfo();
		},
		data() {
			return {
				id: '',
				baseURL: '',
				warnInfo: {},
				title: '异常信息详情',
			}
		},
		computed: {

		},
		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;
				http.request({
					url: '/galaxy-business/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;
	}


</style>
