<template>
  <div>
    <div class="row header">
      <span class="idx">序号</span>
      <span class="time">起火时间</span>
      <span class="name">建筑名称</span>
      <span class="count">伤亡人数(人)</span>
      <span class="area">过火面积(㎡)</span>
      <span class="reason">起火原因</span>
    </div>
    <VueSeamlessScroll :data="list" :class-option="classOption" class="warp">
      <ul class="item">
        <li
          class="row"
          v-for="(item, index) in list"
          :key="index"
          @click="ToUnitInfo(item)"
        >
          <span class="idx">{{ index + 1 }}</span>
          <span class="time">{{ item.zqsj }}</span>
          <span class="name">{{ item.zqdd }}</span>
          <span class="count">{{ item.rysws }}</span>
          <span class="area">{{ item.ghmj }}</span>
          <span class="reason">{{ item.qhyy1 }}</span>
        </li>
      </ul>
    </VueSeamlessScroll>
  </div>
</template>

<script>
import { historyData } from "@/api/hzfx";
import VueSeamlessScroll from "vue-seamless-scroll";
export default {
  name: "RegionalComp",
  components: {
    VueSeamlessScroll,
  },
  props: {
    qx: String,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.loadData();
  },
  watch: {
    qx() {
      this.loadData();
    },
  },
  methods: {
    loadData() {
      historyData({
        pageSize: 100,
        qx: this.qx === "重庆市" ? "" : this.qx,
      }).then((res) => {
        this.list = res.data.rows;
      });
    },
    ToUnitInfo(item) {
      window.location.href = `/detail?id=${item.jzid}`;
    },
  },
  computed: {
    classOption() {
      return {
        singleHeight: 51,
      };
    },
  },
};
</script>
<style scoped lang="less">
.warp {
  height: 515px;
  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;
  // font-size: 8px;
  .is_notice {
    line-height: 19px;
    font-size: 10px;
  }
}

li.row > span {
  text-align: center;
  font-size: 14x;
  position: relative;
  display: inline-block;
}

li.row {
  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: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  color: #fff;
  margin-top: 5px;
  .idx,
  .time,
  .name,
  .count,
  .area,
  .reason {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .idx {
    flex: 0.1;
  }

  .time {
    flex: 0.2;
  }
  .name {
    flex: 0.2;
    font-size: 12px;
    text-align: center;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis !important; // 超出隐藏
    white-space: nowrap;
  }
  .count {
    flex: 0.2;
  }
  .area {
    flex: 0.18;
  }
  .reason {
    flex: 0.15;
  }
}
</style>
