<!--
 * @Title: 
 * @Description: 异常列表信息
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="wrap">
		<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>
		<view class="container">
			<uni-list>
				<uni-list-item v-for="item in list" :key="item.id">
					<template v-slot:body>
						<view class="list-item-block">
							<view class="items-line">
								<image class="item-title-run-status-icon" src="/static/images/icon_warning.png"
									mode="widthFix">
								</image>
								<text class="item-title-rtu-name">{{item.rtuName}}</text>
								<text class="item-title-rtu-code">[{{item.rtuCode}}]</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="calendar" size="18" color="lightblue" />
								<text class="item-text">创建时间：</text>
								<text class="item-text">{{item.warningHappenTime}}</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="list" size="18" color="lightblue" />
								<text class="item-text-lable">异常类型：</text>
								<text v-if="item.warningKind==1" class="item-text-content">测站离线</text>
								<text v-else-if="item.warningKind==2" class="item-text-content">测站时钟异常</text>
								<text v-else-if="item.warningKind==3" class="item-text-content">测站雨量小时报漏报</text>
								<text v-else-if="item.warningKind==4" class="item-text-content">测站水位小时报漏报</text>
								<text v-else-if="item.warningKind==5" class="item-text-content">雨量5分钟上报延时</text>
								<text v-else-if="item.warningKind==6" class="item-text-content">雨量站小时上报延时</text>
								<text v-else-if="item.warningKind==7" class="item-text-content">水位站小时上报延时</text>
								<text v-else-if="item.warningKind==8" class="item-text-content">雨量疑似异常值</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="compose" size="18" color="lightblue" />
								<text class="item-text-lable">异常信息：</text>
							</view>
							<view class="items-line">
								<text class="item-text-content" style="margin-left: 0px;">{{item.warningDesc}}</text>
							</view>
						</view>
					</template>
				</uni-list-item>
			</uni-list>
			<uni-group>
				<view class="pagination-block">
					<uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
						@change="pageChange" />
				</view>
			</uni-group>
		</view>

	</view>
</template>

<script>
	import http from '@/http/api.js';
	export default {
		name: '',
		components: {},
		onLoad(option) {
			this.getPage();
		},
		data() {
			return {
				list: [],
				title: '异常测站信息',
				pageSize: 10,
				// 当前页
				pageCurrent: 1,
				// 数据总量
				total: 0,
				query: {},
			}
		},
		computed: {},
		onShow() {},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			// 分页触发
			pageChange(e) {
				this.pageCurrent = e.current;
				this.getPage()
			},
			getPage(params = {}) {
				let that = this;
				const current = this.pageCurrent;
				const size = this.pageSize;
				let postData = Object.assign(params, this.query);
				http.request({
					url: '/galaxy-business/rtu/warning/page',
					method: 'GET',
					data: postData,
					params: {
						current,
						size,
					},
				}).then(res => {
					if (res.data.records != null) {
						that.list = res.data.records;
					}
					this.total = res.data.total;

				}).catch(err => {
					console.log(err)
				})
			},
			toWarningPage(id) {
				var url = '/pages/warning/warninginfodetail?id=' + id;
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

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

<style lang="scss" scoped>

</style>
