<template>
  <div class="container">
    <div class="block1">
      <layout-title title="设备在线情况" />
      <div class="option">
        <div
          v-for="(item, index) in data.block1OptionsList"
          :key="index"
          class="list"
        >
          <img :src="item.img" alt="" class="img" />
          <div class="label">{{ item.label }}</div>
          <div class="num">
            <count-up :end-val="item.count"></count-up>
          </div>
        </div>
      </div>
    </div>
    <div class="block2">
      <layout-title title="堆料场进出数据" />
      <div class="options">
        <div class="option">
          <div class="title">今日人员情况</div>
          <div class="wraps">
            <div class="wrap">进堆料场人员数: 0</div>
            <div class="wrap">出堆料场人员数: 0</div>
            <div class="wrap">堆料场内人员数: 0</div>
          </div>
        </div>
        <div class="option">
          <div class="title">今日车辆情况</div>
          <div class="wraps">
            <div class="wrap">进堆料场车辆数: 0</div>
            <div class="wrap">出堆料场车辆数: 0</div>
            <div class="wrap">堆料场内车辆数: 0</div>
          </div>
        </div>
      </div>
    </div>

    <div class="block3">
      <layout-title title="口门进出记录" />
      <div class="option">
        <div class="tab_list">
          <div
            v-for="(item, index) in tabsList"
            :key="index"
            class="list"
            :class="['item', { active: index === tabIndex }]"
            @click="tabIndex = index"
          >
            {{ item }}
          </div>
        </div>
        <div class="table">
          <div class="tr">
            <div class="td">卡口名称</div>
            <div class="td">车牌</div>
            <div class="td">时间</div>
            <div class="td">状态</div>
          </div>
          <div v-for="(item, index) in data.block3List" :key="index" class="tr">
            <div class="td line-1">{{ item.name }}</div>
            <div class="td">{{ item.licensePlate }}</div>
            <div class="td line-1">{{ item.time }}</div>
            <div class="td">{{ item.state }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import LayoutTitle from "./title.vue";
import CountUp from "vue-countup-v3";
import { reactive, ref } from "vue";
const data = reactive({
  block1OptionsList: [
    {
      img: new URL("/src/assets/images/map/img7.png", import.meta.url).href,
      label: "人员闸机数",
      count: 0,
    },
    {
      img: new URL("/src/assets/images/map/img8.png", import.meta.url).href,
      label: "车辆闸机数",
      count: 0,
    },
    {
      img: new URL("/src/assets/images/map/img9.png", import.meta.url).href,
      label: "摄像头数",
      count: 0,
    },
  ],
  block3List: [
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
    {
      name: "南大门卡口",
      licensePlate: "冀CAD097",
      time: "2023-5-16 12:36:25",
      state: "正常",
    },
  ],
});

const tabsList = ["人员闸机", "车辆闸机"];
const tabIndex = ref(0);
</script>
<style scoped lang="scss">
.container {
  width: 100%;

  .block1 {
    width: 430px;

    .option {
      width: 100%;
      min-height: 100px;
      background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0),
        rgba(0, 0, 0, 0.8)
      );
      border: 1px solid;
      border-image: linear-gradient(
          to bottom,
          rgba(58, 122, 149, 0),
          rgba(16, 188, 236, 1)
        )
        1;
      border-top: none;
      display: flex;
      justify-content: space-around;
      padding: 20px 0;
      text-align: center;

      .list {
        text-align: center;
        width: 33%;

        .img {
          animation: slideY 2s infinite;
        }

        .label {
          margin-top: 5px;
        }

        .num {
          font-size: 24px;
          margin-top: 10px;
          background: linear-gradient(to top, #ffffff, #00a8ff);
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
          font-weight: bold;
          font-family: "Pingfang SC", "Microsoft YaHei", "Monospaced Number",
            "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI",
            Roboto, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue",
            Helvetica, Arial, sans-serif;
          text-shadow: 0 0 20px #2c67ec;
        }
      }
    }
  }

  .block2 {
    width: 430px;
    margin-top: 10px;

    .options {
      width: 100%;
      min-height: 100px;
      background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0),
        rgba(0, 0, 0, 0.8)
      );
      border: 1px solid;
      border-image: linear-gradient(
          to bottom,
          rgba(58, 122, 149, 0),
          rgba(16, 188, 236, 1)
        )
        1;
      border-top: none;
      padding: 10px;
      text-align: left;
      display: flex;
      flex-direction: column;
      .option {
        width: 100%;
        .title {
          background: rgba(10, 69, 203, 0.5);
          border: 1px solid;
          border-image: linear-gradient(
              to bottom,
              rgba(58, 122, 149, 0),
              rgba(16, 188, 236, 1)
            )
            1;
          border-top: none;
          display: inline-block;
          padding: 6px 20px;
          margin: 10px 0;
        }
        .wraps {
          width: 100%;
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;

          .wrap {
            width: 45%;
            text-align: left;
            margin: 10px;
          }
        }
      }
    }
  }

  .block3 {
    width: 430px;
    margin-top: 10px;

    .tab_list {
    }

    .option {
      width: 100%;
      min-height: 100px;
      background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0),
        rgba(0, 0, 0, 0.8)
      );
      border: 1px solid;
      border-image: linear-gradient(
          to bottom,
          rgba(58, 122, 149, 0),
          rgba(16, 188, 236, 1)
        )
        1;
      border-top: none;
      padding: 10px;

      .tab_list {
        display: flex;
        background: rgba(52, 147, 245, 0.3);
        border: 1px solid rgba(63, 145, 197, 0.4);
        border-radius: 2px;
        width: 38%;
        justify-content: space-between;

        .list {
          padding: 8px 10px;
          cursor: pointer;

          &:hover,
          &.active {
            background-image: linear-gradient(
              to bottom,
              rgba(1, 168, 255, 1),
              rgba(17, 74, 152, 1)
            );
          }
        }
      }
      .table {
        margin-top: 5px;

        .tr {
          display: flex;
          &:nth-child(odd) {
            background-color: rgba(42, 86, 158, 0.53);
          }
          .td {
            flex: 1;
            text-align: left;
            font-size: 12px;
            color: #fff;
            padding: 6px 10px;
            &:nth-child(1) {
              flex-basis: 25%;
            }
            &:nth-child(2) {
              flex-basis: 25%;
            }
            &:nth-child(3) {
              flex-basis: 35%;
            }
            &:nth-child(4) {
              flex-basis: 15%;
            }
          }
          .empty {
            flex: 1;
            text-align: center;
            font-size: 12px;
            color: #fff;
            padding: 5px;
          }
        }
      }
    }
  }

  @keyframes slideY {
    0% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-5px);
    }
    100% {
      transform: translateY(0);
    }
  }
}
</style>
