<template>
  <div class="module-container">
    <module-header title="任务统计"></module-header>
    <div class="module-body task-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/event.png" alt="" />
            </div>
            <div class="count-info">
              <div class="count-title">突发事件</div>
              <div class="count-num warning">
                20 <span class="count-unit">次</span>
              </div>
            </div>
          </div>
          <div class="count-type">
            <div class="img-bg">
              <img src="~@/assets/img/bigScreen/basic/sos.png" alt="" />
            </div>
            <div class="count-info">
              <div class="count-title">救援任务</div>
              <div class="count-num danger">
                20 <span class="count-unit">次</span>
              </div>
            </div>
          </div>
        </div>
        <div class="event-item">
          <div class="event-info-item event-info-item01">
            <div class="count-num">2</div>
            <div class="count-type">完成</div>
          </div>
          <div class="event-info-item event-info-item02">
            <div class="count-num">0</div>
            <div class="count-type">返空</div>
          </div>
          <div class="event-info-item event-info-item03">
            <div class="count-num">2</div>
            <div class="count-type">中止</div>
          </div>
        </div>
      </div>
      <div class="title-wrapper">
        <section-title
          class="title-mian"
          :title="`实时事件列表  (${count})`"
        ></section-title>
        <div class="event-add">
          <img :src="require('@/assets/img/bigScreen/basic/addEvent.png')" />
          添加事件
        </div>
      </div>
      <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'
import {dictionaryEscape, getDictionaryByCode} from '@/utils/dictionary'
export default {
  name: 'taskStatistics',
  components: {ModuleHeader, SectionTitle, VueSeamlessScroll},
  props: {
    // 标题
    title: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      count: 5,
      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: 4,
        },
        {
          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: 2,
        },
      ],
    }
  },
  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(10,17,26,0.5) 0%, rgba(12,22,51,0.3) 100%);
  padding: 0 0 10px 10px;
  box-sizing: border-box;
  .module-body{
    height: calc(100% - 34px);
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
  }

  .title-wrapper{
    display: flex;  
    justify-content: space-between;
    align-items: center;
    .title-mian{
        flex: 1;
    }
  }
  .event-add{
    width: 80px;
    gap:4px;
    color: #CCE6FF;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 14px;
  }
  .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;
                    
                 }
                 .count-num.warning{
                    color: #FFA565;
                 }
                 .count-num.danger{
                    color: #FF3E81;
                 }
                .count-unit{
                    font-size: 12px;
                    color: #CCE6FF;
                 }
             }  
        }    

    }
    .event-item{
        width: 480px;
        margin: 20px auto;
        display: flex;
        align-items: center;
        justify-content: space-around;

        .event-info-item{
            width: 80px;
            height: 50px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
        }
        .event-info-item.event-info-item01{
            background: url('~@/assets/img/bigScreen/basic/event-icon01.png') no-repeat;
            background-size: 100% 100%;
        }
        .event-info-item.event-info-item02{
            background: url('~@/assets/img/bigScreen/basic/event-icon02.png') no-repeat;
            background-size: 100% 100%;
        }
        .event-info-item.event-info-item03{
            background: url('~@/assets/img/bigScreen/basic/event-icon03.png') no-repeat;
            background-size: 100% 100%;
        }
        .count-num{
            font-size: 22px;
            font-weight: bold;
            color: #FFFFFF;
            text-align: center;
            
        }
        .count-type{
            text-align: center;
            margin-bottom: -16px;
            font-size: 12px;
            color: #FFFFFF;
        }
    }
  }
  .err-scroll-wrapper{
    width: 100%;
    height: 80%;
    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>