<template>
	<!-- 补卡、请假、加班、出差、审批 -->
	<view class="approval">
		<u-navbar :placeholder="true" :title="title" :autoBack="true">
			<template slot="right">
				<view
					@click="
						$u.route('/pages/approval/history/index', {
							processType: processType,
						})
					"
					class="dflex acenter"
				>
					<image
						class="nav-right-icon"
						src="@/static/images/approval/history.png"
					></image>
				</view>
			</template>
		</u-navbar>
		<!--  表单/流程图  -->
		<approvalApply :processType="processType"></approvalApply>
	</view>
</template>

<script>
import approvalApply from './approvalApply'; // 补卡申请

export default {
	name: 'approval',
	components: {
		approvalApply,
	},
	data() {
		return {
			processType: '', // 0补卡,1加班,2出差,3请假
		};
	},
	computed: {
		title() {
			const types = {
				0: '补卡审批申请',
				1: '加班审批申请',
				2: '出差审批申请',
				3: '请假审批申请',
			};
			return types[this.processType];
		},
	},
	onLoad(params) {
		const type = params.type;
		this.processType = type;
	},
	methods: {
		rightClick() {},
	},
};
</script>

<style scoped lang="scss">
.approval {
	display: flex;
	flex-direction: column;
}
.nav-right-icon {
	width: 20px;
	height: 20px;
}
</style>
