Преглед на файлове

修改整卷填写的默认数据渲染

lm преди 1 седмица
родител
ревизия
70df2f4dba
променени са 2 файла, в които са добавени 22 реда и са изтрити 17 реда
  1. 22 16
      src/views/questionnaireCommit/QuestionnaireCommit.vue
  2. 0 1
      src/views/selfQuestionnaireProcess/SelfQuestionnaireProcess.vue

+ 22 - 16
src/views/questionnaireCommit/QuestionnaireCommit.vue

@@ -45,7 +45,7 @@
 
                 <ul class="teacher_list">
                     <li v-for="(teacher,index) in teacherList" :key="teacher.id" 
-                        :class="['teacher_card',{active:currentActiveTeacherIndex === index},
+                        :class="['teacher_card',{active:currentActiveTeacherId === teacher.teacherId,},
                                 {disabled:IsSubjectQuestionnaireUnFinish(teacher.evaluationStatus)}]" 
                         @click="IsSubjectQuestionnaireUnFinish(teacher.evaluationStatus) ? '' : HandleSubjectTeacherChange(index,teacher)">
                         <div class="teacher_tag" :style="{backgroundColor:subjectToColor(teacher.evaluationSubjectName)?.color}">
@@ -207,6 +207,7 @@ import { useTimeCountDown } from '@/utils/dateTransform';
 import {getExcelColumn} from '@/utils/numberConvertExcelColumn'
 
 import { getEvaluationQuestionDataApi, getEvaluationQuestionDataSplitApi } from '@/api/questionnaireCommit'
+import {getEvaluationProcessMsgApi} from '@/api/selfQuestionnaireProcess'
 
 import redTimeIcon from '@/assets/icon/red_time_icon.svg'
 import finishIcon from '@/assets/studentQuestionnaire/select_icon.png'
@@ -220,6 +221,8 @@ interface TeacherItm {
     subjectType: number      // 科目类型 0-班主任  1 科目(单科)
     teacherName: string      //教师名称
     evaluationSubjectName:string  //科目名称
+    teacherId:string | string  //教师id
+
 }
 
 
@@ -280,7 +283,9 @@ const teacherQuestionnaireData = ref([])
 const currentSelectedQuestionnaireData = computed(()=>{
     // 整卷填写
     if(defaultQuestionnaireMode.value == 'full'){
-        return teacherQuestionnaireData.value?.[currentActiveTeacherIndex.value]
+        return teacherQuestionnaireData.value.find((item:any)=>{
+            return item.teacherId == currentActiveTeacherId.value
+        })
     // 按题填写
     }else if(defaultQuestionnaireMode.value == 'split'){
         return questionnaireSplitData.value?.[currentSelectedQuestionIndex.value]
@@ -401,6 +406,8 @@ const GetFullQuestionnaireData = async ()=>{
     if(res?.code == 200){
         teacherQuestionnaireData.value = res?.data
     }
+    // 同时 要初始化第一个展示的教师问卷 __展示第一个 或者展示 最后一个提交的问卷
+    currentActiveTeacherId.value = teacherList.value?.[0]?.teacherId || ''
 }
 
 // 获取按题填写问卷数据
@@ -420,15 +427,15 @@ const GetSplitQuestionnaireData = async ()=>{
  */
 // 问卷试题 dom
 const questionListRef = ref()
-// 当前选中的待评价科目教师
-const currentActiveTeacherIndex = ref(0) 
+// 当前选中的待评价科目教师 
+const currentActiveTeacherId = ref('') 
 
 // 整卷填写 教师问卷的答案
 const fullQuestionnaireAnswer = ref({})
 
 // 切换 评价的科目教师
 const HandleSubjectTeacherChange = (index,teacher)=>{
-    currentActiveTeacherIndex.value = index
+    currentActiveTeacherId.value = teacher.teacherId
 
     currentSelectedQuestionIndex.value = 0
 }
@@ -582,10 +589,6 @@ const HandleFinishCurrentQuestion = ()=>{
     isQuestionEdit.value = false
 }
 
-/**
- *  5. 整体
- */
-
 // 
 // 处理页面的倒计时
 const HandleTimeDeadline = ()=>{
@@ -594,14 +597,17 @@ const HandleTimeDeadline = ()=>{
     StartCounDown(deadlineTime.value,1000)
 }
 
-onMounted( async ()=>{
-    // 从父级获取 待评价教师的数据列表
-    let localTeacherList = sessionStorage.getItem('teacherList')
-    if(localTeacherList){
-        teacherList.value = JSON.parse(localTeacherList || '[]')
-        await GetFullQuestionnaireData()
+// 获取评价教师列表
+const GetEvaluationProcessMsg = async ()=>{
+    let res = await getEvaluationProcessMsgApi()
+    if(res?.code == 200){
+        teacherList.value = res.data.dataList
     }
-    // HandleTimeDeadline()
+}
+
+onMounted( async ()=>{
+    await GetEvaluationProcessMsg()
+    await GetFullQuestionnaireData()
 })
 
 </script>

+ 0 - 1
src/views/selfQuestionnaireProcess/SelfQuestionnaireProcess.vue

@@ -111,7 +111,6 @@ const HandleElectiveSubjectConfirm = async ()=>{
 
 // 跳转到填写问卷页
 const GoToFillOutQuestionnaire = ()=>{
-    sessionStorage.setItem('teacherList',JSON.stringify(teacherList.value)) 
     router.push('/main/questionnaireCommit')
 }