<template>
	<div>
		 
		<div class="mui-content vongi-qingjiadt">
			<form class="mui-input-group mt-10 vongi-qingjiadt" >
				<div class="mui-input-row">
					<label>加班人员</label>
					<span class="vongi-span">{{detail.name}}</span>
				</div>
			</form>
			<form class="mui-input-group mt-10">
				<div class="mui-input-row">
					<label>开始时间</label>
					<span>{{detail.startTime}}</span>
				</div>
				<div class="mui-input-row">
					<label>结束时间</label>
					<span>{{detail.endTime}}</span>
				</div>
		        <div class="mui-input-row">
					<label>预计时长</label>
					<span>{{detail.ffN}}</span>
				</div>
				<div class="mui-input-row" v-if="detail.durationStr">
					<label>实际时长</label>
					<span>{{detail.durationStr}}</span>
				</div>
				<div class="mui-input-row">
					<label>加班原因</label>
					<span>{{detail.reason}}</span>
				</div>
				<div class="mui-input-row">
					<label>申请时间</label>
					<span>{{detail.createTime}}</span>
				</div>
				
			
				
				<div class="mui-input-row">
					<label>审核状态</label>
					<span class="" :class="{'colorf8b155':detail.status=='0','color55f868':detail.status=='1'||detail.status=='4','colorfe616c':detail.status=='2'||detail.status=='3'}">{{detail.statusName}}</span></span>
					
				</div>
			</form> 
		</div>

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

<script>
	import * as API_ExtraWork from '@/apis/Master/extra_work'
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import {
		currentTimeStamp,
		parseUnixTime,
		hourDistanceArr
	} from '$project/utils'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: 'MasterExtraWorkInfo',
		components: {
			Common,
			Loading,
			TopHeader,
		},
		data() {
			return {
				pageTitle: '加班',

				isLoading: false,
				id: this.$route.query.id,
				detail: {
					list: [],
				},
			}
		},
		created() {},
		methods: {
			countHours() {
				var hoursArr = hourDistanceArr(this.detail.startTime, this.detail.endTime);
				var subForm=this.detail;
				this.detail.hours = hoursArr[0];
				this.detail.ff = hoursArr[1];
				this.detail.ffN = (subForm.hours!=0||subForm.ff==0?subForm.hours+'小时':'')+(subForm.ff!=0?subForm.ff+'分钟':'');
			},
			//获取详情
			getInfo() {
				this.isLoading = true;
				API_ExtraWork.workOverBatchDetail(this.id).then(response => {
					this.isLoading = false;

					this.detail = response;
					this.countHours()
					this.$emit('getInfo',this.detail);
				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			//获取状态颜色
			getColor(status) {
				var color = '';
				if (status == '0') {
					color = '#4fc5f7';
				} else if (status == '1') {
					color = '#55f868';
				} else if (status == '2') {
					color = '#fe616c';
				}
				return 'color:' + color + ';border-color:' + color + ';';
			},
			asynCallBack() {
				//获取详情
				
			},
		},
		mounted() {
			this.isLoading = true;
			this.getInfo();
		},
		destroyed() {},
		computed: {
			...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>
</style>
