<template>
  <msg-card class="item-trafficEvent" title="交通事件">
    <div class="full-h trafficEvent" v-loading="eventLoading"
         element-loading-spinner="el-icon-loading"
         element-loading-text="数据加载中..."
         element-loading-background="rgba(3, 11, 25, 0.8)">
      <el-tabs style="height: 100%;">
        <el-tab-pane v-for="(item,index) of trafficEvents" :key="index" style="height: 100%;">
          <template slot="label"
            ><div style="display: flex">
              {{ item.eventCategoryName }}
              <div
                :title="item.number"
                style="
                  max-width: 50px;
                  overflow: hidden;
                  text-overflow: ellipsis;
                  margin-left: 3px;
                "
              >
                {{ item.number }}
              </div>
            </div></template
          >
          <div class="traffics">
            <div
              class="trafficItem"
              v-for="(i,index) of item.eventTypeList"
              :key="index"
              :title="`${i.eventName} ${i.number}`"
            >
              <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 { eventAnalysis } from "../../../../dao/situation";
import msgCard from "../../../../components/Standard/msg-card.vue";

export default {
  name: "trafficEvent",
  components: {
    msgCard,
  },
  data() {
    return {
      eventLoading: true,
      chart: null,
      // 交通事件
      trafficEvents: [],
    };
  },
  methods: {
    getEventAnalysis() {
      eventAnalysis().then((res) => {
        this.eventLoading = false
        this.trafficEvents = res.content;
      });
    },
  },
  mounted() {
    this.getEventAnalysis();
  },
};
</script>

<style lang="less" scoped>
.item-trafficEvent {
  //::-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;
    padding: 0 12px;
  }

  ::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__nav {
    transform: translateX(-50%) !important;
    left: 50%;
  }

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

  ::v-deep .el-tabs__content {
    background-color: #010613;
    padding: 12px;
    overflow: auto;
    height: calc(100% - 30px);
  }
  .head {
    display: flex;
    width: 100%;
    height: 100%;

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

    .number {
      line-height: normal;
    }
  }

  .trafficEvent {
    overflow: hidden;
  }

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

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

      .left {
        overflow: hidden;
        text-overflow: ellipsis;
        // max-width: 85%;
        width: 70%;
        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;
        text-align: center;
        width: 28%;
        // max-width: 80%;
        white-space: nowrap;
      }
    }
  }
}
</style>
