<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="order_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-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-decoration-line: underline;text-align: center;color: coral;"
							@click="onCheckOrderCountClick(item)">{{ item.orderCount }}</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onCheckOrderUnconfirmCountClick(item)">{{ item.unconfirmOrderCount }}
						</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onCheckOrderProcessCountClick(item)">{{ item.processingOrderCount }}
						</view>
					</uni-td>
					<uni-td align="center">
						<view style="text-decoration-line: underline;text-align: center;color: coral;"
							@click="onCheckOrderReportCountClick(item)">{{ item.reportOrderCount }}
						</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
				})
			},
			onCheckOrderCountClick(item) {
				var url = '/pages/check-order/companycheckorderlist?type=1&deptId=' + item.deptId;
				uni.navigateTo({
					url: url
				})
			},
			onCheckOrderUnconfirmCountClick(item) {
				var url = '/pages/check-order/companycheckorderlist?type=2&deptId=' + item.deptId;
				uni.navigateTo({
					url: url
				})
			},
			onCheckOrderProcessCountClick(item) {
				var url = '/pages/check-order/companycheckorderlist?type=3&deptId=' + item.deptId;
				uni.navigateTo({
					url: url
				})
			},
			onCheckOrderReportCountClick(item){
				var url = '/pages/check-order/companycheckorderlist?type=4&deptId=' + item.deptId;
				uni.navigateTo({
					url: url
				})
			},
			getCountInfo() {
				var that = this;
				http.request({
					url: '/galaxy-business/rtu/check/order/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>