<template>
  <div class="content-box">
    <div class="dust-scroll-content">
      <a-carousel dot-position="left" dotsClass="dots-class" :dots="true" :autoplay="true">
        <template v-for="(data, selectIndex) in selectData" :key="selectIndex">
          <div class="monitor-item">
            <div class="title-box">{{ data['devicePos'] }}</div>
            <div class="monitor-content-top">
              <div v-for="(dustItem, index) in topConfig" :key="index" class="top-item-box" :class="`top-item-box-${index + 1}`">
                <div class="item-top-title">{{ dustItem.title }}</div>
                <div class="item-top-value">{{ data[dustItem.code] }}</div>
              </div>
            </div>
            <div class="monitor-content-bottom">
              <div v-for="(dustItem, index) in btnConfig" :key="index" class="bottom-item-box" :class="`bottom-item-box-${index + 1}`">
                <div class="item-bottom-title">{{ dustItem.title }}</div>
                <div class="item-bottom-value">{{ data[dustItem.code] }}</div>
              </div>
            </div>
          </div>
        </template>
      </a-carousel>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref, defineProps, watch } from 'vue';
  import { dustMonitorColumnTop, dustMonitorColumnBootom } from '../../../clique/dust.data';

  let props = defineProps({
    compositeData: {
      type: Array,
      default: () => {
        return [];
      },
    },
    topconfig: {
      type: Array,
      default: () => {
        return [];
      },
    },
    btnconfig: {
      type: Array,
      default: () => {
        return [];
      },
    },
  });
  const selectData = ref<any>([]);
  const topConfig: any = props.topconfig.length ? props.topconfig : dustMonitorColumnTop;
  const btnConfig: any = props.btnconfig.length ? props.btnconfig : dustMonitorColumnBootom;
  watch(
    () => props.compositeData,
    (newS) => {
      selectData.value = newS;
    },
    {
      immediate: true,
      deep: true,
    }
  );
</script>

<style lang="less" scoped>
  @font-face {
    font-family: 'douyuFont';
    src: url('/@/assets/font/douyuFont.otf');
  }

  .content-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;

    .dust-scroll-content {
      width: 400px;
      height: 420px;
      overflow-y: auto;
      overflow-x: hidden;
      .monitor-item {
        margin-bottom: 15px;
        .title-box {
          color: #fff;
          width: 100%;
          height: 40px;
          margin-left: 5px;
          margin-top: 00px;
          margin-bottom: 5px;
          padding-left: 40px;
          padding-top: 6px;
          background: url('/@/assets//images//company//lentj.png') no-repeat;
          background-size: 199px 100%;
          font-size: 15px;
          font-weight: 600;
        }
        .monitor-content-top {
          width: 100%;
          display: flex;
          flex-direction: row;
          flex-wrap: wrap;
          color: #fff;
          .top-item-box {
            width: 193px;
            height: 64px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 28px;
          }
          .top-item-box-1 {
            background: url('/@/assets//images//company//dust//tip-bg-1.png');
          }
          .top-item-box-2 {
            background: url('/@/assets//images//company//dust//tip-bg-2.png');
          }
          .top-item-box-3 {
            background: url('/@/assets//images//company//dust//tip-bg-3.png');
          }
          .top-item-box-4 {
            background: url('/@/assets//images//company//dust//tip-bg-4.png');
          }
        }
        .monitor-content-bottom {
          padding: 0 20px;
          color: #fff;
          .bottom-item-box {
            width: 358px;
            height: 43px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 14px;
            position: relative;
            .item-bottom-title {
              margin-left: 65px;
            }
            .item-bottom-value {
              margin-right: 20px;
            }
          }
          .bottom-item-box-1 {
            background: url('/@/assets//images//company//dust//tip-bg1-1.png');
            &::after {
              content: '';
              width: 25px;
              height: 25px;
              position: absolute;
              left: 13px;
              top: 7px;
              background: url('/@/assets//images//company//dust//dustCon-icon.png');
            }
          }
          .bottom-item-box-2 {
            background: url('/@/assets//images//company//dust//tip-bg1-2.png');
            &::after {
              content: '';
              width: 25px;
              height: 25px;
              position: absolute;
              left: 12px;
              top: 6px;
              background: url('/@/assets//images//company//dust//respirableDustCon-icon.png');
            }
          }
          .bottom-item-box-3 {
            background: url('/@/assets//images//company//dust//tip-bg1-1.png');
            &::after {
              content: '';
              width: 28px;
              height: 22px;
              position: absolute;
              left: 10px;
              top: 7px;
              background: url('/@/assets//images//company//dust//SiO2Content-icon.png');
            }
          }
          .bottom-item-box-4 {
            background: url('/@/assets//images//company//dust//tip-bg1-2.png');
            &::after {
              content: '';
              width: 26px;
              height: 20px;
              position: absolute;
              left: 11px;
              top: 8px;
              background: url('/@/assets//images//company//dust//respirableDustRatio-icon.png');
            }
          }
        }
      }
    }
  }
  .dots-class {
    width: 8px;
  }
  ::v-deep .slick-dots-left {
    left: 0 !important;
  }
  ::v-deep .zxm-select-single:not(.zxm-select-customize-input) .zxm-select-selector {
    height: 24px;
  }

  ::v-deep .zxm-select-single:not(.zxm-select-customize-input) .zxm-select-selector .zxm-select-selection-search-input {
    height: 24px;
  }

  ::v-deep .zxm-select-selection-placeholder {
    color: #fff !important;
    line-height: 22px !important;
  }

  ::v-deep .zxm-select-single:not(.zxm-select-customize-input) .zxm-select-selector::after {
    line-height: 24px;
  }

  ::v-deep .zxm-select:not(.zxm-select-customize-input) .zxm-select-selector {
    background-color: transparent;
    border-top: 0px;
    border-bottom: 0px;
    border-left: 2px solid;
    border-right: 2px solid;
    border-image: linear-gradient(to bottom, transparent, rgba(49, 184, 255, 1), transparent) 1 1 1;
  }

  ::v-deep .zxm-select-arrow {
    color: #fff !important;
  }

  ::v-deep .zxm-select-selection-item {
    color: #fff !important;
  }

  ::v-deep .zxm-select-single .zxm-select-selector .zxm-select-selection-item {
    line-height: 24px !important;
  }
</style>
