<template>
  <div
    class="right_bottom_wrap beautify-scroll-def"
    :class="{ 'overflow-y-auto': !indexConfig.rightBottomSwiper }"
  >
    <component
      :is="comName"
      :list="state.list"
      v-model="state.scroll"
      :singleHeight="state.defaultOption.singleHeight"
      :step="state.defaultOption.step"
      :limitScrollNum="state.defaultOption.limitScrollNum"
      :hover="state.defaultOption.hover"
      :singleWaitTime="state.defaultOption.singleWaitTime"
      :wheel="state.defaultOption.wheel"
    >
      <ul class="right_bottom" v-if="state.list.length">
        <li class="right_center_item" v-for="(item, i) in state.list" :key="i">
          <span class="orderNum">{{ i + 1 }}</span>
          <div class="inner_right">
            <div class="dibu"></div>
            <div class="flex">
              <div class="info  flex-1">
                <span class="labels">工单标题：</span>
                <span class="text-content zhuyao  text-no-wrap"> {{ item.title }}</span>
              </div>
              <div class="info">
                <span class="labels">手里类型：</span>
                <span class="text-content warning  text-no-wrap">
                  {{ item.acceptType }}</span
                >
              </div>
            </div>

            <div class="flex">
              <div class="flex">
                <div class="info">
                  <span class="labels">工单编号：</span>
                  <span
                      class="text-content ciyao"
                      :class="{ warning: item.alertdetail }"
                  >
                  {{item.no}}</span
                  >
                </div>
              </div>
              <div class="info time shrink-0">
                <span class="labels">时间：</span>
                <span class="text-content" style="font-size: 12px">
                  {{ formatDate(item.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span
                >
              </div>
            </div>
            <div class="info">
              <span class="labels shrink-0"> 地址：</span>
              <span
                  class="ciyao truncate"
                  style="font-size: 12px; width: 220px"
                  :title="item.address"
              >
                  {{ item.address }}</span
              >
            </div>
          </div>
        </li>
      </ul>
    </component>
    <EmptyCom></EmptyCom>
  </div>
</template>
<script setup lang="ts">
import SeamlessScroll from "@/components/seamless-scroll";
import {computed, onMounted, onUnmounted, reactive} from "vue";
import { useSettingStore } from "@/stores/setting";
import { storeToRefs } from "pinia";
import EmptyCom from "@/components/empty-com";
import {formatDate} from "@/utils/formatTime";
import mittBus from "@/utils/mitt";
const settingStore = useSettingStore();
const { defaultOption, indexConfig } = storeToRefs(settingStore);
const state = reactive<any>({
  list: [],
  defaultOption: {
    ...defaultOption.value,
    singleHeight: 252,
    limitScrollNum: 3,
    // step:3
  },
  scroll: true,
});


const comName = computed(() => {
  if (indexConfig.value.rightBottomSwiper) {
    return SeamlessScroll;
  } else {
    return EmptyCom;
  }
});
onMounted(() => {
  // 接收消息
  mittBus.on('BsDataShowArea8', (res: any) => {
    state.list = res;
  });
});
onUnmounted(()=>{
  // 取消接收消息
  mittBus.off('BsDataShowArea8');
})
</script>

<style scoped lang="scss">
.right_bottom {
  width: 100%;
  height: 100%;

  .right_center_item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    padding: 10px;
    font-size: 14px;
    color: #fff;

    .orderNum {
      margin: 0 20px 0 -20px;
    }

    .inner_right {
      position: relative;
      height: 100%;
      width: 400px;
      flex-shrink: 0;
      line-height: 1.5;

      .dibu {
        position: absolute;
        height: 2px;
        width: 104%;
        background-image: url("@/assets/img/zuo_xuxian.png");
        bottom: -12px;
        left: -2%;
        background-size: cover;
      }
    }

    .info {
      margin-right: 10px;
      display: flex;
      align-items: center;

      .labels {
        flex-shrink: 0;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
      }

      .zhuyao {
        color: var(--el-color-primary);
        font-size: 15px;
      }

      .ciyao {
        color: rgba(255, 255, 255, 0.8);
      }

      .warning {
        color: #e6a23c;
        font-size: 15px;
      }
    }
  }
}

.right_bottom_wrap {
  overflow: hidden;
  width: 100%;
  height: 252px;
}

.overflow-y-auto {
  overflow-y: auto;
}
</style>
