<template>
  <div class="leftSideMenu">
    <!-- @open="handleOpen" @close="handleClose" -->
    <el-menu  class="el-menu-vertical-demo" :default-active="props.activeIndex" :collapse-transition="false" :default-openeds="openeds" @select="selectMenu">
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <location />
              </el-icon>
              <span>成绩分析</span>
            </template>

              <el-menu-item index="1-1" >成绩单</el-menu-item>
              <el-menu-item index="1-2">三率一分</el-menu-item>
              <el-menu-item index="1-3">分数段统计</el-menu-item>
              <el-menu-item index="1-4">平均分离差分析</el-menu-item>
              <el-menu-item index="1-5">教师统计</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="2">
            <template #title>
              <el-icon>
                <document />
              </el-icon>
              <span>试卷分析</span>
            </template>
              <el-menu-item index="2-1">总体分析</el-menu-item>
              <el-menu-item index="2-2">客观题分析</el-menu-item>
          </el-sub-menu>

        </el-menu>
  </div>
</template>

<script lang="ts" setup>
import { useRouter } from "vue-router";
const router = useRouter();
import { Document, Location, Setting} from '@element-plus/icons-vue';
import { defineProps,defineEmits } from 'vue';
const props = defineProps(['activeIndex']);
const emit = defineEmits(['parentClick'])


const isCollapse = ref(false)
const openeds = ref(['1-1', '1-2', '1-3', '1-4', '1-5', '2-1', '2-2']);

const selectMenu = (key: string, keyPath: string[]) => {
  console.log(key);
  emit('parentClick', key);
  switch (key) {
    case '1-1'://成绩单
      router.push('cjfx_cjd')
      break;
    case '1-2'://三率一分
      router.push('cjfx_slyf')
      break;
    case '1-3'://分数段统计
      router.push('cjfx_fsdtj')
      break;
    case '1-4'://平均分离差分析
      router.push('cjfx_pjflcfx')
      break;
    case '1-5'://教师统计
      router.push('cjfx_jstj')
      break;
    case '2-1'://总体分析
      router.push('sjfx_ztfx')
      break;
    case '2-1'://客观题分析
      router.push('sjfx_kgtfx')
      break;
  }
}






//开启
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath,"open");
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath,"close")
}


</script>

<style lang="scss" scoped>

</style>
