<template>
	<div class="right_two 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.yxzhyh}}
					</div>
					<div class="right_bottom center">
						<div class="bottom_left">
							{{item.dggdcd}}
						</div>
						<div class="bottom_right">
							公里
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup>
	import {
		ref,
		onMounted,
		nextTick
	} from 'vue'
	import {
		getSelectYxzhyhCount
	} from '../service/http.js'
  import CommonTitle from "@/views/c-cpns/CommonTitle.vue";
	let arr = ref([]);
  const isLoading = ref(false);
	onMounted(() => {
    isLoading.value = true;
		getSelectYxzhyhCount().then(res => {
      isLoading.value = false;
			arr.value = res.data.data.Rows
			arr.value.forEach(item=>{
				if(item.yxzhyh == "无明显异常"){
					item["className"] = "bg1"
				}else if(item.yxzhyh == "河道"){
					item["className"] = "bg2"
				}else if(item.yxzhyh == "山体"){
					item["className"] = "bg3"
				}else{
					item["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_item{
		height: 19%;
		padding-top: 10px;
		box-sizing: border-box;
	}
	.right_two{
		height: 22%;
		padding-top: 10px;
		box-sizing: border-box;
		.content {
			height: 80%;
			margin: 0 10px;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			
			.item{
				width: 50%;
				height: 50%;
				box-sizing: border-box;
				
				.bg1{
					background: url("@/assets/imgs/wmxyc.png") no-repeat;
					background-size: 100% 100%;
				}
				.bg2{
					background: url("@/assets/imgs/hd.png") no-repeat;
					background-size: 100% 100%;
				}
				.bg3{
					background: url("@/assets/imgs/st.png") no-repeat;
					background-size: 100% 100%;
				}
				.bg4{
					background: url("@/assets/imgs/pdgd.png") no-repeat;
					background-size: 100% 100%;
				}
				
				.left{
					width: 94px;
					height: 94px;
				}
				.right{
					height: 80%;
					.right_top{
						height: 50%;
						font-family: Microsoft YaHei;
						font-weight: 400;
						font-size: 14px;
						color: #FFFFFF;
						line-height: 96px;
					}
					.right_bottom{
						height: 50%;
						
						.bottom_left{
							font-family: YouSheBiaoTiHei;
							font-weight: bold;
							font-size: 18px;
							color: #99DDFF;
							line-height: 96px;
							margin-right: 5px;
						}
						
						.bottom_right{
							font-family: Microsoft YaHei;
							font-weight: 400;
							font-size: 13px;
							color: #FFFFFF;
							line-height: 96px;
							opacity: 0.6;
						}
					}
				}
			}
		}
	}
</style>