<template>
	<view style = "margin:30rpx 30rpx">
		<u-time-line>
			<u-time-line-item nodeTop="2" v-for="(item, index) in histaskList" :key="item.id">
				<!-- 此处自定义了左边内容，用一个图标替代 -->
				<template v-slot:node>
					<view class="u-node" style="background: #19be6b;">
						<!-- 此处为uView的icon组件 -->
						<u-icon :name="item.activityType=='startEvent'?startIcon:(item.activityType=='endEvent'?endIcon:userIcon)" color="#fff" :size="24"></u-icon>
					</view>
				</template>
				<template v-slot:content>
					<view>
						<view class="u-order-title" v-if="item.activityName">{{item.activityName}}</view>
						<view class="u-order-desc" v-if="item.activityType=='userTask' && !!item.displayName">审批人:{{item.displayName}}</view>
						<view class="u-order-desc" v-if="item.commentList">
							<view v-for="(comment, commentIndex) in item.commentList" :key="comment.id">
								审批意见:{{comment.fullMessage}}
								<br>
								时间:{{parseTime(new Date(comment.time))}}
							</view>
						</view>
						<view class="u-order-time" v-if="item.startTime">开始时间:{{item.startTime}}</view>
						<view class="u-order-time" v-if="item.endTime">结束时间:{{item.endTime}}</view>
					</view>
				</template>
			</u-time-line-item>
		</u-time-line>
	</view>
</template>

<script>
	export default {
		props:['processInstanceId'],
		data() {
			return {
				histaskList : [],
				startIcon : '/static/icon/taskStart.png',
				endIcon : '/static/icon/taskEnd.png',
				userIcon : 'account-fill'
			}
		},
		mounted() {
			let self = this;
			this.flowableRequest({
				action: "flow/getProcessHisTaskList",
				data : {
					processId : this.processInstanceId,
				},
				success(resData) {
					self.histaskList =  resData.data.data;
				}
			})
		},
	}
</script>

<style lang="scss" scoped>
	.u-node {
		width: 44rpx;
		height: 44rpx;
		border-radius: 100rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #d0d0d0;
	}
	
	.u-order-title {
		color: #333333;
		font-weight: bold;
		font-size: 32rpx;
	}
	
	.u-order-desc {
		color: rgb(150, 150, 150);
		font-size: 35rpx;
		margin-bottom: 6rpx;
	}
	
	.u-order-time {
		color: rgb(200, 200, 200);
		font-size: 26rpx;
	}
</style>
