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

		<div class="mui-content vongi-wordcard">
			<div class="mui-content-padded vongi-wordcard-top">
				<div class="mui-media-object mui-pull-left">
					<img :src="detail.faceImageUrl" v-image-preview>
				</div>
				<div class="mui-media-body">
					{{detail.personName}}
					<p class='mui-ellipsis'><span class="colorfe616c">{{detail.typeN}}</span>申请</p>
				</div>
				<button type="button" :class="'mui-btn mui-btn-success mui-btn-outlined '+(detail.status>0?(detail.status==1?'status_a':'status_r'):'')">
					{{detail.status>0?(detail.status==1?'已同意':'已拒绝'):'未审核'}}
				</button>
			</div>

			<div class="mui-content-padded vongi-wordcard-center">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">申请类型</div>
						<span v-text="detail.typeN"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">所在部门</div>
						<span v-text="detail.companyName"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">申请班次</div>
						<span class="colorf6f448" v-text="detail.fillAttendanceDayAndTime"></span>
					</li>
					<li v-if="detail.address" class="mui-table-view-cell mui-media">
						<div class="mui-media-body">打卡地点</div>
						<span v-text="detail.address"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">申请时间</div>
						<span v-text="detail.createTime"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">申请理由</div>
						<span class="colorf8b155" v-text="detail.content"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<div class="mui-media-body">相关照片</div>
					</li>
					<li class="mui-table-view-cell mui-media fyy-upphoto">
						<div class="mui-col-xs-3" v-for="(item,index) in picList">
							<img :src="item" v-image-preview />
						</div>
					</li>
				</ul>
			</div>
			<div class="mui-content-padded vongi-wordcard-center">
				<h5>审批意见</h5>
				<ul class="mui-table-view">
					<li class="mui-table-view-cell mui-media">
						审批人:
						<span v-text="detail.approvalPersonName"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						审批编号：
						<span v-text="detail.approvalNo"></span>
					</li>
					<li class="mui-table-view-cell mui-media">
						<span class="colorf8b155" v-text="detail.approvalContent"></span>
					</li>
				</ul>
			</div>
		</div>

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

<script>
	import * as API_Attendance from '@/apis/Master/attendance'
	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: 'MasterAttendanceInfo',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '打卡详情',

				isLoading: false,

				subForm: {
					id: this.$route.query.id
				},
				detail: {},
			}
		},
		created() {

		},
		methods: {
			//获取详情
			getDetail() {
				this.isLoading = true;
				API_Attendance.getApplyInfo(this.subForm).then(response => {

					this.detail = response;

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

			},
		},
		mounted() {
			//获取详情
			this.getDetail();
		},
		destroyed() {},
		computed: {
			picList: {
				// getter
				get: function() {
					if (this.detail && this.detail.fillAttendanceFilesUrl) {
						return this.detail.fillAttendanceFilesUrl.split(',');
					} else {
						return [];
					}
				},
				// setter
				set: function(newValue) {
					console.log(newValue)
				}
			},
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
			})
		}
	}
</script>

<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style scoped>
	.status_r {
		color: #fe616c !important;
		border: 1px solid #fe616c !important;
	}

	.status_a {
		color: #05c8af !important;
		border: 1px solid #05c8af !important;
	}
</style>
