<template>
  <div>
    <div class="row header">
      <span class="type">序号</span>
      <span class="count">区域</span>
      <span class="time">总数(栋)</span>
      <span class="unit">有物联网(栋)</span>
      <span class="is_notice">占比%</span>
    </div>
    <VueSeamlessScroll v-if="reload" :class-option="classOption" :data="dataList" class="warp">
      <ul class="item">
        <li class="row" :class="{
          active: item.isActive
        }" v-for="(item, index) in dataList" :key="index"  @click="showModul(item.qx)">
          <span class="type">{{ index + 1 }}</span>
          <span class="count">{{ item.qx }}</span>
          <span class="time">{{ item.zs }}</span>
          <span class="unit">{{ item.jswlwsl || "-" }}</span>
          <span class="is_notice">{{ item.zb || "-" }}</span>
        </li>
      </ul>
    </VueSeamlessScroll>
    <!-- 区域分布弹窗 -->
		<basic-modal top="120px" ref="basicInfo" name="基础信息">
      <BasicInfoModalContent :qy="name" />
    </basic-modal>
  </div>
</template>

<script>
import VueSeamlessScroll from "vue-seamless-scroll";
import BasicInfoModalContent from "../../Home/components/BasicInfoModalContent.vue";
export default {
  name: "RegionalComp",
  components: {
    VueSeamlessScroll,
    BasicInfoModalContent
  },
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    qx: String
  },
  data() {
	return {
		dataList: [],
    reload: true,
    name:''
	}
  },
  watch:{
	list: {
		handler(val) {
      this.reload = false
			this.dataList = val
      let timer = setTimeout(() => {
       this.reload = true
       timer && clearTimeout(timer)
      }, 100);
		},immediate: true,
		deep: true
	}
  },
  computed: {
    classOption() {
      return {
        singleHeight: 51,
        autoPlay: this.qx === '重庆市'
      };
    },
  },
  methods:{
    	//区域分布弹窗
			showModul(val){
        this.name=val
				this.showModal("basicInfo");
			}
  }
};
</script>
<style scoped lang="less">
.warp {
  height: 521px;
  margin: 0 auto;
  overflow: hidden;

  .item {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    cursor: pointer;
  }
}

.header {
  color: #61dbff !important;
  height: 38px !important;
  background-color: rgba(0, 163, 255, 0.3) !important;
  margin-top: 2px;
  letter-spacing: 1px;

  .is_notice {
    line-height: 19px;
    font-size: 10px;
  }
}
li.row.active {
  background-color: rgba(0, 213, 255, 0.2);
}
li.row > span {
  text-align: center;
  font-size: 14x;
  position: relative;
  display: inline-block;
}

li.row {
  //   border-bottom: 1px dotted #1d525f;
  box-sizing: border-box;
}

.row,
li,
a {
  display: block;
  height: 46px;
  line-height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.2);
  color: #fff;
  margin-top: 5px;

  .time,
  .type,

  .unit,
  .is_notice {
    display: flex;
    flex: 0.15;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .time {
    flex: 0.2;
  }

  .type {
    flex: 0.12;
  }

  .count {
    flex: 0.25;
    // display: inline-block;
      overflow: hidden ;
      text-overflow: ellipsis ;
      white-space:nowrap;
      text-align: center;
  }

  .unit {
    color: #61dbff;
    flex: 0.25;
  }

  .is_notice {
    flex: 0.15;
  }
}
</style>
