<!--时间轴模块-->
<template>
	<div class="kuang_tracking">
		<h2>Manuscript Tracking</h2>
		<el-timeline :reverse="reverse" class="editor_tree">
			<el-timeline-item v-for="(item, index) in prossMsgs" :icon="item.icon" :color="item.color" size="large" :key="index"
			 :timestamp="formatDate(item.ctime)" placement="top" v-if="item.ftype == 0">
				<el-card>
					<p>
						<font>{{ statetostr(item.state_to) }}</font>
						<!-- 提交 -->
						<font v-if="item.state_to==-1">
							: <b>{{form.username}} first submitted to {{form.journalname}}</b>
						</font>
						<!-- 给编辑 -->
						<font v-if="item.state_to==1">
							<!-- : <b> Submission checks complete</b> -->
						</font>
						<!-- 审查中 -->
						<font v-if="item.state_to==2">
							<!-- : <b> Editor assigned</b> -->
						</font>
						<!-- 修改 -->
						<font v-if="item.state_to==4">
							<!-- : <b v-if="item.back==1"> Major revision</b>
							<b v-if="item.back==0"> Major revision (Completed)</b> -->
						</font>
						<!-- 接收 -->
						<font v-if="item.state_to==5">
							<!-- : <b> Successfully received manuscript</b> -->
						</font>
						<!-- 拒绝 -->
						<font v-if="item.state_to==3">
							<!-- : <b> Reject manuscript</b> -->
						</font>
					</p>
				</el-card>
			</el-timeline-item>
		</el-timeline>
	</div>
</template>

<script>
	import Vue from 'vue'

	export default {
		props: {
			prossMsgs: {
				type: Array,
				required: true
			},
			form: {
				type: Object,
				required: true
			}
		},
		components: {},
		data() {
			return {
				reverse: false
			}
		},
		computed: {},
		methods: {
			formatDate(timestamp) {
				var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				var Y = date.getFullYear() + '-';
				var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
				var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
				var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
				var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
				return Y + M + D + ' ' + h + ':' + m + ':' + s;
			},
			statetostr(mystate) {
				let str = '';
				switch (mystate) {
					case -1:
						str = 'Manuscript Submission';
						break;
					case 0:
						str = this.$t('artstate.state0');
						break;
					case 1:
						str = this.$t('artstate.state1');
						break;
					case 2:
						str = this.$t('artstate.state2');
						break;
					case 3:
						str = this.$t('artstate.state3');
						break;
					case 4:
						str = this.$t('artstate.state4');
						break;
					case 5:
						str = this.$t('artstate.state5');
						break;
					case 6:
						str = this.$t('artstate.state6');
						break;
				}
				return str;
			},
		}
	}
</script>

<style scoped>

</style>
