Bladeren bron

添加H5端问卷保存的接口调用

lm 1 week geleden
bovenliggende
commit
0709a6ee50

+ 58 - 6
src/components/AppQuestionnaireQuestionList.vue

@@ -16,9 +16,10 @@
                     :isHorizontal="item.extraConfig.includes('isHorizontal')"
                     :questionType="Number(item.questionType)"
                     :questionSubOptions="item.options"
-                    :evaluationType="Number(item.evaluationType)"
+                    :evaluationType="Number(item.questionAnswerClass)"
                     :questionScore="Number(item.questionScore)"
-                    @formChange="(val)=>HandleFormChange(val,item.id)"
+                    @formChange="(val)=>HandleFormChange(val,item)"
+                    :defaultQuestionVal="item.answer"
                 ></QuestionTypeShow>
             </div>
         </li>
@@ -44,11 +45,11 @@ interface QuestionMsg {
     options:QuestionOpt[],   //单选、多选的选项配置
     answer:string | [] | undefined | null,     //问题答案
     questionTitleName:string,   //问题名称
-    questionType:number,    //问题类型
+    questionType:number,    //问题类型 单选 0   评分单选 3  多选 1  评分题 5  问答题  2
     questionAnswerType:number,    // 是否必答,0-否,1-是
     questionSortRole:number,   // 0-竖排,1-横排
     questionScore:string,  //问题满分
-    evaluationType:string,  // 评分题 的 分值展示形式  0数字式 1星星式
+    questionAnswerClass?:string,  // 评分题 的 分值展示形式  0数字式 1星星式
     answerData?:[],    //同options
 }
 
@@ -68,8 +69,59 @@ const emit = defineEmits(['formListAnswerChange'])
 const questionListRef = defineModel('questionListRef')
 
 const formQuestionAnswerList = ref<Record<string, any>>({})
-const HandleFormChange = (val:any,keyId:string)=>{
-    formQuestionAnswerList.value[keyId] = val
+const HandleFormChange = (val:any,questionItm:QuestionMsg)=>{
+    const {questionType,id:keyId,questionScore, } = questionItm
+    // 最终返回的表单项的数据结构
+    switch(Number(questionType)){
+        case 0:   //单选
+            formQuestionAnswerList.value[keyId] = {
+                questionId: keyId,
+                answerCode: val,
+                studentAnswer: "",
+                studentQuestionScore: '',
+                studentAnswerScore: ''
+            }
+            break;
+        case 1:   //多选
+            formQuestionAnswerList.value[keyId] = {
+                questionId: keyId,
+                answerCode: val.join('|'),
+                studentAnswer: "",
+                studentQuestionScore: '',
+                studentAnswerScore: ''
+            }
+            break;
+        case 2:   //问答
+            formQuestionAnswerList.value[keyId] = {
+                questionId: keyId,
+                answerCode: '',
+                studentAnswer: val,
+                studentQuestionScore: '',
+                studentAnswerScore: ''
+            }
+            break;
+        case 3:   //评分单选
+            formQuestionAnswerList.value[keyId] = {
+                questionId: keyId,
+                answerCode: val,
+                studentAnswer: '',
+                studentQuestionScore: '',
+                studentAnswerScore: '',
+                answerScore:questionItm.options.find(opt=>{
+                    return opt.questionSortCode == val
+                })?.score,
+            }
+            break;
+        case 5:   //评分题
+            formQuestionAnswerList.value[keyId] = {
+                questionId: keyId,
+                answerCode: '',
+                studentAnswer: '',
+                studentQuestionScore: questionScore,
+                studentAnswerScore: val
+            }
+            break;
+    }
     emit('formListAnswerChange',formQuestionAnswerList.value)
 }
 </script>

+ 155 - 392
src/views/appView/QuestionnaireCommit.vue

@@ -10,7 +10,6 @@
         <AppQuestionnaireQuestionList 
             :allowEdit="!isCurrentQuestionnaireTaskFinish"
             :questionaireData="questionaireMsg.questionData" 
-            v-model:questionListRef="questionListRef" 
             @formListAnswerChange="HandleQuestionnaireFormChange"
         />
         <div class="operation">
@@ -22,8 +21,26 @@
 
 
 <script setup lang="ts">
-import { ref, computed,watch } from 'vue';
+import { ref, computed, onMounted } from 'vue';
+import { ElMessage } from 'element-plus';
+
 import AppQuestionnaireQuestionList from '@/components/AppQuestionnaireQuestionList.vue';
+
+import {getEvaluationProcessMsgApi} from '@/api/selfQuestionnaireProcess'
+
+import { getEvaluationQuestionDataApi, saveEvaluationQuestionDataApi } from '@/api/questionnaireCommit'
+
+
+interface TeacherItm {
+    id: string|number
+    evaluationClassName: string     //班级
+    evaluationStatus: number   //评价状态  0-待评价  1-进行中  2-已评价
+    subjectType: number      // 科目类型 0-班主任  1 科目(单科)
+    teacherName: string      //教师名称
+    evaluationSubjectName:string  //科目名称
+}
+
+
 /**
  * 2. 问卷整体数据
  */
@@ -31,384 +48,85 @@ import AppQuestionnaireQuestionList from '@/components/AppQuestionnaireQuestionL
 //  当前问卷任务是否全部完成 ———— 以及问卷是否结束
 const isCurrentQuestionnaireTaskFinish = ref(false) //true  false
 
+/**
+ * 3. 整卷填写相关变量 和操作
+ */
 
-//  模拟所有教师的问卷数据(目前只有两个)
-const mockTeacherQuestionnaireData = ref([
-    {
-        "id": "661146080469061632",
-        "createdAt": "2026-07-15 09:58",
-        "schoolId": "10007",
-        "teacherId": "510448965049651259",
-        "teacherName": "李敏",
-        "assessmentTitle": "大学生消费情况调查问卷-复制",
-        "assessmentIllustrate": "您好!这次问卷只是针对中小学现状的调查,为心理教育提供依据。本调查问卷无记名,完全保密,请同学们必须如实填写,以利于调查问卷的有效性!谢谢合作!",
-        "assessmentScore": "15.00",
-        "assessmentSortCode": 104,
-        "useStatus": 0,
-        "questionCount": null,
-        "fullScore": null,
-        "questionData": [
-            {
-                "id": "663805618586464256",
-                "createdAt": "2026-07-22 18:06:32",
-                "updatedAt": "2026-07-22 18:06:32",
-                "schoolId": "10007",
-                "assessmentId": "661146080469061632",
-                "questionClass": 0,
-                "questionTitleName": "您的性别*",
-                "questionType": 0,
-                "questionAnswerType": 1,
-                "questionSortRole": 0,
-                "questionSortCode": 1,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [
-                    {
-                        "id": "663805618636795904",
-                        "createdAt": "2026-07-22 18:06:32",
-                        "updatedAt": "2026-07-22 18:06:32",
-                        "schoolId": "10007",
-                        "assessmentId": "661146080469061632",
-                        "questionId": "663805618586464256",
-                        "questionClass": null,
-                        "questionSortCode": 1,
-                        "answerName": "男",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "663805618645184512",
-                        "createdAt": "2026-07-22 18:06:32",
-                        "updatedAt": "2026-07-22 18:06:32",
-                        "schoolId": "10007",
-                        "assessmentId": "661146080469061632",
-                        "questionId": "663805618586464256",
-                        "questionClass": null,
-                        "questionSortCode": 2,
-                        "answerName": "女",
-                        "answerScore": null
-                    }
-                ],
-                status:'done',
-            },
-            {
-                "id": "663805618678738944",
-                "createdAt": "2026-07-22 18:06:32",
-                "updatedAt": "2026-07-22 18:06:32",
-                "schoolId": "10007",
-                "assessmentId": "661146080469061632",
-                "questionClass": 0,
-                "questionTitleName": "每月消消消消消消消消消消消消消消消消消消消消消费多******用于哪些方面*",
-                "questionType": 1,
-                "questionAnswerType": 1,
-                "questionSortRole": 1,
-                "questionSortCode": 2,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [
-                    {
-                        "id": "663805618703904768",
-                        "createdAt": "2026-07-22 18:06:32",
-                        "updatedAt": "2026-07-22 18:06:32",
-                        "schoolId": "10007",
-                        "assessmentId": "661146080469061632",
-                        "questionId": "663805618678738944",
-                        "questionClass": null,
-                        "questionSortCode": 1,
-                        "answerName": "伙食",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "663805618708099072",
-                        "createdAt": "2026-07-22 18:06:32",
-                        "updatedAt": "2026-07-22 18:06:32",
-                        "schoolId": "10007",
-                        "assessmentId": "661146080469061632",
-                        "questionId": "663805618678738944",
-                        "questionClass": null,
-                        "questionSortCode": 2,
-                        "answerName": "购置衣物",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "663805618708099073",
-                        "createdAt": "2026-07-22 18:06:32",
-                        "updatedAt": "2026-07-22 18:06:32",
-                        "schoolId": "10007",
-                        "assessmentId": "661146080469061632",
-                        "questionId": "663805618678738944",
-                        "questionClass": null,
-                        "questionSortCode": 3,
-                        "answerName": "日常交际",
-                        "answerScore": null
-                    }
-                ],
-                status:'done',
-            },
-            {
-                "id": "663805618745847808",
-                "createdAt": "2026-07-22 18:06:32",
-                "updatedAt": "2026-07-22 18:06:32",
-                "schoolId": "10007",
-                "assessmentId": "661146080469061632",
-                "questionClass": 0,
-                "questionTitleName": "你希望老师在哪里改进*",
-                "questionType": 2,
-                "questionAnswerType": 1,
-                "questionSortRole": 0,
-                "questionSortCode": 3,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [],
-                status:'pending',
-            },
-            {
-                "id": "663805618766819328",
-                "createdAt": "2026-07-22 18:06:32",
-                "updatedAt": "2026-07-22 18:06:32",
-                "schoolId": "10007",
-                "assessmentId": "661146080469061632",
-                "questionClass": 1,
-                "questionTitleName": "你对本次问卷调查的感受",
-                "questionType": 5,
-                "questionAnswerType": 1,
-                "questionSortRole": 0,
-                "questionSortCode": 4,
-                "questionScore": "10.00",
-                "evaluationType": 0,
-                "answerData": [],
-                status:'unfinish',
-            },
-            {
-                "id": "663805618787790848",
-                "createdAt": "2026-07-22 18:06:32",
-                "updatedAt": "2026-07-22 18:06:32",
-                "schoolId": "10007",
-                "assessmentId": "661146080469061632",
-                "questionClass": 1,
-                "questionTitleName": "你对本次问卷调查的感受",
-                "questionType": 5,
-                "questionAnswerType": 1,
-                "questionSortRole": 0,
-                "questionSortCode": 5,
-                "questionScore": "15.00",
-                "evaluationType": 1,
-                "answerData": [],
-                status:'unfinish',
-            }
-        ]
-    },
-    {
-        "id": "661148998005952512",
-        "createdAt": "2026-07-15 10:10",
-        "schoolId": "10007",
-        "teacherId": "510448965049651259",
-        "teacherName": "李敏",
-        "assessmentTitle": "必填项传参测试",
-        "assessmentIllustrate": "必填项传参测试",
-        "assessmentScore": "0.00",
-        "assessmentSortCode": 101,
-        "useStatus": 1,
-        "questionCount": null,
-        "fullScore": null,
-        "questionData": [
-            {
-                "id": "661213148149264384",
-                "createdAt": "2026-07-15 14:24:59",
-                "updatedAt": "2026-07-15 14:24:59",
-                "schoolId": "10007",
-                "assessmentId": "661148998005952512",
-                "questionClass": 0,
-                "questionTitleName": "项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出",
-                "questionType": 1,
-                "questionAnswerType": 1,
-                "questionSortRole": 1,
-                "questionSortCode": 1,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [
-                    {
-                        "id": "661213148170235904",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148149264384",
-                        "questionClass": null,
-                        "questionSortCode": 1,
-                        "answerName": "项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148174430208",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148149264384",
-                        "questionClass": null,
-                        "questionSortCode": 2,
-                        "answerName": "项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148178624512",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148149264384",
-                        "questionClass": null,
-                        "questionSortCode": 3,
-                        "answerName": "项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148182818816",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148149264384",
-                        "questionClass": null,
-                        "questionSortCode": 4,
-                        "answerName": "项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出",
-                        "answerScore": null
-                    }
-                ]
-            },
-            {
-                "id": "661213148224761856",
-                "createdAt": "2026-07-15 14:24:59",
-                "updatedAt": "2026-07-15 14:24:59",
-                "schoolId": "10007",
-                "assessmentId": "661148998005952512",
-                "questionClass": 0,
-                "questionTitleName": "必填项测试1",
-                "questionType": 0,
-                "questionAnswerType": 1,
-                "questionSortRole": 1,
-                "questionSortCode": 2,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [
-                    {
-                        "id": "661213148249927680",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148224761856",
-                        "questionClass": null,
-                        "questionSortCode": 1,
-                        "answerName": "选项1",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148254121984",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148224761856",
-                        "questionClass": null,
-                        "questionSortCode": 2,
-                        "answerName": "选项2",
-                        "answerScore": null
-                    }
-                ]
-            },
-            {
-                "id": "661213148283482112",
-                "createdAt": "2026-07-15 14:24:59",
-                "updatedAt": "2026-07-15 14:24:59",
-                "schoolId": "10007",
-                "assessmentId": "661148998005952512",
-                "questionClass": 0,
-                "questionTitleName": "选项溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出测试",
-                "questionType": 0,
-                "questionAnswerType": 1,
-                "questionSortRole": 0,
-                "questionSortCode": 3,
-                "questionScore": null,
-                "evaluationType": 0,
-                "answerData": [
-                    {
-                        "id": "661213148308647936",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148283482112",
-                        "questionClass": null,
-                        "questionSortCode": 1,
-                        "answerName": "选项溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试选项溢出测试选项溢出测试选项溢出测试",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148312842240",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148283482112",
-                        "questionClass": null,
-                        "questionSortCode": 2,
-                        "answerName": "选项溢出测试选项溢出测试选项溢溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试出测试选项溢出测试选项溢出测试",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148312842241",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148283482112",
-                        "questionClass": null,
-                        "questionSortCode": 3,
-                        "answerName": "选项溢出测试选项溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试溢出测试选项溢出测试选项溢出测试选项溢出测试",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148317036544",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148283482112",
-                        "questionClass": null,
-                        "questionSortCode": 4,
-                        "answerName": "4354",
-                        "answerScore": null
-                    },
-                    {
-                        "id": "661213148321230848",
-                        "createdAt": "2026-07-15 14:24:59",
-                        "updatedAt": "2026-07-15 14:24:59",
-                        "schoolId": "10007",
-                        "assessmentId": "661148998005952512",
-                        "questionId": "661213148283482112",
-                        "questionClass": null,
-                        "questionSortCode": 5,
-                        "answerName": "789",
-                        "answerScore": null
-                    }
-                ]
+// 整卷填写 教师问卷的答案
+const fullQuestionnaireAnswer = ref({})
+
+// 待评价教师列表
+const teacherList = ref<TeacherItm[]>([])
+// 【整卷填写】 —— 全部数据内容
+const teacherQuestionnaireData = ref([])
+// 当前选中的待评价科目教师 
+const currentActiveTeacherId = ref<number|string>('') 
+
+
+// 接收问卷表单填写信息的变更
+const HandleQuestionnaireFormChange = (val)=>{
+    fullQuestionnaireAnswer.value = val
+}
+// 问卷整卷提交
+const HandleFinishReview = async ()=>{
+    console.log('整卷提交的问卷答案--',fullQuestionnaireAnswer.value)
+
+    let params = {
+        evaluationCodeRelationId: currentSelectedQuestionnaireData.value?.evaluationCodeRelationId,
+        assessmentId: currentSelectedQuestionnaireData.value?.assessmentId,
+        answerData: Object.values(fullQuestionnaireAnswer.value)
+    }
+
+    let res = await saveEvaluationQuestionDataApi(params)
+
+    if(res?.code == 200){
+        ElMessage({
+            message: '问卷评价提交成功',
+            type: 'success',
+            customClass:'app_el_message',
+        })
+        // true  表示当前问卷全部填写完成,跳到下一个问卷( false 没有完成的留在当前问卷页)
+        if(res.data){
+            fullQuestionnaireAnswer.value = {}
+            // 重新查询教师状态和问卷状态
+            await ReloadPageData()
+            // 重查和索引切换顺序不能颠倒
+            // 找到当前选中的教师
+            let currentIndex = teacherList.value.findIndex(item=>{
+                return item.id == currentActiveTeacherId.value
+            })
+            // 如果不是最后一卷,跳转到下一卷
+            if((currentIndex + 1) >= teacherList.value.length ){
+                return
             }
-        ]
-    },
-])
+            // 跳转到下一个教师的问卷
+            currentActiveTeacherId.value = teacherList.value?.[currentIndex + 1]?.id || ''
+        }else{
+            // 重新查询教师状态和问卷状态
+            await ReloadPageData()
+        }
+    }
+}
+
 
-// 模拟问卷响应数据
-const mockResData = computed(()=>mockTeacherQuestionnaireData.value[currentActiveTeacherIndex.value % 2])
+
+// 当前选择的教师问卷(整卷填写)  或者 题目问卷(按题填写) 全部信息
+const currentSelectedQuestionnaireData = computed(()=>{
+    return teacherQuestionnaireData.value.find((item:any)=>{
+        return item.evaluationCodeRelationId == currentActiveTeacherId.value
+    })
+})
 
 // 最终渲染的整体问卷数据
 const questionaireMsg = computed(()=>{
-    let addedQuestionList = mockResData.value.questionData.map(item=>{
+    let addedQuestionList = currentSelectedQuestionnaireData.value?.questionData?.map(item=>{
         let options = item.answerData.map(opt=>{
             return{
+                questionSortCode:String(opt.questionSortCode),  //选项的序号 
+                answerCode: opt.answerCode,
                 content: opt.answerName,
                 score: opt.answerScore,
-                id: opt.id
+                id: opt.answerId
             }
         })
         let extraConfig = []
@@ -418,44 +136,89 @@ const questionaireMsg = computed(()=>{
         if(Number(item.questionSortRole) === 1){
             extraConfig.push('isHorizontal')
         }
+
+        // 初始化默认值
+        let defaultAnswer = undefined
+        // 单选  | 评分单选
+        if(item.questionType === 0 || item.questionType === 3){
+            item.answerData.map(opt=>{
+                if(opt.answerCode){
+                    defaultAnswer = opt.answerCode
+                }
+            })
+        // 多选  
+        }else if(item.questionType === 1){
+            defaultAnswer = []
+            item.answerData.map(opt=>{
+                if(opt.answerCode){
+                    defaultAnswer.push(opt.answerCode)
+                }
+            })
+        //问答  
+        }else if(item.questionType === 2){
+            defaultAnswer = item.studentAnswer
+        //评分
+        } else if(item.questionType === 5){
+            defaultAnswer = item.studentAnswerScore
+        }
+
+        console.log('defaultAnswer',defaultAnswer)  
+
         return {
             ...item,
-            id:item.id,
+            id:item.questionId,
             extraConfig,    // 是否必答 required, 是否横排 isHorizontal
             options,
-            answer:undefined
+            answer:defaultAnswer,  //获取默认answer
         }
     })
+
+    console.log('默认初始赋值——————addedQuestionList',addedQuestionList)
     return{
-        assessmentTitle:mockResData.value.assessmentTitle,  //问卷标题
-        assessmentIllustrate:mockResData.value.assessmentIllustrate,  //问卷简介
+        assessmentTitle:currentSelectedQuestionnaireData.value?.assessmentName,  //问卷标题
+        assessmentIllustrate:currentSelectedQuestionnaireData.value?.assessmentIllustrate,  //问卷简介
         // 问卷试题列表
-        questionData:addedQuestionList
+        questionData:addedQuestionList,
+        progress:currentSelectedQuestionnaireData.value?.progress,
+        deadlineTime:currentSelectedQuestionnaireData.value?.endDateTime,
     }
 })
 
 
+// 获取评价教师列表
+const GetEvaluationProcessMsg = async ()=>{
+    let res = await getEvaluationProcessMsgApi()
+    if(res?.code == 200){
+        teacherList.value = res.data.dataList
+    }
+}
 
-/**
- * 3. 整卷填写相关变量 和操作
- */
-// 问卷试题 dom
-const questionListRef = ref()
-// 当前选中的待评价科目教师
-const currentActiveTeacherIndex = ref(0) 
+//  获取整卷填写问卷数据
+const GetFullQuestionnaireData = async ()=>{
+    let teacherIds = teacherList.value.map(item=>{
+        return item.id
+    })
+    let res = await getEvaluationQuestionDataApi(teacherIds)
+    if(res?.code == 200){
+        teacherQuestionnaireData.value = res?.data
+    }
+    // 如果当前没有选中的教师问卷,则默认选中第一个教师问卷
+    if(currentActiveTeacherId.value){
+        return
+    }
+    currentActiveTeacherId.value = teacherList.value?.[0]?.id || ''
+}
 
-// 整卷填写 教师问卷的答案
-const fullQuestionnaireAnswer = ref({})
+// 重新加载页面数据
+const ReloadPageData = async ()=>{
+    await GetEvaluationProcessMsg()
+    await GetFullQuestionnaireData()
+}
 
+onMounted(()=>{
+    ReloadPageData()
+})
 
-// 接收问卷表单填写信息的变更
-const HandleQuestionnaireFormChange = (val)=>{
-    fullQuestionnaireAnswer.value = val
-}
-// 问卷整卷提交
-const HandleFinishReview = ()=>{
-    fullQuestionnaireAnswer.value = {}
-}
 </script>
 
 

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

@@ -94,7 +94,6 @@ const GoToElectiveSubject = ()=>{
 // 跳转到填写问卷页
 const GoToFillOutQuestionnaire = ()=>{
     // 模拟数据
-    sessionStorage.setItem('teacherList',JSON.stringify(teacherList.value)) 
     router.push('/app/questionnaireCommit')
 }