<script setup lang="ts">
import { useCollaborationStatisticsHook } from "./utils/hook";

defineOptions({
  name: "CollaborationStatistics"
});

const { chartRef, selectedYear, yearOptions, getStatistics } =
  useCollaborationStatisticsHook();
</script>

<template>
  <div class="main">
    <el-card shadow="never">
      <template #header>
        <div class="card-header">
          <span>月度统计</span>
          <el-select
            v-model="selectedYear"
            class="!w-[140px]"
            @change="getStatistics"
          >
            <el-option
              v-for="year in yearOptions"
              :key="year"
              :label="`${year}年`"
              :value="year"
            />
          </el-select>
        </div>
      </template>
      <div ref="chartRef" class="chart" />
    </el-card>
  </div>
</template>

<style scoped lang="scss">
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart {
  width: 100%;
  height: 600px;
}
</style>
