<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-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.orgName }}</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-align: center;color: gray;" >
							{{ item.rtuCount }}
						</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral; " @click="onYearInspectionCountClick(item)">
							{{ item.inspectionCount }}
						</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
				})
			},
			onInspectionCountClick(item) {
				var url =
					'/pages/equipment-inspection/companyfinishedinspectionreportlist?type=1&deptId=' + item
					.deptId;
				uni.navigateTo({
					url: url
				})

			},
			onYearInspectionCountClick(item) {
				var url =
					'/pages/equipment-inspection/companyfinishedinspectionreportlist?rainSeasonKind=0&deptId=' + item
					.deptId;
				uni.navigateTo({
					url: url
				})

			},
			onBeforeRainInspectionCountClick(item) {
				console.log(JSON.stringify(item))
				var url =
					'/pages/equipment-inspection/companyfinishedinspectionreportlist?rainSeasonKind=1&deptId=' + item
					.deptId;
				uni.navigateTo({
					url: url
				})

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

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

			},
			getCountInfo() {
				var that = this;
				http.request({
					url: '/galaxy-business/equipment/inspection/org/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>
