<template>
	<el-row :gutter="16" class="panel-group">
		<el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
			<div class="card-panel">
				<div class="card-panel-icon-wrapper icon-people">
					<img src="@/assets/报警总数.png" alt="" />
				</div>
				<div class="card-panel-description">
					<div class="card-panel-text">报警总数</div>
					<count-to :start-val="0" :end-val="totalElements" :duration="2600" class="card-panel-num" />
				</div>
			</div>
		</el-col>

		<el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
			<div class="card-panel">
				<div class="card-panel-icon-wrapper icon-message">
					<img src="@/assets/控制器在线.png" alt="" />
				</div>
				<div class="card-panel-description">
					<div class="card-panel-text">控制器在线</div>
					<count-to :start-val="0" :end-val="gourpData.controller_onLine" :duration="3000" class="card-panel-num" />
				</div>
			</div>
		</el-col>
		<el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
			<div class="card-panel">
				<div class="card-panel-icon-wrapper icon-money">
					<img src="@/assets/控制器离线.png" alt="" />
				</div>
				<div class="card-panel-description">
					<div class="card-panel-text">控制器离线</div>
					<count-to :start-val="0" :end-val="gourpData.controller_offLine" :duration="3200" class="card-panel-num" />
				</div>
			</div>
		</el-col>
		<el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
			<div class="card-panel">
				<div class="card-panel-icon-wrapper icon-shopping">
					<img src="@/assets/设备在线.png" alt="" />
				</div>
				<div class="card-panel-description">
					<div class="card-panel-text">设备在线</div>
					<count-to :start-val="0" :end-val="gourpData.facility_onLine" :duration="3600" class="card-panel-num" />
				</div>
			</div>
		</el-col>
		<el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
			<div class="card-panel">
				<div class="card-panel-icon-wrapper icon-shopping">
					<img src="@/assets/设备离线.png" alt="" />
				</div>
				<div class="card-panel-description">
					<div class="card-panel-text">设备离线</div>
					<count-to :start-val="0" :end-val="gourpData.facility_offLine" :duration="3600" class="card-panel-num" />
				</div>
			</div>
		</el-col>
	</el-row>
</template>

<script>
import CountTo from 'vue-count-to'
// import { get } from '@/api/visits'
export default {
	props: {
		baseData: {
			type: Array,
			default() {
				return []
			},
		},

		// 报警总数
		totalElements: {
			type: Number,
			default() {
				return 0
			}
		},

		// 设备传感器
		gourpData: {
			type: Object,
			default: {},
		}
	},

	components: {
		CountTo,
	},
	data() {
		return {

		}
	},
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.panel-group {
	display: flex;
	.card-panel-col {
		margin-bottom: 2vh;
	}
	.card-panel {
		height: 14vh;
		font-size: 12px;
		position: relative;
		overflow: hidden;
		color: #666;
		background: #fff;
		box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
		border-color: rgba(0, 0, 0, 0.05);
		border-radius: 5px;
		.icon-people {
			color: #40c9c6;
		}
		.icon-message {
			color: #36a3f7;
		}
		.icon-money {
			color: #f4516c;
		}
		.icon-shopping {
			color: #34bfa3;
		}
		.card-panel-icon-wrapper {
			float: left;
			padding: 4vh;
			transition: all 0.38s ease-out;
			border-radius: 6px;

			img {
				height: 6vh;
			}
		}
		.card-panel-icon {
			float: left;
			font-size: 48px;
		}
		.card-panel-description {
			float: right;
			font-weight: bold;
			margin: 4.5vh;
			margin-left: 0px;
			.card-panel-text {
				line-height: 18px;
				color: #666;
				font-size: 20px;
				margin-bottom: 12px;
			}
			.card-panel-num {
				font-size: 24px;
			}
		}
	}
}
</style>
