<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-table ref="equipment_inspection_table" border stripe type="" emptyText="暂无更多数据">
				<uni-tr>
					<uni-th width="140" align="center">
						<view style="text-align: center;color: black;">巡检填报人</view>
					</uni-th>
					<uni-th align="center">
						<view style="text-align: center;color: black;">汛前巡检</view>
					</uni-th>
					<uni-th align="center">
						<view style="text-align: center;color: black;">汛中（一）巡检</view>
					</uni-th>
					<uni-th align="center">
						<view style="text-align: center;color: black;">汛中（二）巡检</view>
					</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<uni-td>
						<view style="text-align: center;">{{ item.servicePersonName }}</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onBeforeRainInspectionCountClick(item)">
							{{ item.beforeRainInspectionCount }}
						</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onRainFirstInspectionCountClick(item)">
							{{ item.firstRainInspectionCount }}
						</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onRainSecondInspectionCountClick(item)">
							{{ item.sencodRainInspectionCount }}
						</view>
					</uni-td>
				</uni-tr>
			</uni-table>
		</view>
	</view>
</template>

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

	export default {
		components: {
		},
		onLoad(option) {
			this.getCountInfo();
		},
		data() {
			return {
				title: '设备巡检统计报表',
				tableData: [],
			}
		},
		computed: {
		},
		onShow() {
		},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			onBeforeRainInspectionCountClick(item) {
				var url =
					'/pages/equipment-inspection/servicepersonfinishedinspectionreportlist?rainSeasonKind=1&userId=' + item
					.userId;
				uni.navigateTo({
					url: url
				})

			},
			onRainFirstInspectionCountClick(item) {
				var url =
					'/pages/equipment-inspection/servicepersonfinishedinspectionreportlist?rainSeasonKind=2&userId=' + item
					.userId;
				uni.navigateTo({
					url: url
				})

			},
			onRainSecondInspectionCountClick(item) {
				var url =
					'/pages/equipment-inspection/servicepersonfinishedinspectionreportlist?rainSeasonKind=3&userId=' + item
					.userId;
				uni.navigateTo({
					url: url
				})

			},
			getCountInfo() {
				var that = this;
				http.request({
					url: '/galaxy-business/equipment/inspection/person/statistics',
					method: 'GET',
				}).then(res => {
					if (res.data != null) {
						that.tableData = res.data;
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>

</style>

<style lang="scss" scoped>

</style>
