<template>
  <div class="leftSideMenu">
    <!-- @open="handleOpen" @close="handleClose" -->
    <el-menu  class="el-menu-vertical-demo"
    :default-active="props.activeIndex"
    :collapse="false"
    :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 { defineProps,defineEmits } from 'vue';
const props = defineProps(['activeIndex','ykjId']);
const emit = defineEmits(['parentClick'])

console.log(router,props)
const fixedYkjId = ref(props.ykjId);
const openeds = ref(['1-1', '1-2', '1-3', '1-4', '1-5', '2-1', '2-2']);
console.log('fixedYkjId',fixedYkjId)
//点击事件
const selectMenu = (key: string, keyPath: string[]) => {
  emit('parentClick', key);
  switch (key) {
    case '1-1'://成绩单
      router.push(
        { name: 'ksfx-cjfx_cjd-ykj_id', params: { ykj_id: props.ykjId } }
        // 'cjfx_cjd'
      )
      break;
    case '1-2'://三率一分
      router.push(
        { name: 'ksfx-cjfx_slyf-ykj_id', params: { ykj_id: fixedYkjId.value } }
      )
      break;
    case '1-3'://分数段统计
      router.push({ name: 'ksfx-cjfx_fsdtj-ykj_id', params: {ykj_id:props.ykjId} })
      break;
    case '1-4'://平均分离差分析
      router.push({ name: 'ksfx-cjfx_pjflcfx-ykj_id', params: {ykj_id:props.ykjId} })
      break;
    case '1-5'://教师统计
    router.push({ name: 'ksfx-cjfx_jstj-ykj_id', params: {ykj_id:props.ykjId} })
      break;
    case '2-1'://总体分析
    router.push({ name: 'ksfx-sjfx_ztfx-ykj_id', params: {ykj_id:props.ykjId} })
      break;
    case '2-2'://客观题分析
    router.push({ name: 'ksfx-sjfx_kgtfx-ykj_id', params: {ykj_id:props.ykjId} })
      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>
