<template>
	<div class="container">
		<el-row class="sort-box" :gutter="20">
			<el-col class="sort-item" :span="4" @click.native="handleClick('')">
				<div class="sort-item-box">
					<div class="sort-item-box-top">
						<!-- <p>{{ $t('module.report.reportSort.all') }}</p> -->
						<p>{{ $t('all') }}</p>
					</div>
					<div class="sort-item-box-bottom">{{ allNum }} {{ allNum > 1 ? 'Reports' : 'Report' }}</div>
				</div>
			</el-col>
			<el-col v-for="item in dataList" :key="item.id" class="sort-item" @click.native="handleClick(item.id)">
				<div class="sort-item-box">
					<div class="sort-item-box-top">
						<p>{{ item.name }}</p>
					</div>
					<div class="sort-item-box-bottom">{{ item.quantity }} {{ item.quantity > 1 ? 'Reports' : 'Report' }}</div>
				</div>
			</el-col>
		</el-row>
	</div>
</template>

<script>
export default {
	data() {
		return { dataList: [], pageIndex: 1, pageSize: 10, totalPage: 0, allNum: 0 }
	},
	created() {
		this.getDataList()
	},
	methods: {
		// get list
		getDataList() {
			this.$http({
				url: this.$http.adornUrl('/monitoring/reportSheetCategory/list'),
				method: 'get',
				params: {}
			}).then(({ data: res }) => {
				this.allNum = 0
				if (res.data) {
					this.dataList = res.data
					res.data.forEach(item => {
						this.allNum += item.quantity
					})
				} else this.dataList.splice(0)
			})
		},

		handleClick(id) {
			this.$router.push({
				name: 'monitoring-reportDetail',
				query: {
					category: id
				}
			})
		}
	}
}
</script>

<style lang="scss">
.container {
	padding: 20px;
	.sort-box {
		.sort-item {
			height: 400px;
			width: 280px;
			margin-bottom: 20px;
			.sort-item-box {
				width: 100%;
				height: 400px;
				background: #faefc2;
				border-radius: 10px;
				box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.5);
				cursor: pointer;
				position: relative;
				overflow: hidden;
				.sort-item-box-top {
					margin: 0 10%;
					width: 80%;
					height: 199px;
					border-bottom: 1px solid #e3d47d;
					color: #b3a995;
					position: relative;
					p {
						width: 100%;
						position: absolute;
						bottom: 0px;
						line-height: 50px;
						font-size: 24px;
						letter-spacing: 5px;
						text-align: center;
					}
				}
				.sort-item-box-bottom {
					width: 100%;
					height: 200px;
					line-height: 200px;
					font-size: 24px;
					font-weight: bold;
					text-align: center;
					letter-spacing: 5px;
					color: #6e7680;
				}
			}
			.sort-item-box::before {
				content: '';
				position: absolute;
				right: 0;
				width: 4px;
				height: 400px;
				background: #f8e69b;
			}
			.sort-item-box::after {
				content: '';
				position: absolute;
				right: 0;
				top: 70px;
				width: 18px;
				height: 60px;
				background: #f8e69b;
				border-radius: 5px;
			}
			.sort-item-box:hover {
				transition: border linear 0.2s, box-shadow linear 0.2s;
				border-color: rgba(141, 39, 142, 0.75);
				box-shadow: 0 0 5px rgba(111, 1, 32, 3);
				// border: 2px solid #fff;
			}
		}
	}
}
</style>
