<template>
  <div class='RoadNetworkMonitoring2'>
    <Tabs :panels="panels" :default-active="activeName" />

    <!-- 搜索栏 -->
    <div class="filter">
      <div>
        <ButtonGradient>
          <template #prefix>
            <img src="./images/insert.svg" />
          </template>
          新增
        </ButtonGradient>
        <ButtonGradient>
          <template #prefix>
            <img src="./images/export.svg" />
          </template>
          导出
        </ButtonGradient>
        <ButtonGradient>
          <template #prefix>
            <img src="./images/refresh.svg" />
          </template>
          刷新
        </ButtonGradient>

      </div>
      <InputSearch style="width: 402px;" />
    </div>

    <!-- 内容 -->
    <div class="body">
      <RoadStateCard v-for="(item, index) in data" :cardData="item" :key="index"
        :lastBtnColor="item.state === 5 ? '#007FF4' : void 0" :lastBtnText="item.state === 5 ? '去确认' : void 0" />
    </div>

    <!-- 分页 -->
    <div class="footer">
      <Pagination :total="90" />
    </div>
  </div>
</template>

<script>
import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue';
import Tabs from '@screen/components/Tabs/index.vue';
import RoadStateCard from '@screen/components/RoadStateCard/index.vue';
import Pagination from '@screen/components/Pagination.vue';
import InputSearch from '@screen/components/InputSearch/index.vue';

export default {
  name: 'RoadNetworkMonitoring2',
  components: {
    ButtonGradient,
    Tabs,
    Pagination,
    RoadStateCard,
    InputSearch
  },
  data() {
    return {
      data: Array.from({ length: 15 }).map(() => ({
        time: "2023.12.22 13:00:00",
        source: "视频智能识别",
        location: "k100+000",
        direction: "济南方向",
        state: (() => {
          const min = 1;
          const max = 5;
          return Math.floor(Math.random() * (max - min + 1)) + min;
        })()
      })),

      activeName: "告警事件(20)",
      panels: [
        {
          label: "告警事件(20)",
          key: "告警事件(20)"
        },
        {
          label: "待确认事件(125)",
          key: "待确认事件(125)"
        },
        {
          label: "处置中事件(230)",
          key: "处置中事件(230)"
        },
        {
          label: "已处置事件(76)",
          key: "已处置事件(76)"
        },
      ]
    }
  },
  methods: {
  }
}
</script>

<style lang='scss' scoped>
.RoadNetworkMonitoring2 {
  padding: 21px;

  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 6;
  width: 100%;
  height: 100%;

  .filter {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    >div {
      display: flex;
      gap: 6px;
    }
  }

  .body {
    flex: 1;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 24px;
    // grid-row-gap: 9px;
    // grid-column-gap: 9px;
    grid-auto-rows: min-content;
  }

  .footer {
    margin-top: 15px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
