<template>
  <div class="home-left">
    <div class="topI">
      <msg-card title="事故现场监控">
        <div class="videos">
          <local-camera
            ref="videoItem"
            class="videoItem"
            v-for="(item, index) of videos"
            :key="index"
            :video-data="item"
          />
          <span class="top-left"></span>
          <span class="top-right"></span>
          <span class="bottom-left"></span>
          <span class="bottom-right"></span>
        </div>
      </msg-card>
    </div>
    <div class="bottomI">
      <div class="analysis">
        <msg-card class="m-b-10" title="事件辅助定责">
          <div class="msgTitle"><span></span> 实时分析</div>
          <div class="timeMsg">
            <i class="el-icon-time" />疑似事故检测时长：<span>{{totalDuration}}s</span>
          </div>
          <div class="customTable">
            <div class="row" v-for="(item, key, index) of rows" :key="index">
              <div
                class="col col-label"
                :class="[item.length > 25 ? 'longT' : '']"
              >
                {{ key }}
              </div>
              <div
                class="col col-value"
                :class="[item.length > 25 ? 'longT' : '']"
              >
                {{ item }}
              </div>
            </div>
          </div>
        </msg-card>
        <msg-card title="交通影响报告">
          <div class="msgTitle"><span></span> 影响评估</div>
          <div class="cTable">
            <el-row class="row1">
              <el-col class="col deep" :span="5">涉事地点</el-col>
              <el-col class="col" :span="9">
                <span
                  :class="[item === affectDetail.locationVal ? 'span-check' : '']"
                  v-for="(item, index) of location"
                  :key="index"
                  >{{ item }}</span
                >
              </el-col>
              <el-col class="col deep" :span="4">涉事车辆</el-col>
              <el-col class="col" :span="6">
                <span
                  :class="[item === affectDetail.isMultiVal ? 'span-check' : '']"
                  v-for="(item, index) of isMulti"
                  :key="index"
                  >{{ item }}</span
                >
              </el-col>
            </el-row>
            <el-row class="row1">
              <el-col class="col deep" :span="5">涉事时段</el-col>
              <el-col class="col" :span="9">
                <span
                  :class="[item === affectDetail.timeTypeVal ? 'span-check' : '']"
                  v-for="(item, index) of timeType"
                  :key="index"
                  >{{ item }}</span
                >
              </el-col>
              <el-col class="col deep" :span="4">涉事行人</el-col>
              <el-col class="col" :span="6">
                <span
                  :class="[item === affectDetail.haveWalkerVal ? 'span-check' : '']"
                  v-for="(item, index) of haveWalker"
                  :key="index"
                  >{{ item }}</span
                >
              </el-col>
            </el-row>
            <el-row class="row1">
              <el-col class="col deep" :span="5">涉事非机动车</el-col>
              <el-col class="col" :span="19">
                <span
                  :class="[item === affectDetail.haveNoVehicleVal ? 'span-check' : '']"
                  v-for="(item, index) of haveNoVehicle"
                  :key="index"
                  >{{ item }}</span
                >
              </el-col>
            </el-row>
          </div>
          <div class="msgTitle"><span></span> 影响程度</div>
          <div class="gradiantPoint">
            <div
              v-for="(item, index) of 10"
              :key="index"
              :class="[`point${item}`]"
              class="pointItem"
            >
              <div v-show="item === affectDetail.orderOfSeverity" class="arrow-down"></div>
<!--              <div class="text-t">{{ indexMap[item] }}</div>-->
            </div>
          </div>
        </msg-card>
      </div>
    </div>
  </div>
</template>

<script>
import CameraVideo from "../../../components/Standard/cameraVideo.vue";
import MsgCard from "../../../components/Standard/msg-card.vue";
import { getCameraListByType } from "../../../dao/api";
import LocalCamera from "../../../components/Standard/localCamera.vue";

export default {
  name: "homeLeft",
  components: { LocalCamera, MsgCard, CameraVideo },
  computed: {
    videos() {
      return situation_accident.videos.slice(0, 1);
    },
  },
  data() {
    return {
      totalDuration: '',
      indexMap: {
        1: "低",
        2: "较低",
        3: "中",
        5: "高",
        10: "较高",
      },
      cameras: [],
      location: ["路口", "路段", "高架桥"],
      affectDetail:{},
      isMulti: ["单车", "多车"],
      timeType: ["早高峰", "平峰", "晚高峰", "夜间"],
      haveWalker: ["有", "无"],
      haveNoVehicle: ["有", "无"],
      rows: {
      },
    };
  },
  created(){
    this.rows = situation_accident.eventDetail
    this.totalDuration = situation_accident.totalDuration
    this.affectDetail = situation_accident.affectDetail
  },
  mounted() {},
  methods: {
    startVideo(time) {
      console.log(this.$refs.videoItem);
      for (let item of this.$refs.videoItem) {
        item.setTime(time);
      }
    },
    initData() {
    },
  },

  beforeDestroy() {},
};
</script>

<style lang="less" scoped>
.cTable {
  font-size: 16px;
  border-top: 1px solid rgba(62, 108, 150, 1);
  border-left: 1px solid rgba(62, 108, 150, 1);
  margin-bottom: 10px;

  .row1 {
    height: 32px;
    width: 100%;

    .col {
      display: flex;
      align-items: center;
      height: 100%;
      border-bottom: 1px solid rgba(62, 108, 150, 1);
      border-right: 1px solid rgba(62, 108, 150, 1);

      span {
        display: inline-block;
        height: 20px;
        padding: 0 3px;
        line-height: 20px;
        font-size: 14px;
        margin-left: 3px;
        border: 1px solid rgba(5, 122, 255, 0);
        border-radius: 8px;
      }

      .span-check {
        border: 1px solid rgba(5, 122, 255, 1);
      }
    }

    .deep {
      justify-content: center;
      background-color: rgba(46, 119, 255, 0.15);
    }
  }
}

.customTable {
  color: white;
  width: 100%;
  font-size: 16px;
  border-top: 1px solid rgba(62, 108, 150, 1);
  border-left: 1px solid rgba(62, 108, 150, 1);

  .row {
    display: flex;
    width: 100%;

    .col {
      border-bottom: 1px solid rgba(62, 108, 150, 1);
      border-right: 1px solid rgba(62, 108, 150, 1);
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .longT {
      height: 48px;
    }

    .col-label {
      width: 20%;
      background-color: rgba(46, 119, 255, 0.15);
    }

    .col-value {
      width: 80%;
      padding: 0 20px;
      justify-content: flex-start;
      background-color: transparent;
    }
  }
}

.top-left {
  position: absolute;
  left: -1px;
  top: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 2px 0 0 2px;
}

.top-right {
  position: absolute;
  right: -1px;
  top: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 2px 2px 0 0;
}

.bottom-left {
  position: absolute;
  right: -1px;
  bottom: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 0 2px 2px 0;
}

.bottom-right {
  position: absolute;
  left: -1px;
  bottom: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 0 0 2px 2px;
}

.msgTitle {
  font-size: 18px;
  font-weight: 700;
  color: white;
  display: flex;
  height: 30px;
  line-height: 30px;
  align-items: center;
  margin-bottom: 5px;

  span {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 3px solid #0d7fd7;
    rotate: 45deg;
    margin-right: 8px;
  }
}

.home-left {
  z-index: 11;
  position: absolute;
  left: 0;
  top: 0;
  color: white;
  height: 100%;
  width: 668px;
  background-color: rgba(3, 11, 25, 0.45);
  background-image: linear-gradient(
    90deg,
    rgba(8, 20, 31, 0) 100%,
    rgba(6, 16, 26, 1) 0%
  );
  padding: 15px 25px;
  display: flex;
  flex-direction: column;

  .topI {
    height: 35%;
    margin-bottom: 15px;

    .videos {
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-content: space-between;
      align-items: stretch;
      position: relative;
      flex-flow: row wrap;

      .videoItem {
        width: 100%;
        height: 100%;
        // aspect-ratio: 4/3;
        position: relative;
      }
    }
  }

  .bottomI {
    ::v-deep {
      overflow-y:visible!important;
    }
    height: 65%;
    .analysis {
      height: 100%;
      display: flex;
      flex-direction: column;

      .timeMsg {
        height: 30px;
        line-height: 30px;
        background-image: url("../../../assets/images/sc/titleBackG.png");
        background-size: auto 100%;
        background-position-x: center;
        background-repeat: no-repeat;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 18px;

        span {
          font-weight: 700;
        }

        .el-icon-time {
          margin-right: 5px;
        }
      }

      .gradiantPoint {
        display: flex;
        margin-top: 0px;
        padding: 0 20px;
        justify-content: space-between;
        overflow: visible;

        .pointItem {
          width: 10px;
          height: 18px;
          position: relative;
          border-radius: 4px;
          .text-t {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            top: 28px;
            width: 30px;
            font-size: 14px;
            text-align: center;
          }
          .arrow-down {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            top: -28px;
            width: 31px;
            height: 33px;
            background-image: url("../../../assets/images/acci/arrow-down.png");
            background-position: center;
          }
        }

        .point1 {
          background-color: #1afd9c;
        }

        .point2 {
          background-color: #28fd28;
        }

        .point3 {
          background-color: #f4fa01;
        }

        .point4 {
          background-color: #fdc616;
        }

        .point5 {
          background-color: #ff972a;
        }

        .point6 {
          background-color: #ef7923;
        }

        .point7 {
          background-color: #de5a1a;
        }

        .point8 {
          background-color: #cd3d12;
        }

        .point9 {
          background-color: #bd2009;
        }

        .point10 {
          background-color: #ac0100;
        }
      }
    }
  }
}

.m-b-10 {
  margin-bottom: 5px;
}
</style>
