<template>
  <div class="list-item">
    <div class="item-box">
      <div class="item-left">
        <div class="icon-box">
          <IconFontSymbol icon="a-586-zhuanyuan" :fill-color="primaryColor"
        /></div>
      </div>
      <div class="item-role-box1">
        <div class="item-form-name">
          <a-tooltip v-if="item?.name && item.name.length > 8" :title="item.name">
            <div class="item-form-name"> {{ `${item.name.slice(0, 8)}...` }}</div>
          </a-tooltip>
          <div class="item-form-name" v-else> {{ item?.name }}</div>
        </div>
        <div class="item-title">专员名称</div>
      </div>
      <div class="fixed-checked" v-if="hasCheckSlot">
        <slot name="check"></slot>
      </div>
      <div class="fixed-icon">
        <IconFontSymbol icon="jinrongzhuanyuan-copy" fill-color="#f8f8f8" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { computed, useSlots } from 'vue';
  import IconFontSymbol from '/@/components/IconFontSymbol/Index.vue';
  import { primaryColor } from '../../../../../../../build/config/themeConfig';
  defineProps({
    item: Object,
  });
  const hasCheckSlot = computed(() => {
    return !!useSlots().check;
  });
</script>

<style lang="less" scoped>
  @custom-color: @primary-color;
  @bg-color: #ffffff;

  .list-item {
    width: 261px;
    height: 100px;
    background: @bg-color;
    border-color: transparent;
    border-radius: 16px;
    margin-left: 16px;
    margin-bottom: 16px;
    overflow: hidden;

    &:hover {
      border: 1px solid @custom-color;

      :deep(.ant-checkbox-inner) {
        border-color: @custom-color;
      }
    }

    .item-box {
      display: flex;
      align-items: center;
      margin: 14px;
      position: relative;

      .item-left {
        .icon-box {
          width: 53px;
          height: 53px;
          font-size: 32px;
          border: 1px solid @custom-color;
          border-radius: 50%;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }

      .fixed-checked {
        position: absolute;
        bottom: -20px;
        z-index: 1;
        right: -6px;
      }

      .fixed-icon {
        position: absolute;
        right: -34px;
        font-size: 77px;
        transform: rotate(-30deg);
        top: -34px;
      }
    }
  }

  :deep(.ant-checkbox-inner) {
    border-color: #ddd;
  }

  :deep(.ant-checkbox-checked .ant-checkbox-inner) {
    background-color: @custom-color;
    border-color: @custom-color;
  }

  :deep(.ant-checkbox-checked::after),
  :deep(.ant-checkbox-wrapper:hover .ant-checkbox-inner, .ant-checkbox:hover),
  :deep(.ant-checkbox:hover),
  :deep(.ant-checkbox-input:focus + .ant-checkbox-inner) {
    border-color: @custom-color;
  }

  .picked {
    border-width: 1px;
    border-style: solid;
    border-color: @custom-color;

    :deep(.ant-checkbox-inner) {
      border-color: @custom-color;
    }
  }

  .not-picked {
    border-width: 1px;
    border-style: solid;
    border-color: #ddd;
  }

  .item-role-box1 {
    position: absolute;
    z-index: 1;
    left: 70px;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .item-role-box2 {
    position: absolute;
    z-index: 1;
    left: 140px;
    top: 0;
  }

  .item-title {
    font-weight: 500;
    font-size: 14px;
    color: #636e80;
  }

  .item-form-name {
    font-weight: bold;
    font-size: 14px;
    color: #1d2129;
  }
</style>
