<template>
  <msg-card class="item item-trafficEvent" title="交通事件">
    <div class="full-h trafficEvent">
      <el-tabs style="height: 100%">
        <el-tab-pane v-for="item of trafficEvents" :key="item">
          <span slot="label"
            >{{ item.eventCategoryName }} {{ item.number }}</span
          >
          <div class="traffics">
            <div class="trafficItem" v-for="i of item.eventTypeList" :key="i">
              <span class="left">
                <span class="circle4"></span>{{ i.eventName }}</span
              ><span class="right">{{ i.number }}</span>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </msg-card>
</template>

<script>
import msgCard from "../../../components/Standard/msg-card.vue";
import { getData } from "../../../dao/requestByUrl.js";
export default {
  components: { msgCard },
  data() {
    return {
      // 交通事件
      trafficEvents: [],
    };
  },
  mounted() {
    this.initData();
  },
  methods: {
    async initData() {
      let req = await fetch("DATA.json");
      let allData = await req.json();
      let api = allData.intersectionGroups.apis.trafficEvent.url;
      getData(api).then(res=>{
        this.trafficEvents = res.content;
      })
    },
  },
};
</script>

<style lang="less" scoped>
.item-trafficEvent {
  ::v-deep .el-tab-pane {
    height: 100%;
    overflow-y: auto;
  }

  ::-webkit-scrollbar {
    width: 0;
    height: 0;
    background-color: #f5f7fa;
  }

  ::v-deep .el-tabs__item {
    color: white;
    height: 28px;
    line-height: 24px;
    font-size: 16px;
    font-weight: 500;
  }

  ::v-deep .el-tabs__active-bar {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(41, 110, 194, 1) 50%,
      transparent 100%
    );
  }

  ::v-deep .el-tabs__header {
    margin: 0;
    height: 30px;
  }

  ::v-deep .el-tabs__content {
    background-color: transparent;
    padding: 10px 12px 8px 12px;
    height: calc(100% - 30px);
    border: 1px solid #102945;
    background-color: #010613;
    border-radius: 4px;
  }

  ::v-deep .el-tabs__nav {
    transform: translateX(-50%) !important;
    left: 50%;
  }

  ::v-deep .el-tabs__nav-wrap::after {
    background-color: transparent;
  }

  .head {
    display: flex;
    width: 100%;
    height: 100%;

    .name {
      height: 100%;
      width: 90%;
      line-height: normal;
    }

    .number {
      line-height: normal;
    }
  }

  .trafficEvent {
    overflow: auto;
  }

  .traffics {
    color: rgba(155, 177, 212, 1);
    display: flex;
    justify-content: space-between;
    flex-flow: row wrap;

    .trafficItem {
      font-size: 14px;
      flex: 0 0 49.2%;
      height: 34px;
      margin-bottom: 7px;
      display: flex;
      align-items: center;
      background-color: rgba(0, 14, 39, 1);

      .left {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 85%;
        white-space: nowrap;

        .circle4 {
          display: inline-block;
          width: 10px;
          height: 10px;
          text-align: center;
          line-height: 10px;
          margin: 0 8px;
          background-image: url("../../../assets/images/holo/textMarker.png");
          background-size: 100% 100%;
          background-repeat: no-repeat;
        }

        display: inline-block;
        width: 85%;
      }

      .right {
        color: rgba(0, 159, 238, 1);
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80%;
        white-space: nowrap;
      }
    }
  }
}
</style>
