<template>
  <Card title="各阶段地块数">
    <Line :chartData="chartData" height="327px" :option="option" v-if="chartData.length || chartData.length > 0" />
  </Card>
</template>
<script lang="ts" setup>
  import { ref, onMounted } from 'vue';
  import { Card } from 'ant-design-vue';
  import { getIndexCountStage } from '@/api/dashboard/api';
  import Line from '/@/components/chart/Line.vue';
  const chartData = ref([]);
  const option = ref({
    grid: {
      left: '1%',
      right: '1%',
      top: '2%',
      bottom: '35px',
      containLabel: true,
    },
    legend: {
      bottom: 0,
    },
    series: [
      {
        name: '广东省系统数据',
        type: 'line',
        color: ['#FCBE00'],
      },
    ],
  });
  /**
   * 初始化数据
   */
  function init() {
    getIndexCountStage().then((res) => {
      if (res) {
        chartData.value = res;
      }
    });
  }
  onMounted(() => {
    init();
  });
</script>
