<template>
	<view class="h100vh page-bg-color">
		<u-navbar :customBack="handleBackHome" :title="typeLabel[currentType]"></u-navbar>
		<view class="workflow-page" :style="{height: `calc(100vh - ${diStatusBarHeight}px - 48px)`}">
			<view class="workflow-main">
				<start-workflow v-if="currentType === 'start'"></start-workflow>
				<approve-center v-else :type='currentType'></approve-center>
			</view>
		</view>
	</view>	
</template>

<script>
	import startWorkflow from './startWorkflow/startWorkflow'
	import approveCenter from './approveCenter/index'
	export default {
		data() {
			return {
				currentType: 'start',
				typeLabel: {
					start: '发起申请',
					myLaunch: '我发起的',
					todo: '我的待办',
					done: '我的已办',
				},
				diStatusBarHeight: 0
			};
		},
		onLoad(options) {
			this.diStatusBarHeight = uni.getSystemInfoSync().statusBarHeight
			this.currentType = options.type
		},
		components: {
			startWorkflow,
			approveCenter
		},
		methods: {
			handleBackHome() {
				console.log('000000')
				uni.switchTab({
					url: '/pages/home/home'
				})
			}
		}
	}
</script>

<style lang="scss">
	.h100vh {
		height: 100vh;
	}
	.workflow-page {
		.workflow-main {
			height: 100%;
			overflow: hidden;
		}
	}
</style>
