<template>
	<uni-table :loading="loading" @selection-change="selects" border stripe>
		<!-- 表头行 -->
		<uni-tr>
			<uni-th width="70" rowspan="2" align="center">部门名称</uni-th>
			<uni-th align="center" colspan="2">院内</uni-th>
			<uni-th align="center" colspan="2">第三方</uni-th>
		</uni-tr>
		<uni-tr>
			<uni-th width="80" align="center">已填报</uni-th>
			<uni-th width="80" align="center">未填报</uni-th>
			<uni-th width="80" align="center">已填报</uni-th>
			<uni-th width="80" align="center">未填报</uni-th>
		</uni-tr>
		<!-- 表格数据行 -->
		<uni-tr v-for="(item,index) in userList" :key="index">
			<uni-td align="center">{{item.officeName}}</uni-td>
			<uni-td align="center">
				<button @click='tranferData(item.officeId, 1, 1)'>{{item.ynAlreadyCount}}</button>
			</uni-td>
			<uni-td align="center">
				<button @click='tranferData(item.officeId, 1, 0)'>{{item.ynNoneCount}}</button>
			</uni-td>
			<uni-td align="center">
				<button @click='tranferData(item.officeId, 2, 1)'>{{item.dsfAlreadyCount}}</button>
			</uni-td>
			<uni-td align="center">
				<button @click='tranferData(item.officeId, 2, 0)'>{{item.dsfNoneCount}}</button>
			</uni-td>
		</uni-tr>
	</uni-table>
</template>

<script>
	import {
		postRequest,
		getRequest
	} from '@/api/api.js'
	export default {
		data() {
			return {
				reportNum: '',
				loading: false,
				userList: []
			}
		},
		onLoad(option) {
			this.reportNum = option.reportNum
		},
		mounted() {
			this.getList()
		},
		methods: {
			getList() {
				const data = {
					reportNum: this.reportNum
				}
				postRequest('/statistics/reportedStatistics', data).then((res) => {
					if (res.code == '200' && res.data.length > 0) {
						this.userList = res.data;
					} else {
						this.userList = []
						this.loading = false;
					}
				})
			},
			tranferData(officeId, userType, type) {
				uni.navigateTo({
					url: `/pages/mrldgl/inputMainInfo?reportNum=${this.reportNum}&showMemberType=true&officeId=${officeId}&userType=${userType}&type=${type}`
				})
			}
		}
	}
</script>

<style>
</style>
