<template>
  <a-steps direction="vertical" :current="size">
    <template v-for="(item, index) in dataSource" :key="index">
      <a-step>
        <template #icon>
          <ns-icon size="20" :name="item.src" />
        </template>
        <template #description>
          <div class="card">
            <div class="card-title">
              <a-tag class="card-title-tag" :color="item.color">{{ item.stateName }}</a-tag>
              <div class="name">{{ item.realName }}</div>
              <div class="time">{{ item.createTime }}</div>
            </div>
            <div style="width: 100%; color: #3a3a3a; height: 25px; overflow: auto">
              {{ item.remarks }}</div
            >
          </div>
        </template>
      </a-step>
    </template>
  </a-steps>
</template>

<script lang="ts" setup>
  import { toRefs } from 'vue';

  type Props = {
    dataSource: any;
    size: any;
  };
  const props = withDefaults(defineProps<Props>(), {});
  const { dataSource } = toRefs(props);
  const { size } = toRefs(props);

  defineExpose({});
</script>
<style lang="less" scoped>
  .ant-steps-vertical {
    margin-left: 20px;
    margin-top: 10px;
  }
  .card {
    width: 400px;
    min-height: 0px;
    background-color: #f8fafc;
    margin-left: 20px;
    border-radius: 4px; /* 设置圆角半径 */
    padding: 12px;
    .card-title {
      width: 100%;
      height: 30px;
      display: flex;
      position: relative;
      .card-title-tag {
        width: 60px;
        height: 20px;
        text-align: center;
      }
    }
  }
  .name {
    position: absolute;
    left: 35%;
    top: -2px;
    transform: translateX(-50%);
    color: #3a3a3a;
  }
  .time {
    position: absolute;
    right: 10px;
    top: -2px;
    color: #ff7602;
  }
  :deep(.ant-steps-item-tail) {
    position: absolute !important;
    top: -10px !important;
    left: 16px !important;
    width: 1px !important;
    height: 150% !important;
  }
  :deep(.ant-steps-item) {
    margin-top: 20px !important;
  }
</style>
