<template>
  <div class="center_bottom">
    <div class="center_bottom-title flex">
      <div class="flex items-center">
        <img src="@/assets/img/home/title_arrow.png" alt="">
        办理中工单概览
      </div>
    </div>
    <div class="center_bottom-content">
      <div class="table-header">
        <div class="table-header-item">超期状态</div>
        <div class="table-header-item">来源</div>
        <div class="table-header-item">标题</div>
        <div class="table-header-item">受理类型</div>
        <div class="table-header-item">热点类型</div>
        <div class="table-header-item">区域</div>
        <div class="table-header-item">接办部门</div>
      </div>
      <div class="scroll" v-loading="loading">
        <vue3-seamless-scroll :list="list" hover :singleHeight="100">
          <div class="item" v-for="(item, index) in list" :key="index">
            <span>
              <span class="exceedSoon" v-if="item.expiredStatus === 1">{{ item.expiredStatusText }}</span>
              <span class="exceed" v-if="item.expiredStatus === 2">{{ item.expiredStatusText }}</span>
              <span class="normal" v-if="item.expiredStatus === 0">{{ item.expiredStatusText }}</span>
            </span>
            <span>{{ item.sourceChannel }}</span>
            <el-tooltip placement="top">
              <template #content> {{ item.title }}</template>
              <span>{{ item.title }}</span>
            </el-tooltip>
            <span :title="item.acceptType">{{ item.acceptType }}</span>
            <span :title="item.hotspotName">{{ item.hotspotName }}</span>
            <span :title="item.county">{{ item.county }}</span>
            <span :title="item.actualHandleOrgName">{{ item.actualHandleOrgName }}</span>
          </div>
        </vue3-seamless-scroll>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import {ref, onMounted, onUnmounted} from "vue";
import {Vue3SeamlessScroll} from "vue3-seamless-scroll";
import {orderView} from "api/home";
import mittBus from "@/utils/mitt";

const list = ref([])
const loading = ref(false);
const getData = async () => {
  loading.value = true;
  try {
    const {result} = await orderView();
    list.value = result;
    loading.value = false;
  } catch (e) {
    console.log(e);
    loading.value = false;
  }
}
onMounted(() => {
  // 接收消息
  mittBus.on('orderHandlingDetail', (res: any) => {
    console.log('办理中工单概览', res)
    list.value = res;
  });
  getData();
})
onUnmounted(() => {
  // 取消接收消息
  mittBus.off('orderHandlingDetail');
})
</script>

<style scoped lang="scss">
.center_bottom {
  padding: 0 30px;

  &-title {
    font-size: 20px;
    color: #fff;
    justify-content: space-between;
    align-items: center;
  }

  &-content {
    margin-top: 10px;

    .table-header {
      display: flex;
      justify-content: space-between;
      background: linear-gradient(to right, rgba(27, 51, 55, .8), rgba(45, 83, 91, .8));

      width: 100%;
      height: 40px;
      line-height: 40px;

      .table-header-item {
        text-align: center;
        color: #B4D7EC;
        flex: 1;
      }
    }

    .scroll {
      height: 200px;
      overflow: hidden;
      margin-top: 10px;

      .item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #225073;
        padding: 6px 0;

        span {
          display: inline-block;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          text-align: center;
          color: #CFD2D2;
          flex: 1;
        }

        .exceedSoon {
          border: 1px solid #ECA455;
          border-radius: 3px;
          color: #ECA455;
          padding: 2px 5px;
        }

        .exceed {
          border: 1px solid #D70024;
          border-radius: 3px;
          color: #D70024;
          padding: 2px 5px;
        }

        .normal {
          border: 1px solid #69BBF6;
          border-radius: 3px;
          color: #69BBF6;
          padding: 2px 5px;
        }
      }
    }

  }
}
</style>