<template>
	<div class="right_three right_item">
    <CommonTitle title="桥梁隐患" />
		<div class="content"  v-loading="isLoading"
         element-loading-background="rgba(0, 22, 52, 0.75)">
			<div class="item center"  v-for="item in arr" :key="item.id">
				<div :class="`left ${item.className}`">
					
				</div>
				<div class="right">
					<div class="right_top center">
						{{item.yhlb}}
					</div>
					<div class="right_bottom center">
						<div class="bottom_left">
							{{item.qlzc}}
						</div>
						<div class="bottom_right">
							公里
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup>
	import {
		ref,
		onMounted,
		nextTick
	} from 'vue'
	import {
		getSelectQlyhCount
	} from '../service/http.js'
  import CommonTitle from "@/views/c-cpns/CommonTitle.vue";
	let arr = ref([]);
  const isLoading = ref(false);
	onMounted(() => {
    isLoading.value = true;
		getSelectQlyhCount().then(res => {
      isLoading.value = false;
			arr.value = res.data.data.Rows
			arr.value.forEach(item=>{
				if(item.yhlb == "是否有过强风 后损伤"){
					item["className"] = "bg2"
				}else if(item.yhlb == "是否存在冲刷 或冰凌"){
					item["className"] = "bg3"
				}else if(item.yhlb == "是否有超限车 辆通行情况"){
					item["className"] = "bg1"
				}else{
					item["className"] = "bg4"
				}
			})
		})
	})
	/* let arr3 = ref([
		{
			id:1,
			name:"存在滑坡、泥石流灾害",
			num:12322,
			className:"bg1"
		},
		{
			id:2,
			name:"有过强风后损伤",
			num:1232,
			className:"bg2"
		},
		{
			id:3,
			name:"存在冲刷或冰凌",
			num:12322,
			className:"bg3"
		},
		{
			id:4,
			name:"存在车船物撞击风险",
			num:12322,
			className:"bg4"
		}
	]) */
</script>

<style scoped lang="scss">
	.center {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	
	.center_center{
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.right_three{
		height: 19%;
		padding-top: 10px;
		box-sizing: border-box;
		.content {
			height: 80%;
			width: 90%;
			margin: 0 20px;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			
			.item{
				width: 50%;
				height: 50%;
				box-sizing: border-box;
				
				.bg1{
					background: url("@/assets/imgs/czhpnslzh.png") no-repeat;
          background-size: 100% 100%;
				}
				.bg2{
					background: url("@/assets/imgs/yqfghss.png") no-repeat;
          background-size: 100% 100%;
				}
				.bg3{
					background: url("@/assets/imgs/czcshbl.png") no-repeat;
          background-size: 100% 100%;
				}
				.bg4{
					background: url("@/assets/imgs/czccwzjfx.png") no-repeat;
          background-size: 100% 100%;
				}
				
				.left{
					width: 44px;
					height: 44px;
				}
				.right{
					height: 80%;
					.right_top{
						height: 50%;
						font-family: Microsoft YaHei;
						font-weight: bold;
						font-size: 12px;
						color: #FFFFFF;
						text-shadow: 0px 3px 2px rgba(0,15,17,0.19);
					}
					.right_bottom{
						height: 50%;
						
						.bottom_left{
							font-family: YouSheBiaoTiHei;
							font-weight: bold;
							font-size: 18px;
							color: #98CCFF;
							margin-right: 5px;
						}
						
						.bottom_right{
							font-family: Microsoft YaHei;
							font-weight: 400;
							font-size: 12px;
							color: #FFFFFF;
							text-shadow: 0px 3px 2px rgba(0,15,17,0.19);
							opacity: 0.6;
						}
					}
				}
			}
		}
	}
</style>