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

		<div class="mui-content">
			<div class="mui-content-padded fyy-date mui-clearfix">
				<h5>考勤时间未测量体温人员
					<a class="mui-navigate-right mui-pull-right" @click="selectData">{{subForm.queryDate}}</a>
				</h5>
			</div>
			<div class="mui-row mui-fullscreen fyy-undetect">
				<div class="mui-col-xs-3">
					<div class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical">
						<a v-for="(item,index) in recordList" @click="showindex = index" :key="index" :class="'mui-control-item '+ (showindex==index?'mui-active':'')"
						 v-text="item.startTime+'至'+item.endTime"></a>
					</div>
				</div>
				<div class="mui-col-xs-9">
					<div class="fyy-back">
						<div v-for="(item,index) in recordList" :key="index" v-show="showindex==index" class="mui-control-content">
							<ul class="mui-table-view mui-grid-view mui-grid-9">
								<li v-for="(iten,inden) in item.list" class="mui-table-view-cell mui-media mui-col-xs-4">
									<div class="mui-media-body" v-text="iten.name"></div>
								</li>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>

		<loading :visible="isLoading"></loading>
	</div>
</template>

<script>
	require('$project/assets/js/mui.picker.min.js');
	import * as API_Health from '@/apis/Master/health'
	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'
	import {
		currentTimeStamp,
		parseUnixTime
	} from '$project/utils'
	import * as types from '$project/store/mutation-types'
	export default {
		name: 'MasterHealthNoTemperatureRecord',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '未测人员',

				isLoading: false,

				subForm: {
					queryDate: '',
					companyId: '',
					//微信模板消息带过来的时段参数
					alarmConfigId: this.$route.query.alarmConfigId,
				},
				recordList: [],
				showindex: 0,
			}
		},
		created() {
			//带微信模板消息过来的链接，暂不检测当前项目common
			this.subForm.companyId = this.$route.query.companyId ? this.$route.query.companyId : this.person_data.companyId;
			this.subForm.queryDate = this.$route.query.queryDate ? this.$route.query.queryDate : parseUnixTime(currentTimeStamp(),
				'{y}-{m}-{d}');

			if (this.$route.query.token) {
				this.set_token(this.$route.query.token);
			}
		},
		methods: {
			//获取列表
			getList() {
				this.isLoading = true;
				API_Health.queryUnmeasureGroupList(this.subForm).then(response => {

					this.recordList = response.list;

					this.isLoading = false;
				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			//选择日期
			selectData() {
				var _this = this;
				var picker = new mui.DtPicker({
					"type": "date",
					"beginYear": 2020,
					"endYear": 2040,
					"endDate": new Date(),
					"value": _this.subForm.queryDate
				});
				picker.show(function(rs) {
					_this.subForm.queryDate = rs.text;
					_this.getList();
					picker.dispose();
				});
			},
			asynCallBack() {

			},
			...mapMutations({
				set_token: types.SET_TOKEN,
			})
		},
		mounted() {
			//获取列表
			this.getList();
		},
		destroyed() {},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
				person_data: 'person_data',
				person_popedom: 'person_popedom',
			})
		}
	}
</script>

<style scoped src="$project/assets/css/sczpfyy.css"></style>
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style src="$project/assets/css/mui.picker.min.css"></style>
<style scoped>
</style>
