<template>
    <div class="main_container">
      <component :is="curentComponent"></component>
  </div>
</template>


<script setup lang="ts">
import { useRoute,useRouter } from 'vue-router';
import { computed, onMounted,inject } from 'vue';
import {
    getEvaluationTaskDetailApi,
} from '@/api/evaluationDataComponent'
 
import EvaluationDataComponent from './stepComponent/evaluationDataComponent/EvaluationDataComponent.vue';
import TeachingRelationshipComponent from './stepComponent/teachingRelationshipComponent/TeachingRelationshipComponent.vue';
import QuestionnaireTemplateComponent from './stepComponent/questionnaireTemplateComponent/QuestionnaireTemplateComponent.vue';
import ReviewAccountComponent from './stepComponent/reviewAccountComponent/ReviewAccountComponent.vue';
import GenerateReviewCode from './stepComponent/reviewAccountComponent/GenerateReviewCode.vue';
import ParameterSettingComponent from './stepComponent/parameterSettingComponent/ParameterSettingComponent.vue';
import EvaluationProgressComponent from './stepComponent/evaluationProgressComponent/EvaluationProgressComponent.vue';
import GenerateAnalysisComponent from './stepComponent/generateAnalysisComponent/GenerateAnalysisComponent.vue';

const evaluationManageData = inject('commonStepData');


const route = useRoute()
const router = useRouter()

const curentComponent = computed(()=>{
  switch(route.params.stepRoute){
    case 'evaluationData':
      return EvaluationDataComponent
    case 'teachingRelationship':
      return TeachingRelationshipComponent
    case 'questionnaireTemplate':
      return QuestionnaireTemplateComponent
    case 'reviewAccount':
      return ReviewAccountComponent
    case 'generateReviewCode':
      return GenerateReviewCode
    case 'parameterSetting':
      return ParameterSettingComponent
    case 'evaluationProgress':
      return EvaluationProgressComponent
    case 'generateAnalysis':
      return GenerateAnalysisComponent
      
    case 'numberMapping':
      break
    case 'templateSetting':
      break
    case 'scoreSetting':
      break
    case 'scanQuestionnaire':
      break
    default:
      router.replace('/login')
      break
  }
})

// 查询评价管理 任务详情
const GetEvaluationTaskDetail = async ()=>{
  let res = await getEvaluationTaskDetailApi(route.query.id)
    if(res?.code === 200){
      evaluationManageData.evaluationManageDetailName = res.data.evaluationName
      evaluationManageData.evaluationType = res.data.evaluationType
      evaluationManageData.isHeadTeacherInvolved = Boolean(res.data.classMasterStatus)
      evaluationManageData.isGenerateAccountByGender = Boolean(res.data.genderStatus)
      evaluationManageData.isGenerateReviewCode = Boolean(res.data.evaluationCodeStatus)
      evaluationManageData.isFinishEvaluationData = Boolean(res.data.evaluationDataStatus)
      evaluationManageData.isFinishTeachingRelationship = Boolean(res.data.teachingRelationStatus)
      evaluationManageData.isFinishQuestionnaireTemplate = Boolean(res.data.assessmentTemplateStatus)
      evaluationManageData.isFinishReviewAccount = Boolean(res.data.evaluationAccountStatus)
      evaluationManageData.isFinishParameterSetting = Boolean(res.data.paramSetupStatus)
      evaluationManageData.isFinishEvaluationProgress = Boolean(res.data.evaluationProgressStatus)
      evaluationManageData.isFinsihGenerateAnalysis = Boolean(res.data.analysisStatus)
    }
}

onMounted( async ()=>{
  await GetEvaluationTaskDetail()
})
</script>



<style lang="scss" scoped>
.main_container {
  height: 100vh !important;
}

</style>