<template>
  <div class="responsibility-implementation">
    <div class="title">
      <span class="line"></span>
      <span class="text">安全责任落实</span>
    </div>
    <div class="responsibility-implementation__content">
      <div class="content-title">责任书签订情况</div>
      <div class="signing-rate">
        <span>签订率</span>
        <span class="signing-rate-value">
          <span class="signing-rate-value-bar" :style="{ width: `${signingRate}%` }"></span>
        </span>
        <span class="signing-rate-unit">{{ signingRate }}%</span>
      </div>
      <div class="signing-nums">
        <div class="signing-nums__item" v-for="item in signingList" :key="item.name">
          <span class="name">{{ item.name }}</span>
          <span class="num">{{ item.num }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { onMounted, ref } from 'vue';

  interface SigningList {
    name: string;
    num: number;
  }

  const signingRate = ref<number>(0);
  const signingList = ref<SigningList[]>([]);

  onMounted(() => {
    signingRate.value = 10;
    signingList.value = [
      { name: '所/中心', num: 28 },
      { name: '科室', num: 347 },
      { name: '员工', num: 3368 },
      { name: '常驻供应商', num: 19 },
    ];
  });
</script>

<style scoped lang="scss">
  .title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;

    .line {
      width: 3px;
      height: 16px;
      background: #1777ff;
    }

    .text {
      font-weight: 500;
      font-size: 16px;
      color: #000000;
      line-height: 22px;
    }
  }

  .responsibility-implementation__content {
    width: 310px;
    height: 160px;
    margin: 0 10px;
    background: linear-gradient(90deg, #ebf3ff 0%, #fafcff 100%);
    border-radius: 4px;
    padding-top: 14px;

    .content-title {
      margin: 0 12px;
      font-weight: 500;
      font-size: 16px;
      color: #333333;
      line-height: 22px;
    }

    .signing-rate {
      margin: 20px 16px;
      font-weight: 400;
      font-size: 14px;
      color: #333333;
      display: flex;
      align-items: center;
      justify-content: space-between;

      .signing-rate-value {
        width: 192px;
        height: 6px;
        background: #d8d8d8;
        border-radius: 4px;
        position: relative;

        .signing-rate-value-bar {
          width: 0;
          height: 100%;
          background: #1777ff;
          border-radius: 4px;
          position: absolute;
          left: 0;
          top: 0;
        }
      }

      .signing-rate-unit {
        font-weight: 600;
      }
    }

    .signing-nums {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 28px;

      .signing-nums__item {
        display: flex;
        flex-direction: column;

        .name {
          font-weight: 400;
          font-size: 14px;
          color: #666666;
          line-height: 20px;
        }

        .num {
          font-family: DINAlternate;
          font-weight: 600;
          font-size: 22px;
          color: #333333;
          line-height: 26px;
        }
      }
    }
  }
</style>
