<script setup>
import StatisticsPanel from "@/views/components/StatisticsPanel.vue";
import { ref } from "vue";
import { getLaboratoryStatistic } from "@/api/admin/laboratory/home";

const statisticsList = ref([
  {
    label: "专利数量",
    value: 0,
    unit: "项",
  },
  {
    label: "成果数量",
    value: 0,
    unit: "个",
  },
  {
    label: "需求数量",
    value: 0,
    unit: "个",
  },
  {
    label: "论文数量",
    value: 0,
    unit: "篇",
  },
]);

const loadLabStatisticsData = () => {
  getLaboratoryStatistic().then((resp) => {
    const { data } = resp;
    statisticsList.value = [
      {
        label: "专利数量",
        value: data?.patentCount ?? 0,
        unit: "项",
      },
      {
        label: "成果数量",
        value: data?.achievementCount ?? 0,
        unit: "个",
      },
      {
        label: "需求数量",
        value: data?.demandCount ?? 0,
        unit: "个",
      },
      {
        label: "论文数量",
        value: data?.paperCount ?? 0,
        unit: "篇",
      },
    ];
  });
};

loadLabStatisticsData();
</script>

<template>
  <div class="app-container">
    <statistics-panel :list="statisticsList" />
  </div>
</template>

<style lang="scss" scoped></style>
