<template>
  <div class="videoDaysDetail">
    <el-dialog title="录像详情" :visible.sync="isShow" width="1400px" :destroy-on-close="true">
      <el-descriptions title="基础信息" :column="3">
        <el-descriptions-item label="通道名称" >测试摄像头001</el-descriptions-item>
        <el-descriptions-item label="监控主机" >讯美测试部服务主机01</el-descriptions-item>
        <el-descriptions-item label="IP地址" >192.168.1.1</el-descriptions-item>
<!--        <el-descriptions-item label="组织机构" >{{data.orgName}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="上报时间" >{{data.updateTime}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="监控主机" >{{data.equipmentName}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="摄像头" >{{data.channelName}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="通道号" >{{data.channelCode}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="计划存储天数" >{{data.planDays}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="实际存储天数" >{{data.realDays}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="计划录像开始时间" >{{data.planStartTime}}</el-descriptions-item>-->
<!--        <el-descriptions-item label="计划录像结束时间" >{{data.planEndTime}}</el-descriptions-item>-->
      </el-descriptions>

      <el-descriptions title="录像质量" :column="3">
        <el-descriptions-item label="检测结果" >异常</el-descriptions-item>
        <el-descriptions-item label="原因" >被遮挡</el-descriptions-item>
        <el-descriptions-item label="更新时间" >2024年1月26日 09:00</el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="1">
        <el-descriptions-item label="诊断截图" >
          <div>
            <ul class="legend-box">
              <li>
                <el-tag size="small" type="warning">视频信号</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">遮挡</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">模糊</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">偏色</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">雪花</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">条纹</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">对比度</el-tag>
              </li>
              <li>
                <el-tag size="small" type="warning">亮度</el-tag>
              </li>
            </ul>
            <div style="display: block;width: 300px;max-height: 300px;margin-top: 20px;">
              <el-image :src="src" :preview-src-list="[src]">
                <div slot="error" class="image-slot">
                  <i class="el-icon-picture-outline"></i>
                </div>
              </el-image>
            </div>
          </div>
        </el-descriptions-item>
      </el-descriptions>


      <el-descriptions title="录像完整性" :column="3">
        <el-descriptions-item label="录像日期" >2024年1月26日</el-descriptions-item>
        <el-descriptions-item label="更新时间" >2024年1月26日 09:00</el-descriptions-item>
        <el-descriptions-item label="原因" >被遮挡</el-descriptions-item>
        <el-descriptions-item label="检测结果" >异常</el-descriptions-item>
        <el-descriptions-item label="丢失时长" >8:46</el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="1">
        <el-descriptions-item label="丢失时段" >
          <!--          <time-line></time-line>-->
          <ul class="legend-box">
            <li>
              <i class="legend" style="background-color: #00b2ff"></i>
              <span>计划时长</span>
            </li>
            <li>
              <i class="legend" style="background-color: green"></i>
              <span>有录像</span>
            </li>
            <li>
              <i class="legend" style="background-color: red"></i>
              <span>无录像</span>
            </li>
            <li>
              <i class="legend" style="background-color: #aaa"></i>
              <span>未知</span>
            </li>
          </ul>
        </el-descriptions-item>
      </el-descriptions>

      <div class="time-line-box">
        <div style="width: 100%;height: 20px;background-color: red; "></div>
        <progress-bar :timeCell="timeCells" :videoData="playVideoObj" :startTime="start_timestamp" ></progress-bar>
      </div>
      <div class="time-line">
        <el-timeline :reverse="false">
          <el-timeline-item
            v-for="(activity, index) in data.loseDateList"
            :key="index"
            color="rgb(208 230 253)"
            size="large"
            type="primary">
            <div class="time">
              <div>
                <span class="year">
                  {{ activity.month }}
                </span>
              </div>
              <!-- <div class="day">{{ activity.time.substring(0, 4) }}年</div> -->
            </div>
            <div class="ml10">
              <el-tag v-for="(date, number) in activity.lostDates" :key="number">
                <div>{{ date }}
                  <div class="reTip">
                  </div>
                </div>
              </el-tag>
            </div>
          </el-timeline-item>
        </el-timeline>
      </div>

      <el-descriptions title="录像存储天数" :column="3">
        <el-descriptions-item label="检查结果" >异常</el-descriptions-item>
        <el-descriptions-item label="实际存储天数" >0</el-descriptions-item>
        <el-descriptions-item label="计划要求存储天数" >30</el-descriptions-item>
        <el-descriptions-item label="计划内最早录像日期" >2024年1月26日</el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="1">
        <el-descriptions-item label="录像存储天数" >
          <!--          <time-line></time-line>-->
          <ul class="legend-box">
            <li>
              <i class="legend" style="background-color: green"></i>
              <span>录像完整</span>
            </li>
            <li>
              <i class="legend" style="background-color: orange"></i>
              <span>部分丢失</span>
            </li>
            <li>
              <i class="legend" style="background-color: red"></i>
              <span>全部丢失</span>
            </li>
            <li>
              <i class="legend" style="background-color: #aaa"></i>
              <span>未知</span>
            </li>
          </ul>
        </el-descriptions-item>
      </el-descriptions>

      <div class="calendar-box">
        <div>
          <el-calendar :value="'2024-01'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">
              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

        <div>
          <el-calendar :value="'2024-02'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">
              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

        <div>
          <el-calendar :value="'2024-03'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">

              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

        <div>
          <el-calendar :value="'2024-04'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">

              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

        <div>
          <el-calendar :value="'2024-05'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">
              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

        <div>
          <el-calendar :value="'2024-06'">
            <template
              slot="dateCell"
              slot-scope="{date, data}">

              <div v-if="data.type === 'current-month'" style=" background-color: red;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
              <div v-else style=" background-color: #ccc;color:#fff;padding: 5px;display: flex;justify-content: center;align-items: center;">
                {{dayjs(date).format('DD')}}
              </div>
            </template>
          </el-calendar>
        </div>

      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="onHide">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>

import TimeLine from "./timeLine.vue";
import ProgressBar from './ProgressBar'
import dayjs from 'dayjs'
export default {
  components: {TimeLine,ProgressBar},
  data() {
    return {
      src:'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
      isShow: false,
      data: {},
      id: null,
      playVideoObj:{},   //选中的正在播放的录像
      timeCells:[],    //录像时间块
      start_timestamp:new Date().getTime() - 5*60*60*1000,    //刻度轴开始时间
    };
  },
  methods: {
    dayjs,
    async show(id) {
      this.id = id;
      //this.data = await this.$api.videoDaysCheck.one(id);
      this.isShow = true;
    },
    onHide() {
      this.isShow = false;
    },
  },
};
</script>

<style lang="scss">
.videoDaysDetail {
  .block {
    display: block;
  }

  .time-line {
    margin-top: 10px;
    margin-left: 80px;
  }

  .list-title {
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #181b1e;
  }

  .list-company {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #2991ff;
    margin-top: 15px;
    margin-bottom: 15px;
  }

  .list-desc {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #596878;
  }

  .el-tag--small {
    margin-bottom: 10px;
  }

  .reTip {
    display: block;
    background: #f00;
    border-radius: 50%;
    width: 4px;
    height: 4px;
    top: -21px;
    right: -26px;
    position: relative;
    z-index: 4;
  }

  //左侧时间
  .time {
    color: rgb(181 215 251);
    position: absolute;
    left: -35px;
    top: -1px;

    .year {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #20354a;
    }

    .day {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #596878;
      text-align: center;
      margin-top: 10px;
    }
  }

  .legend-box{
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    >li{
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      margin-right: 20px;
      i{
        margin-right: 5px;
      }
    }
  }
  .time-line-box{
    width: 100%;
    padding: 0 80px 50px 80px;
  }
  .calendar-box{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    >div{
      width: 30%;
    }
  }
  .el-calendar-table .el-calendar-day{
    padding:5px;
    height: auto;
  }
  .el-calendar__button-group{
    display: none;
  }
  .legend {
    display: block;
    width: 14px;
    height: 10px;
    margin-right: 5px;
  }
}
</style>
