<template>
	<view class="task-page">
		<div class="head">
			<uni-segmented-control 
			:current="current" 
			:values="items" @clickItem="onClickItem" 
			activeColor="#007aff">	
			</uni-segmented-control>			
		</div>
		<view class="content">
			<view v-show="current === 0">
				<accept-form ref="accept-form" @success="getWorkflow"></accept-form>
			</view>
			<view v-show="current === 1">
				<accept-history ref="accept-history"></accept-history>
			</view>
		</view>
	</view>
</template>

<script>
import acceptForm from './form/form.vue'
import acceptHistory from './history/index.vue'
	export default {
		data() {
			return {
				items: ['基本信息', '历史记录'],
				current: 0
			}
		},
		components:{
			acceptForm,
			acceptHistory
		},
		methods: {
			onClickItem(e) {
			  if (this.current != e.currentIndex) {
				this.current = e.currentIndex;
			  }
			},
			getWorkflow(data){
				if(data&&data.activityInsRecordList){
					this.$refs['accept-history'].loadData(data.activityInsRecordList)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.task-page{
	padding:20rpx;
	position: relative;
	.head{
		position: fixed;
		z-index: 999;
		width: 710rpx;
		left: 10px;
		top: var(--window-top);
		background-color: #fff;
		box-sizing: border-box;
		padding-top: 5px;
	}
	.content{
		margin-top:36px;	
	}
}
</style>
