<template>
	<div>
		<common @asynCallBack="asynCallBack"></common>
		<top-header :pageTitle="pageTitle"></top-header>

		<div class="mui-content vongi-dwlist">
			<ul class="mui-table-view openfyy-list">

				<li class="mui-table-view-cell mui-media" v-for="(item,index) in companyList" :key="index">
					<a @click="goto(item.id,item.name)" class="mui-navigate-right">
						<div class="mui-media-body">
							{{item.name}}
							<h4 class='mui-pull-right'><span class="color4fc5f7">{{item.detectedNum}}</span>/<span class="color4fc5f7">{{item.personNum}}</span></h4>
						</div>
					</a>
				</li>

			</ul>
			<h6>已测：<span class="color4fc5f7">{{sumDetectedNum}}</span> / 应测：<span class="color4fc5f7">{{sumPersonNum}}</span></h6>
		</div>
		<loading :visible="isLoading"></loading>

	</div>
</template>


<script>
	import * as API_Company from '@/apis/Master/company'

	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'

	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: 'MasterCompanyList',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '单位列表',

				isLoading: false,

				companyList: [],
				sumDetectedNum: 0,
				sumPersonNum: 0,
			}
		},
		created() {

		},
		methods: {
			goto(id, name) {

				this.$router.push({
					name: 'MasterHealthWorkerTemperature',
					query: {
						companyId: id,
						companyName: escape(name)
					}
				})
			},
			//提交
			getCompanyList() {
				this.isLoading = true;
				API_Company.queryCompanyList().then(response => {
					this.isLoading = false;

					this.companyList = response.list;
					this.sumDetectedNum = response.sumDetectedNum;
					this.sumPersonNum = response.sumPersonNum;

				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			asynCallBack() {

			},
		},
		mounted() {
			//获取公司列表
			this.getCompanyList();
		},
		destroyed() {},
		computed: {

		}
	}
</script>

<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style>
</style>
