<!--
 * @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" style="box-shadow:0 0 2px 2px lightblue"
									src="/static/images/list/inspection_item.png" mode="widthFix">
								</image>
								<text class="item-title">{{item.rtuName}}</text>
								<text class="item-sub-title">[{{item.rtuCode}}]</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="compose" size="18" color="lightblue" />
								<text class="item-text-lable">汛期：</text>
								<text v-if="item.rainSeasonKind == 1" class="item-text-content">汛前巡检</text>
								<text v-else-if="item.rainSeasonKind == 2" class="item-text-content">汛中第一次巡检</text>
								<text v-else-if="item.rainSeasonKind == 3" class="item-text-content">汛中第二次巡检</text>
								<text v-else class="item-text-content"></text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="auth" size="18" color="lightblue" />
								<text class="item-text-lable">填报人：</text>
								<text class="item-text-content">{{item.servicePersonName}}</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="calendar" size="18" color="lightblue" />
								<text class="item-text-lable">填报时间：</text>
								<text class="item-text-content">{{item.createTime}}</text>
							</view>
							<view class="item-button-group">
								<view class="item-button" style="width: 120px;"
									@click="onEquipmentInspectionItemClick(item.id,item.rainSeasonKind)">
									<view class="items-line">
										<uni-icons class="input-uni-icon" type="info" size="18" color="coral" />
										<text class="button-text">巡检填报详情</text>
									</view>
								</view>
							</view>
						</view>
					</template>
				</uni-list-item>
			</uni-list>
		</view>
	</view>
</template>

<script>
	import http from '@/http/api.js';

	export default {
		components: {},
		onLoad(option) {
			this.getPage();
		},
		data() {
			return {
				list: [],
				title: '今日巡检填报信息',
			}
		},
		computed: {},
		onShow() {},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			getPage(params = {}) {
				let that = this;
				http.request({
					url: '/galaxy-business/equipment/inspection/report/today/list',
					method: 'GET'
				}).then(res => {
					if (res.success) {
						if (res.data != null) {
							that.list = res.data;
						}
					}
				}).catch(err => {
					console.log(err)
				})
			},
			onEquipmentInspectionItemClick(id, rainSeasonKind) {
				console.log(id)
				var url = '/pages/equipment-inspection/inspectionreportview?id=' + id + "&type=" + rainSeasonKind;
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style>

</style>

<style lang="scss" scoped>

</style>
