<template>
	<div class="right_five">
    <common-title title="建筑层数" />
		<div class="content"  v-loading="isLoading"
         element-loading-background="rgba(0, 22, 52, 0.75)">
			<div class="item" v-for="(item,index) in arr" :key="index">
				<div class="item_top">
					{{item.jzcs}}
				</div>
				<div class="item_bottom center">
					<div class="bottom_left">
						{{item.jzmj}}
					</div>
					<div class="bottom_right">
						万㎡
					</div>
					<div class="bottom_left">
						{{item.per}}
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup>
	import {
		ref,
		onMounted,
		nextTick
	} from 'vue'
	import {
		getSelectJzcsCount
	} from '../service/http.js'
  import CommonTitle from "@/views/c-cpns/CommonTitle.vue";
	let arr = ref([]);
	let total = ref(0);
  const isLoading = ref(false);
	onMounted(() => {
    isLoading.value = true;
		getSelectJzcsCount().then(res => {
      isLoading.value = false;
			let list = res.data.data.Rows
			list.forEach(item=>{
				if(item.jzcs == "总量"){
					total.value = item.jzmj
				}
			})
			arr.value = list.filter(item=>{
				return item.jzcs != "总量"
			})
			arr.value.forEach(item=>{
				item["per"] = ((Number(item.jzmj)/total.value)*100).toFixed(2) + '%'
			})
		})
	})
	
</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_five{
		height: 21%;
		padding-top: 10px;
		box-sizing: border-box;
		.content {
			height: 70%;
			width: 90%;
			margin: 0 20px;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			
			.item{
				width: 50%;
				height: 40%;
				box-sizing: border-box;
				margin-top: 10px;
				
				.item_top{
					width: 100%;
					height: 23px;
					background: url("@/assets/imgs/gsgxfxwzbj.png") no-repeat;
					font-family: Microsoft YaHei;
					font-weight: bold;
					font-size: 15px;
					color: #D1D6DF;
					line-height: 27px;
					font-style: italic;
					background-color: linear-gradient(0deg, #ACDDFF 0%, #FFFFFF 100%);
					/* -webkit-background-clip: text;
					-webkit-text-fill-color: transparent; */
				}
				.item_bottom{
					height: 80%;
					.bottom_left{
						margin: 0 5px;
						font-family: DIN;
						font-weight: 500;
						font-size: 18px;
						color: #50E0FF;
					}
					.bottom_right{
						font-family: Microsoft YaHei;
						font-weight: 400;
						font-size: 13px;
						color: #D1D6DF;
					}
				}
			}
		}
	}
</style>