<template>
<div>
		<Info @allowExamine="allowExamine" ref="myinfo"></Info>
		<div class="mui-content vongi-qingjiadt">
			 
			<div class="fyy-scon-botton" v-if="allowExamineBl">
				<div class="examine-btn examine-btn1" @click="openFrom('3')">拒绝</div>
				<div class="examine-btn examine-btn2" @click="openFrom('1')">通过</div>
			</div>
		</div>
		<!--弹窗-->
		<div class="mui-popup mui-popup-in vongi-mui-pop"  v-show="showApprovalBl">
			<div class="mui-popup-inner vongi-pop-inner">
				<div class="mui-popup-title">审核意见</div>
				<div class="mui-popup-input">
					<textarea id="textarea" rows="3" v-model="subForm.content" placeholder="可输入审核意见"></textarea>
				</div>
			</div>
			<div class="mui-popup-buttons">
				<span class="mui-popup-button"  @click="showApprovalBl=false">取消</span>
			<span class="mui-popup-button mui-popup-button-bold" @click="doAction">提交</span></div>
		</div>
		<div class="mui-popup-backdrop mui-active" v-show="showApprovalBl"></div>
		<loading :visible="isLoading"></loading>
</div>
</template>

<script>
	import Info from '../ApplyClass/Info.vue'
	
	import * as API from '@/apis-xsy/applyclass'
	import * as API_sp from '@/apis-xsy/xsy'

	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: '',
		components: {
			Common,
			Loading,
			TopHeader,Info
		},
		data() {
			return {
				pageTitle: '申请调班详情',
				showApprovalBl:false,
				allowExamineBl:false,
				isLoading: false,
				subForm: {
					procinstActUserIds: '',
					content: '',
					status: ''
				},
			}
		},
		created() {
			
	
		},
		methods: { 
			allowExamine(bl){
				 
				if(bl==""){
					 this.allowExamineBl=false;
					return
				}
				 if(bl==this.$route.query.procinstActUserId){
					 this.allowExamineBl=true;
				 }else{
					 this.allowExamineBl=false;
				 }
			
			},
			//同意拒绝
			doAction() {
				this.allowExamineBl=false;
				this.subForm.procinstActUserIds =this.$route.query.procinstActUserId;
				if (this.checkForm()) {
					this.isLoading = true;
					API.examineSubmit(this.subForm).then(response => {
						this.isLoading = false;
			
						this.showApprovalBl = false;
						this.$refs.myinfo.update();
						mui.toast("操作成功");
						 
					}).catch(error => {
						this.isLoading = false;
						mui.toast(error);
					})
				}
			},
			//检测表单
			checkForm() {
				if (false) {
					mui.toast('请选择要处理的信息');
					return false;
				} else {
					return true;
				}
			},
		    openFrom(status) {
		    	if (false) {
		    		mui.toast('请选择要处理的信息');
		    	} else {
		    		this.subForm.status = status;
		    		this.subForm.content = status == 1 ? '同意' : '拒绝';
		    		this.showApprovalBl = true;
		    		//直接点击处理，不需要弹窗理由框,又需要弹窗理由框了
		    		//this.doAction();
		    	}
		    },
			asynCallBack() {
	
			},
		
		},
		mounted() {
		
		},
		destroyed() {},
	
	}
</script>

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