<template>
	<div>
		<!-- 期刊下拉菜单 -->
		<div class="crumbs">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item>
					<i class="el-icon-notebook-1"></i> <span class="top_dao"> Final decision</span>
				</el-breadcrumb-item>
			</el-breadcrumb>
		</div>
		<div class="container_l">
			<!-- 期刊下拉菜单 -->
			<el-select v-model="query.journal_id" filterable placeholder="Please select a journal" @change="handlejournal" style="width: 350px;">
				<el-option v-for="item in cate_jour" :key="item.journal_id" :label="item.title" :value="item.journal_id"></el-option>
			</el-select>

			<el-row :gutter="20" style="display: flex;margin-top: 20px;">
				<el-col :span="24">
					<el-card class="box-card">
						<div class="ma_title">
							<h2>The manuscripts are ready to get final decisions</h2>
						</div>
						<ul class="ta1_uli">
							<li v-for="(item,index) in tableData1">
								<router-link :to="{path:'/edit_text_jx',query:{Art_id:item.article_id}}">
									<h3><span style="margin-right: 6px;">{{index+1}}.</span>{{item.title}}</h3>
									<el-button type="primary" plain style="float: right;">Detail</el-button>
								</router-link>
								<h6>{{item.author}}</h6>
								<h4>
									<span>
										<font style="color: #888;">Journal name : </font>{{item.journal_title}}.
									</span>
									<span>
										<font style="color: #888;">Article type : </font>{{item.type}}
									</span><br>
									<span v-if="item.major!=null && item.major!='Others'">
										<font style="color: #888;">Major : </font>{{item.major}} > {{item.cmajor}}
									</span>
									<span style="color: #888;">
										<font>Submitted time : </font>{{item.ctime}}
									</span><br>
									<span v-if="item.abstrart!=''">
										<font style="color: #888;">Abstract : </font>{{item.abstrart | ellipsis}}
									</span>
								</h4>
							</li>
							<p v-if="tableData1==''" style="color:#6f6f6f;font-size: 14px;margin-top: 20px;">No article</p>
						</ul>
					</el-card>
				</el-col>
			</el-row>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				Direct_log: this.$route.query.act,
				query: {
					user_id: localStorage.getItem('U_id')
				},
				tableData1: [],
				cate_jour: [],
			};
		},
		watch: {
		 
		},
		mounted() {

		},
		created() {

			if (this.Direct_log == null) {
				this.getTable();
			} else {
				this.$api
					.post('api/Chief/autoLoginForChief ', {
						'code': this.Direct_log
					})
					.then(res => {
						if (res.code == 0) {
							localStorage.setItem('U_role', res.data.roles);
							localStorage.setItem('U_name', res.data.user.account);
							localStorage.setItem('U_id', res.data.user.user_id);
							localStorage.setItem('U_relname', res.data.userinfo.realname);
							this.getTable();
						} else {
							this.$message.error(res.msg);
						}
					})
					.catch(err => {
						this.$message.error(err);
					});
			}
		},
		methods: {
			// 获取数据
			getTable() {
				this.$api
					.post('api/Board/getBoardJournals', this.query)
					.then(res => {
						if (res.code == 0) {
							this.cate_jour = res.data.journals
							this.query.journal_id = this.cate_jour[0].journal_id;

							this.getData();
						} else {
							this.$message.error(res.msg);
						}
					})
					.catch(err => {
						this.$message.error(err);
					});
			},
			getData() {
				this.$api
					.post('api/Board/getBoardPendArticle', this.query)
					.then(res => {
						if (res.code == 0) {
							for (let i = 0; i < res.data.articles.length; i++) {
								let date = new Date(parseInt(res.data.articles[i].ctime) * 1000);
								let Y = date.getFullYear() + '-';
								let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
								let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
								res.data.articles[i].ctime = Y + M + D;
							}
							this.tableData1 = res.data.articles;
						} else {
							this.$message.error(res.msg);
						}
					})
					.catch(err => {
						this.$message.error(err);
					});
			},


			// 期刊下拉菜单点击
			handlejournal() {
				this.getData();
			},
			
		},
		filters: {
			ellipsis(value) {
				if (!value) return "";
				if (value.length > 380) {
					value = value.slice(0, 380);
					return value.slice(0, value.lastIndexOf(" ")) + "...";
				}
				return value;
			}
		},
		watch: {

		}
	};
</script>

<style scoped>
	.ma_title {
		margin-bottom: 10px;
		font-size: 14px;
		border-right: 1px solid #e1e1e1;
		padding-right: 20px;
		line-height: 20px;
		color: #888;
	}

	.ma_title h2 {
		font-size: 16px;
		color: #006699;
		margin: 0 0 10px 0;
		/* white-space: nowrap; */
	}

	.ta1_uli li {
		list-style: none;
		border-bottom: 1px dashed #e0e0e0;
		/* box-shadow: 0 0 10px #e1e1e1; */
		padding: 10px 20px 20px 20px;
		background-color: #fff;
		margin-top: 10px;
	}


	.ta1_uli li:hover {
		/* background: #fafafa; */
	}

	.ta1_uli li h3 {
		color: #000;
		margin-top: 8px;
		margin-right: 120px;
		font-family: "Helvetica Neue", Helvetica, Georgia, sans-serif;
		font-size: 16px;
		word-wrap: break-word;
		line-height: 22px;
	}

	.ta1_uli li h3:hover {
		text-decoration: underline;
	}

	.ta1_uli li h4 {
		/* color: #6f6f6f; */
		margin-top: 8px;
		font-weight: normal;
		font-size: 15px;
		line-height: 22px;
	}

	.ta1_uli li h4 {
		/* color: #6f6f6f; */
		margin-top: 8px;
		margin-right: 150px;
		font-weight: normal;
		font-size: 14px;
		line-height: 22px;
	}

	.ta1_uli li h4 span {
		margin-right: 20px;
		display: inline-block;
		margin-bottom: 2px;
	}

	.ta1_uli li h4 span>font {
		font-size: 13px;
	}

	.ta1_uli li h5 {
		color: #006699;
		margin-top: 5px;
		padding-bottom: 10px;
		font-weight: normal;
		border-bottom: 1px solid #f1f1f1;
	}

	.ta1_uli li h6 {
		font-weight: normal;
		font-family: Calibri;
		font-size: 15px;
		margin-top: 10px;
		margin-right: 120px;
	}

</style>
