<template>
  <el-tabs v-model="activeTab" type="card" class="page-tab">
    <el-tab-pane name="total">
      <template #label>
        <el-button :type="activeTab === 'total' ? 'primary' : 'default'"
          >总量分析</el-button
        >
      </template>
      <TotalAnalysis />
    </el-tab-pane>
    <el-tab-pane name="segment">
      <template #label>
        <el-button :type="activeTab === 'segment' ? 'primary' : 'default'"
          >分段统计</el-button
        >
      </template>
      <SegmentAnalysis />
    </el-tab-pane>
    <el-tab-pane name="college">
      <template #label>
        <el-button :type="activeTab === 'college' ? 'primary' : 'default'"
          >学院分析</el-button
        >
      </template>
      <CollegeAnalysis />
    </el-tab-pane>
    <el-tab-pane name="teacher">
      <template #label>
        <el-button :type="activeTab === 'teacher' ? 'primary' : 'default'"
          >任课老师分析</el-button
        >
      </template>
      <TeacherAnalysis />
    </el-tab-pane>
    <el-tab-pane name="class">
      <template #label>
        <el-button :type="activeTab === 'class' ? 'primary' : 'default'"
          >班级分析</el-button
        >
      </template>
      <ClassAnalysis />
    </el-tab-pane>
    <el-tab-pane name="objective">
      <template #label>
        <el-button :type="activeTab === 'objective' ? 'primary' : 'default'"
          >客观题分析</el-button
        >
      </template>
      <ObjectiveQuestionAnalysis />
    </el-tab-pane>
    <el-tab-pane name="subjective">
      <template #label>
        <el-button :type="activeTab === 'subjective' ? 'primary' : 'default'"
          >主观题分析</el-button
        >
      </template>
      <SubjectiveQuestionAnalysis />
    </el-tab-pane>
    <el-tab-pane name="bigQuestion">
      <template #label>
        <el-button :type="activeTab === 'bigQuestion' ? 'primary' : 'default'"
          >大题分析</el-button
        >
      </template>
      <BigQuestionAnalysis />
    </el-tab-pane>
  </el-tabs>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  import { useRoute } from 'vue-router';

  import TotalAnalysis from './TotalAnalysis.vue';
  import SegmentAnalysis from './SegmentAnalysis.vue';
  import CollegeAnalysis from './CollegeAnalysis.vue';
  import TeacherAnalysis from './TeacherAnalysis.vue';
  import ClassAnalysis from './ClassAnalysis.vue';
  import ObjectiveQuestionAnalysis from './ObjectiveQuestionAnalysis.vue';
  import SubjectiveQuestionAnalysis from './SubjectiveQuestionAnalysis.vue';
  import BigQuestionAnalysis from './BigQuestionAnalysis.vue';

  defineOptions({
    name: 'AnalysisManage',
  });

  const route = useRoute();
  // 从路由参数获取tab值，默认为total
  const activeTab = ref((route.query.tab as string) || 'total');
</script>
