<template>
  <div class="maintenance-supervision">
    <div class="maintenance-supervision_header">
      <button-group @change="change">
        <button-group-item style="width: 152px; padding: 7px 1px">
          管理单位管理建筑排名
        </button-group-item>
        <button-group-item style="width: 152px; padding: 7px 1px">
          维保单位管理建筑排名
        </button-group-item>
        <button-group-item style="width: 147px; padding: 7px 1px">
          建筑入住单位数排名
        </button-group-item>
      </button-group>
    </div>
    <div v-if="checked === 0">
      <div class="row header">
        <span class="num">序号</span>
        <span class="time">管理单位名称</span>
        <span class="result">管理建筑数</span>
      </div>
      <VueSeamlessScroll :data="list1" :class-option="classOption" class="warp">
        <ul class="item">
          <li class="row" v-for="(item, index) in list1" :key="index">
            <span class="num">{{ index + 1 }}</span>
            <span class="time">{{ item[0] }}</span>
            <span class="person">{{ item[1] }}</span>
            <!-- <span class="result"
                  :style="{
                    color: resultType(item[2])
                  }"
                  >{{ item[2] }}</span
                > -->
          </li>
        </ul>
      </VueSeamlessScroll>
    </div>

    <div v-if="checked === 1">
      <div class="row header">
        <span class="num">序号</span>
        <span class="time">维保单位名称</span>
        <span class="person">维保建筑数</span>
      </div>
      <VueSeamlessScroll :data="list2" :class-option="classOption" class="warp">
        <ul class="item">
          <li class="row" v-for="(item, index) in list1" :key="index">
            <span class="num">{{ index + 1 }}</span>
            <span class="time">{{ item[0] }}</span>
            <span class="person">{{ item[1] }}</span>
            <!-- <span class="result"
                  :style="{
                    color: resultType(item[2])
                  }"
                  >{{ item[2] }}</span
                > -->
          </li>
        </ul>
      </VueSeamlessScroll>
    </div>
    <div v-if="checked === 2">
      <div class="row header">
        <span class="num">序号</span>
        <span class="time">登记事件</span>
        <span class="person">排查人员</span>
        <!-- <span class="result">是否存在隐患</span> -->
      </div>
      <VueSeamlessScroll :data="list3" :class-option="classOption" class="warp">
        <ul class="item">
          <li class="row" v-for="(item, index) in list3" :key="index">
            <span class="num">{{ index + 1 }}</span>
            <span class="time">{{ item[0] }}</span>
            <span
              class="person"
              :style="{
                color: resultType(item[1]),
              }"
              >{{ item[1] }}</span
            >
          </li>
        </ul>
      </VueSeamlessScroll>
    </div>
    <!-- <div v-if="checked === 3">
        <div class="row header">
          <span class="time">序号</span>
          <span class="person">建筑名称</span>
          <span class="result">入住单位数</span>
        </div>
        <VueSeamlessScroll
          :data="list3"
          :class-option="classOption"
          class="warp"
        >
        <ul class="item">
            <li class="row" v-for="(item, index) in list1" :key="index">
                <span class="num">{{ index+1 }}</span>
                <span class="time">{{ item[0] }}</span>
                <span class="person">{{ item[1] }}</span>
                 <span class="result"
                  :style="{
                    color: resultType(item[2])
                  }"
                  >{{ item[2] }}</span
                > -->
    <!-- </li>
            </ul>
          </VueSeamlessScroll>
      </div> -->
  </div>
</template>
<script>
import VueSeamlessScroll from "vue-seamless-scroll";

export default {
  name: "MaintenanceSupervision",
  data() {
    return {
      list1: [
        ["环球金融大厦", "40"],
        ["天祥广场", "35"],
        ["经济科技大厦", "23"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
      ],
      list2: [
        ["沙坪坝支队", "合格"],
        ["两江支队", "不合格"],
        ["城口大队", "合格"],
        ["永川支队", "不合格"],
        ["城口大队", "合格"],
        ["永川支队", "合格"],
        ["永川支队", "不合格"],
        ["永川支队", "不合格"],
      ],
      list3: [
        ["环球金融大厦", "40"],
        ["天祥广场", "35"],
        ["经济科技大厦", "23"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
        ["环球金融大厦", "40"],
      ],
      checked: 0,
    };
  },
  components: {
    VueSeamlessScroll,
  },
  computed: {
    classOption() {
      return {
        singleHeight: 43,
      };
    },
  },
  methods: {
    change(idx) {
      this.checked = idx;
      console.log("切换索引", idx);
    },
    resultType(text) {
      return {
        合格: "#23f59d",
        不合格: "#df575b",
        是: "#23f59d",
        否: "#df575b",
      }[text];
    },
  },
};
</script>

<style scoped lang="less">
.maintenance-supervision {
  // padding: 10px 10px 0px 20px;
  .maintenance-supervision_header {
    border-bottom: 1px solid #154956;
    padding-bottom: 2px;
    margin-top: 15px;
    font-size: 12px;
    color: rgb(79, 149, 186);
  }
  .warp {
    height: 520px;
    margin: 0 auto;
    overflow: hidden;
    .item {
      list-style: none;
      padding: 0;
      margin: 0 auto;
      cursor: pointer;
    }
  }

  .header {
    color: #fff;
    height: 33px !important;
    line-height: 33px !important;
    background-color: rgba(0, 163, 255, 0.3) !important;
    color: #61dbff;
    margin-top: 15px;
    margin-bottom: 6px;
  }

  .row,
  li,
  a {
    display: block;
    height: 39px;
    line-height: 39px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.2);
    .time,
    .num,
    .person,
    .result {
      flex: 0.33;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .num {
      flex: 0.15;
    }
    .time {
      flex: 1;
    }
    .result {
      flex: 0.35;
    }
  }
}
</style>
