<template>
  <div class="maintenance-supervision">
    <div class="maintenance-supervision_header">
      <button-group @change="change">
        <button-group-item> 自查情况 </button-group-item>
        <button-group-item> 监督检查 </button-group-item>
        <button-group-item> 网络排查 </button-group-item>
        <button-group-item> 维保概况 </button-group-item>
      </button-group>
    </div>
    <div v-if="checked === 0">
      <div class="row header">
        <span class="time">排查时间</span>
        <span class="person">排查人员</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="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="time">检查结束事件</span>
        <span class="person">执法机构</span>
        <span class="result">检查结果</span>
      </div>
      <VueSeamlessScroll :data="list2" :class-option="classOption" class="warp">
        <ul class="item">
          <li class="row" v-for="(item, index) in list2" :key="index">
            <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="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="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 === 3">
      <div class="row header">
        <span class="time">检查时间</span>
        <span class="person">检查人</span>
        <span class="result">检查结果</span>
      </div>
      <VueSeamlessScroll :data="list4" :class-option="classOption" class="warp">
        <ul class="item">
          <li class="row" v-for="(item, index) in list4" :key="index">
            <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: [
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "王小强", "不合格"],
      ],
      list2: [
        ["09:23 05-14", "沙坪坝支队", "合格"],
        ["09:23 05-14", "两江支队", "不合格"],
        ["09:23 05-14", "城口大队", "合格"],
        ["09:23 05-14", "永川支队", "不合格"],
        ["09:23 05-14", "城口大队", "合格"],
        ["09:23 05-14", "永川支队", "合格"],
        ["09:23 05-14", "永川支队", "不合格"],
        ["09:23 05-14", "永川支队", "不合格"],
      ],
      list3: [
        ["09:23 05-14", "张三", "是"],
        ["09:23 05-14", "王小强", "否"],
        ["09:23 05-14", "张三", "是"],
        ["09:23 05-14", "王小强", "否"],
        ["09:23 05-14", "张三", "是"],
        ["09:23 05-14", "张三", "是"],
        ["09:23 05-14", "王小强", "否"],
        ["09:23 05-14", "王小强", "否"],
      ],
      list4: [
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "张三", "合格"],
        ["09:23 05-14", "王小强", "不合格"],
        ["09:23 05-14", "王小强", "不合格"],
      ],
      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 10px;
  .maintenance-supervision_header {
    border-bottom: 1px solid #154956;
    padding-bottom: 2px;
  }
  .warp {
    height: 258px;
    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,
    .person,
    .result {
      flex: 0.33;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
</style>
