<template>
  <div class="module-container">
    <module-header title="巡查统计">
      <div class="sub-info">
        当日巡查里程<span class="number">22412</span
        ><span class="unit">km</span>
      </div>
    </module-header>
    <div class="module-body inspection-overview">
      <section-title title="当日巡查情况"></section-title>
      <div class="today-data">
        <div class="count-item">
          <div class="count-type">
            <div class="img-bg">
              <img src="~@/assets/img/bigScreen/basic/route.png" alt="" />
            </div>
            <div class="count-info">
              <div class="count-title">道路巡查</div>
              <div class="count-num">20 <span class="count-unit">次</span></div>
            </div>
          </div>
          <div class="count-type">
            <div class="img-bg">
              <img src="~@/assets/img/bigScreen/basic/video.png" alt="" />
            </div>
            <div class="count-info">
              <div class="count-title">视频巡查</div>
              <div class="count-num">20 <span class="count-unit">次</span></div>
            </div>
          </div>
        </div>
        <div class="err-item">
          <img src="~@/assets/img/bigScreen/basic/err-icon.png" alt="" />
          <div class="err-info">
            <div class="err-info-item">
              <div class="err-info-title">当日异常情况</div>
              <div class="count-num">
                <span class="number">2</span><span class="unit">次</span>
              </div>
            </div>
            <div class="gap-line"></div>
            <div class="err-info-item">
              <div class="err-info-title">已处置</div>
              <div class="count-num">
                <span class="number">2</span><span class="unit">次</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <section-title title="异常情况任务处理列表"> </section-title>
      <div class="err-scroll-wrapper">
        <vue-seamless-scroll
          v-loading="loading"
          :element-loading-background="loadingColor"
          class="scroll-error-wrapper"
          :data="errorList"
          :class-option="scorllOption"
        >
          <div
            class="scroll-errot-item"
            v-for="(item, index) in errorList"
            :key="index"
          >
            <div class="err-item-title">{{ item.place }}</div>
            <div class="err-item-info">
              <div>
                <span class="tag primary">{{ item.type }}</span>
                <span :class="`tag level${item.level}`"
                  >{{ transLevel(item.level) }}级</span
                >
              </div>
              <div class="time">{{ item.time }}</div>
            </div>
          </div>
        </vue-seamless-scroll>
      </div>
    </div>
  </div>
</template>
<script>
import ModuleHeader from '../components/moduleHeader.vue'
import SectionTitle from '../components/sectionTitle.vue'
import VueSeamlessScroll from 'vue-seamless-scroll'
export default {
  name: 'inspectionStatistics',
  components: {ModuleHeader, SectionTitle, VueSeamlessScroll},
  props: {
    // 标题
    title: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      loadingColor: 'rgba(6, 46, 106, 0.3)',
      loading: false,
      scorllOption: {
        step: 0.3,
        limitMoveNum: 1, // 开始无缝滚动的数据量 this.dataList.length
        openWatch: true, // 开启数据实时监控刷新dom
      },
      errorList: [
        {
          id: 1,
          place: 'G75兰海高速渝黔段1075KM+100M至1075KM+100MG',
          time: '2025-02-10 10:00:00',
          type: '自然灾害',
          level: 0,
        },
        {
          id: 2,
          place: 'G75兰海高速渝黔段1075KM+100M至1075KM+100MG',
          time: '2025-02-10 10:00:00',
          type: '自然灾害',
          level: 1,
        },
        {
          id: 3,
          place: 'G75兰海高速渝黔段1075KM+100M至1075KM+100MG',
          time: '2025-02-10 10:00:00',
          type: '自然灾害',
          level: 2,
        },
        {
          id: 4,
          place: 'G75兰海高速渝黔段1075KM+100M至1075KM+100MG',
          time: '2025-02-10 10:00:00',
          type: '自然灾害',
          level: 3,
        },
        {
          id: 5,
          place: 'G75兰海高速渝黔段1075KM+100M至1075KM+100MG',
          time: '2025-02-10 10:00:00',
          type: '自然灾害',
          level: 4,
        },
      ],
    }
  },
  methods: {
    transLevel(val) {
      let text = '无等'
      switch (val) {
        case 1:
          text = '一'
          break
        case 2:
          text = '二'
          break
        case 3:
          text = '三'
          break
        case 4:
          text = '四'
          break
        default:
          break
      }
      return text
    },
  },
}
</script>
<style scoped lang="scss">
.module-container {
  width: 100%;
  height: 100%;
  background: linear-gradient( 270deg, rgba(12,22,51,0.3) 0%, rgba(10,17,26,0.5) 100%);
  padding: 10px 10px 10px 0;
  box-sizing: border-box;
  .module-body{
    height: calc(100% - 34px);
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
  }
  .sub-info{
    font-size: 14px;
    font-family: Microsoft YaHei-Regular, Microsoft YaHei;
    font-weight: 400;
    color: #CCE6FF;
    line-height: 18px;
    margin-bottom: 14px;
    .number{
        font-size: 24px;
        font-family: YouSheBiaoTiHei-Bold, YouSheBiaoTiHei;
        font-weight: bold;
        line-height: 24px;
        color: #019AE6;
        margin: 0 6px 0 10px;
    }
    .unit{
        font-size: 14px;
        font-weight: bold;
        color: #00AAFF;
    }
  }
  .today-data{
    text-align: center;
    
    .count-item{
        display: flex;
        justify-content: space-around;
        margin-top: 10px;
        .count-type{
            display: flex;
            align-items: center;
            .img-bg{
                width: 44px;
                height: 44px;
                margin-right: 10px;
                background: url('~@/assets/img/bigScreen/basic/icon-border.png') no-repeat;
                background-size: 100% 100%;
                display: flex;
                justify-content: center;
                align-items: center;
                img{
                    width: 30px;
                    height: 30px;
                    margin-left:2px;
                }
             }
            .count-info{
                display: flex;
                flex-direction: column;
                justify-content: center;
                .count-title{
                    font-size: 14px;
                    color: #CCE6FF;
                    margin-bottom: 4px;
                 }
                .count-num{
                    font-size: 20px;
                    font-weight: bold;
                    color: #33BBFF;
                 }
                .count-unit{
                    font-size: 12px;
                    color: #CCE6FF;
                 }
             }  
        }    

    }
    .err-item{
        width: 440px;
        height: 96px;
        background: linear-gradient( 180deg, rgba(0,61,115,0.5) 0%, rgba(0,48,114,0.5) 100%);
        border-radius: 10px 10px 10px 10px;
        border: 1px solid rgba(51,153,255,0.2);
        margin: 20px auto;
        display: flex;
        align-items: center;
        justify-content: space-around;
        img{
            width: 64px;
            height: 56px;
            margin-right: 20px;
        }
        .err-info{
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 50px;
            margin-right: 20px;
            .err-info-item{
                font-size: 14px;
                font-weight: bold;
                color: #FFFFFF;
                margin-bottom: 4px;
            }
            .gap-line{
                width: 1px;
                height: 30px;
                background:rgba(51,153,255,0.2);
            }
            .err-info-title{
                font-size: 14px;
                color: #CCE6FF;
                margin-bottom: 10px;
            }
            .count-num{
                font-size: 16px;
                font-weight: bold;
                color: #FFFFFF;
                display: flex;
                align-items: center;
                justify-content: center;
                .number{
                    font-size: 22px;
                    font-weight: bold;
                    color: #FF3E81;
                    margin-right: 4px;
                 }
                .unit{
                    font-size: 12px;
                    color: #FF3E81;
                }
            }

        }
    }
  }
  .err-scroll-wrapper{
    width: 100%;
    flex: 1;
    overflow: hidden;
  }
  .scroll-error-wrapper{
    width: 100%;
    height: 100%;
    overflow: hidden;
    .scroll-errot-item:before{
        position: absolute;
        content: "";
        top: 15%;
        left: 0;
        width: 1px;
        height: 70%;
        background: #00D4FF;
    }
    .scroll-errot-item{
        position: relative;
        margin-bottom: 10px;
        padding: 10px;
        background: linear-gradient( 90deg, rgba(86,106,255,0.15) 0%, rgba(86,106,255,0) 100%);
        .err-item-title{
            font-size: 12px;
            font-weight: 700;
            color: #CFDAE5;
        }
        .err-item-info{
            margin-top: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            
        }
        .time{
            font-size: 12px;
            color: #FFFFFF;
            margin-top: 5px;
         }
         .tag{
            font-size: 12px;
            color: #C7CFE8;
            margin-right: 5px;
            border-radius: 2px;
            padding: 3px 5px;
            display: inline-block;
            margin-bottom: 5px;
        }
        .tag.primary,.tag.level4,.tag.level0{
            background: rgba(86,106,255,0.1);
            border-radius: 2px 2px 2px 2px;
            border: 1px solid rgba(0,212,255,0.3);
            color: #00D4FF;
        }
        .tag.level3{
            background: rgba(255,255,0,0.1);
            border-radius: 2px 2px 2px 2px;
            border: 1px solid rgba(255,255,0,0.3);
            color: #FFFF00;
        }
        .tag.level2{
            background: rgba(255,170,0,0.1);
            border-radius: 2px 2px 2px 2px;
            border: 1px solid rgba(255,170,0,0.3);
            color: #FFAA00;
            
        }
        .tag.level1{
            background: rgba(255, 62, 129, 0.1);
            border-radius: 2px 2px 2px 2px;
            border: 1px solid rgba(255, 62, 129, 0.3);
            color:#FF3E81;
        }
    }
  }
}
</style>