Procházet zdrojové kódy

修改整卷填写和按题填写的问卷数据渲染

lm před 2 týdny
rodič
revize
bac84091c5

+ 11 - 3
src/components/QuestionTypeShow.vue

@@ -91,7 +91,7 @@
 
 
 <script setup lang="ts">
-import {ref} from 'vue'
+import {ref, watch} from 'vue'
 
 interface Option {
     content: String
@@ -124,8 +124,11 @@ const props = defineProps({
     deviceType:{
         type:String,   //pc | app   __ 展示页面的设备类型
         default:'pc'
-    }
-
+    },
+    defaultQuestionVal:{   //默认的题目答案
+        type:[String,Array,Number,null],
+        default:null
+    },
 })
 const emit = defineEmits(['formChange'])
 const questionVal = ref()
@@ -138,6 +141,11 @@ const HandleChange = (val)=>{
     emit('formChange',val)
 }
 
+watch(()=>props.defaultQuestionVal,(newVal)=>{
+    console.log('props.defaultQuestionVal',newVal)
+    questionVal.value = newVal
+},{immediate:true})
+
 </script>
 
 

+ 3 - 2
src/components/QuestionnaireQuestionList.vue

@@ -15,9 +15,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)"
+                    :defaultQuestionVal="item.answer"
                 ></QuestionTypeShow>
             </div>
         </li>
@@ -47,7 +48,7 @@ interface QuestionMsg {
     questionAnswerType:number,    // 是否必答,0-否,1-是
     questionSortRole:number,   // 0-竖排,1-横排
     questionScore:string,  //问题满分
-    evaluationType:string,  // 评分题 的 分值展示形式  0数字式 1星星式
+    questionAnswerClass?:string,  // 评分题 的 分值展示形式  0数字式 1星星式
     answerData?:[],    //同options
 }
 

+ 1 - 1
src/components/batchSelectQuestionBatchFill/BatchSelectQuestionBatchFill.vue

@@ -122,7 +122,7 @@ watch(()=>props.customTableColumns,(newVal)=>{
         },
         ...newVal
     ]
-},{immediate:true})
+},{immediate:true,deep:true})
 
 </script>
 

+ 10 - 0
src/components/scoreQuestionBatchFill/table.ts

@@ -18,4 +18,14 @@ export const tableColumns = ref([
         minWdth:'',
         custom:true,
     },
+        {
+        name:'fullScore',
+        label:'满分',
+        width:'620',
+        fixed:'',
+        align:'left',
+        minWdth:'',
+        hidden:true,
+    },
+    
 ])

+ 1 - 1
src/components/singleSelectQuestionBatchFill/SingleSelectQuestionBatchFill.vue

@@ -121,7 +121,7 @@ watch(()=>props.customTableColumns,(newVal)=>{
         },
         ...newVal
     ]
-},{immediate:true})
+},{immediate:true,deep:true})
 
 </script>
 

+ 180 - 466
src/views/questionnaireCommit/QuestionnaireCommit.vue

@@ -78,16 +78,17 @@
                         @formListAnswerChange="HandleQuestionnaireFormChange"/>
                     <div class="operation">
                         <el-button :class="[isCurrentQuestionnaireTaskFinish ? 'is-disabled' :  'button_background']" 
-                            @click="isCurrentQuestionnaireTaskFinish ? '' : HandleFinishReview()">评价完成</el-button>
+                            @click="isCurrentQuestionnaireTaskFinish ? '' : HandleFinishReview()"
+                        >评价完成</el-button>
                     </div>
                 </template>
 
 
                 <!-- 按题填写问卷内容 -->
                  <template v-if="defaultQuestionnaireMode == 'split'" >
-                    <!-- 单选 0-->
+                    <!-- 单选 0   评分单选 3-->
                     <SingleSelectQuestionBatchFill
-                        v-if="currentEditQuestion.questionType === 0" 
+                        v-if="currentEditQuestion?.questionType === 0 || currentEditQuestion?.questionType === 3" 
                         v-model:isFinishEdit="isQuestionEdit" 
                         :titleIndex="currentSelectedQuestionIndex" 
                         :titleMsg="currentEditQuestion" 
@@ -98,7 +99,7 @@
                     />
                     <!-- 多选 1 -->
                     <BatchSelectQuestionBatchFill 
-                        v-if="currentEditQuestion.questionType === 1"  
+                        v-if="currentEditQuestion?.questionType === 1"  
                         v-model:isFinishEdit="isQuestionEdit" 
                         :titleIndex="currentSelectedQuestionIndex" 
                         :titleMsg="currentEditQuestion" 
@@ -109,10 +110,10 @@
                     />
 
                     <!-- 评分题 5-->
-                     <template v-if="currentEditQuestion.questionType === 5" >
+                     <template v-if="currentEditQuestion?.questionType === 5" >
                         <!-- 数字评分  -->
                         <ScoreQuestionBatchFill     
-                            v-if="currentEditQuestion.evaluationType === 0"
+                            v-if="currentEditQuestion?.questionAnswerClass === 0"
                             v-model:isFinishEdit="isQuestionEdit" 
                             :titleIndex="currentSelectedQuestionIndex" 
                             :titleMsg="currentEditQuestion"
@@ -123,7 +124,7 @@
 
                         <!-- 星星评分 -->
                         <StarRationQuestionBatchFill 
-                            v-if="currentEditQuestion.evaluationType === 1"
+                            v-if="currentEditQuestion?.questionAnswerClass === 1"
                             v-model:isFinishEdit="isQuestionEdit" 
                             :titleIndex="currentSelectedQuestionIndex" 
                             :titleMsg="currentEditQuestion"
@@ -135,7 +136,7 @@
 
                      <!-- 问答题  2-->
                     <QuestionAndAnswerBatchFill
-                        v-if="currentEditQuestion.questionType === 2"
+                        v-if="currentEditQuestion?.questionType === 2"
                         v-model:isFinishEdit="isQuestionEdit" 
                         :titleIndex="currentSelectedQuestionIndex" 
                         :titleMsg="currentEditQuestion"
@@ -164,18 +165,17 @@
                         </div>
                     </div>
                 </div>
-                <ul class="question_list_brief">
+                <ul v-if="questionaireMsg?.questionData?.length > 0" class="question_list_brief">
                     <li  v-for="(question,index) in questionaireMsg.questionData" :key="question.id">
                         <span @click="defaultQuestionnaireMode=='full' ? 
                                         ScrollToItem(question.id) : 
-                                        (IsSplitQuestionnaireUnFinish(question.status) ? '' :  HandleChangeQuestion(index,question)) " 
+                                        (IsSplitQuestionnaireUnFinish(question.studentAnswerStatus) ? '' :  HandleChangeQuestion(index,question)) " 
                             :title="question.questionTitleName" 
                             class="one_line_ellipsis" 
                             :class="[{active:defaultQuestionnaireMode=='split' && currentSelectedQuestionIndex == index,
-                                    disabled:defaultQuestionnaireMode=='split' && IsSplitQuestionnaireUnFinish(question.status)}]">
+                                    disabled:defaultQuestionnaireMode=='split' && IsSplitQuestionnaireUnFinish(question.studentAnswerStatus)}]">
                             {{ index + 1 }}.{{ question.questionTitleName }}
                         </span>
-                        <!-- <img v-if="defaultQuestionnaireMode=='split' && IsSplitQuestionnaireFinish(question.status)" :src="finishIcon" alt=""> -->
                         <img v-if="IsSplitQuestionnaireFinish(question.studentAnswerStatus)" :src="finishIcon" alt="">
                         <!-- question.studentAnswerStatus  学生答题是否完成   0 否  1 是-->
                     </li>
@@ -260,410 +260,107 @@ const questionnaireProgress= computed(()=>{
 })
 
 
-//  模拟所有教师的问卷数据(目前只有两个)
-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": "5.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 mockResData = computed(()=>mockTeacherQuestionnaireData.value?.[currentActiveTeacherIndex.value])
+// 【按题填写】时候的全部数据内容
+const questionnaireSplitData = ref<any[]>([])
+// 按题填写时候的题目列表
+const questionnaireSplitTitleList = computed(()=>{
+    return questionnaireSplitData.value?.map((item:any)=>{
+        return {
+            id:item.questionId,
+            studentAnswerStatus:item.studentAnswerStatus,
+            questionTitleName:item.questionTitleName,
+        }
+    })
+})
 
+// 【整卷填写】 —— 全部数据内容
+const teacherQuestionnaireData = ref([])
+
+// 当前选择的教师问卷(整卷填写)  或者 题目问卷(按题填写) 全部信息
+const currentSelectedQuestionnaireData = computed(()=>{
+    // 整卷填写
+    if(defaultQuestionnaireMode.value == 'full'){
+        return teacherQuestionnaireData.value?.[currentActiveTeacherIndex.value]
+    // 按题填写
+    }else if(defaultQuestionnaireMode.value == 'split'){
+        return questionnaireSplitData.value?.[currentSelectedQuestionIndex.value]
+    }
+})
 // 最终渲染的整体问卷数据
 const questionaireMsg = computed(()=>{
-    let addedQuestionList = mockResData.value?.questionData?.map(item=>{
-        let options = item.answerData.map(opt=>{
-            return{
-                answerCode: opt.answerCode,
-                content: opt.answerName,
-                score: opt.answerScore,
-                id: opt.answerId
+     if(defaultQuestionnaireMode.value == 'full'){
+        let addedQuestionList = currentSelectedQuestionnaireData.value?.questionData?.map(item=>{
+            let options = item.answerData.map(opt=>{
+                return{
+                    answerCode: opt.answerCode,
+                    content: opt.answerName,
+                    score: opt.answerScore,
+                    id: opt.answerId
+                }
+            })
+            let extraConfig = []
+            if(Number(item.questionAnswerType) === 1){
+                extraConfig.push('required')
+            }
+            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.answerId
+                    }
+                })
+            // 多选  
+            }else if(item.questionType === 1){
+                defaultAnswer = []
+                item.answerData.map(opt=>{
+                    if(opt.answerCode){
+                        defaultAnswer.push(opt.answerId)
+                    }
+                })
+            //问答  
+            }else if(item.questionType === 2){
+                defaultAnswer = item.studentAnswer
+            //评分
+            } else if(item.questionType === 5){
+                defaultAnswer = item.studentQuestionScore
+            }
+
+            console.log('defaultAnswer',defaultAnswer)  
+
+            return {
+                ...item,
+                id:item.questionId,
+                extraConfig,    // 是否必答 required, 是否横排 isHorizontal
+                options,
+
+                answer:defaultAnswer,  //获取默认answer
             }
         })
-        let extraConfig = []
-        if(Number(item.questionAnswerType) === 1){
-            extraConfig.push('required')
-        }
-        if(Number(item.questionSortRole) === 1){
-            extraConfig.push('isHorizontal')
+        return{
+            assessmentTitle:currentSelectedQuestionnaireData.value?.assessmentName,  //问卷标题
+            assessmentIllustrate:currentSelectedQuestionnaireData.value?.assessmentIllustrate,  //问卷简介
+            // 问卷试题列表
+            questionData:addedQuestionList,
+            progress:currentSelectedQuestionnaireData.value?.progress,
+            deadlineTime:currentSelectedQuestionnaireData.value?.endDateTime,
         }
-        return {
-            ...item,
-            id:item.questionId,
-            extraConfig,    // 是否必答 required, 是否横排 isHorizontal
-            options,
-            answer:undefined,
-            evaluationType :item.questionAnswerClass
+
+     }else if(defaultQuestionnaireMode.value == 'split'){
+        return{
+            assessmentTitle:currentSelectedQuestionnaireData.value?.assessmentName,  //问卷标题
+            assessmentIllustrate:currentSelectedQuestionnaireData.value?.assessmentIllustrate,  //问卷简介
+            // 问卷试题列表
+            questionData:questionnaireSplitTitleList.value,
+            // progress:currentSelectedQuestionnaireData.value?.progress,
+            deadlineTime:currentSelectedQuestionnaireData.value?.endDateTime,
         }
-    })
-    return{
-        assessmentTitle:mockResData.value?.assessmentName,  //问卷标题
-        assessmentIllustrate:mockResData.value?.assessmentIllustrate,  //问卷简介
-        // 问卷试题列表
-        questionData:addedQuestionList,
-        progress:mockResData.value?.progress,
-        deadlineTime:mockResData.value?.endDateTime,
-    }
+     }
 })
 
 
@@ -680,12 +377,11 @@ const QuestionnaireModeDisabled = ref(false)
 const HandleQuestionnaireModeChange = async (val)=>{
     console.log('当前选中的值',val)
     defaultQuestionnaireMode.value = val
-    // if(val == 'split'){
-    //     let teacherIds = teacherList.value.map(item=>{
-    //         return item.id
-    //     })
-    //     let res =  await getEvaluationQuestionDataSplitApi(teacherIds)
-    // }
+    if(val == 'split'){
+        await GetSplitQuestionnaireData()
+    }else if(val == 'full'){
+        await GetFullQuestionnaireData()
+    }
 }
 
 // 监听从接口获取到的 历史问卷填写方式,变更当前页面的模式和模式的禁选状态
@@ -696,6 +392,29 @@ watch(()=>HistoryQuestionnaireFillMode.value,(newVal)=>{
     }
 })
 
+//  获取整卷填写问卷数据
+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
+    }
+}
+
+// 获取按题填写问卷数据
+const GetSplitQuestionnaireData = async ()=>{
+    let teacherIds = teacherList.value.map(item=>{
+        return item.id
+    })
+    let res = await getEvaluationQuestionDataSplitApi(teacherIds)
+    if(res?.code == 200){
+        questionnaireSplitData.value = res.data
+    }
+}
+
+
 /**
  * 3. 整卷填写相关变量 和操作
  */
@@ -736,14 +455,14 @@ const HandleFinishReview = ()=>{
  *  4. 按题填写相关变量 和操作
  */
 const isQuestionEdit = ref(false)  // 当前试题是否已经编辑完成
-const currentSelectedQuestionIndex = ref(0)  // 当前选中的题索引
+const currentSelectedQuestionIndex = ref(0)  // 当前选中的题索引
 
 // 当前问卷题目的 教师评价答案列表
 const singleQuestionAnswer = ref([])
 
 // 当前编辑的试题
 const currentEditQuestion = computed(()=>{
-    return questionaireMsg.value?.questionData?.[currentSelectedQuestionIndex.value]
+    return questionnaireSplitData.value?.[currentSelectedQuestionIndex.value]
 })
 
 
@@ -756,32 +475,15 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
     console.log('teacherList',teacherList.value)
     console.log('questionaireMsg',questionaireMsg.value)
     switch(newVal){
-        case 0:{    //单选
+        case 0:
+        case 3:
+        {    //单选
             let rowKeys = { }
-
-            // 带答案的数据渲染 处理 ————
-                // 待完善
-                // —— 针对原始数据
-                // 行循环 
-                // 列循环
-
-
-                // 列循环
-                    // 行循环
-                    
-                // 20 份答卷
-                  // 同一题目 
-                      // 不同选项 
-                      // 每个人的答案
-
-
-            // 列循环
             // 表列(头)获取
-            questionTableColumns.value =  currentEditQuestion.value?.options?.map((item,index)=>{
-                rowKeys[item.id] = ''
+            questionTableColumns.value =  currentEditQuestion.value?.answerData?.map((item,index)=>{
                 return {
-                    name:item.id,
-                    label:`${getExcelColumn(index)}. `+item.content,
+                    name:'sort_'+item.questionSortCode,
+                    label:`${getExcelColumn(item.questionSortCode - 1)}. `+item.answerName,
                     width:'200',
                     fixed:'',
                     align:'left',
@@ -789,22 +491,26 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
                     custom:true,
                 }
             }) || []
-
             // 表行数据获取
-            questionTableData.value =  teacherList.value.map(item=>{
+            questionTableData.value =   currentEditQuestion.value?.studentAnswerData?.map((stuAnswer)=>{
+                let answers = stuAnswer.answerCode?.split('|') || []
+                // 回显已经填写完的信息
+                answers.map((ans)=>{
+                    rowKeys['sort_'+ans] = true
+                })
                 return {
-                    teacher:item.teacherName,
-                    ...rowKeys  //答案需要循环遍历
+                    teacher:stuAnswer.teacherName,
+                    ...rowKeys
                 }
             })
+            break
         }    
         case 1:{    //多选
             let rowKeys = { }
-            questionTableColumns.value =  currentEditQuestion.value?.options?.map((item,index)=>{
-                rowKeys[item.id] = ''
+            questionTableColumns.value =  currentEditQuestion.value?.answerData?.map((item,index)=>{
                 return {
-                    name:item.id,
-                    label:`${getExcelColumn(index)}. `+item.content,
+                    name:'sort_'+item.questionSortCode,
+                    label:`${getExcelColumn(item.questionSortCode - 1)}. `+item.answerName,
                     width:'200',
                     fixed:'',
                     align:'left',
@@ -812,30 +518,41 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
                     custom:true,
                 }
             }) || []
-            questionTableData.value =  teacherList.value.map(item=>{
+            // 表行数据获取
+            questionTableData.value =   currentEditQuestion.value?.studentAnswerData?.map((stuAnswer)=>{
+                let answers = stuAnswer.answerCode?.split('|') || []
+                // 回显已经填写完的信息
+                answers.map((ans)=>{
+                    rowKeys['sort_'+ans] = true
+                })
                 return {
-                    teacher:item.teacherName,
-                    ...rowKeys  //答案需要循环遍历
+                    teacher:stuAnswer.teacherName,
+                    ...rowKeys
                 }
             })
             break
         }    
         case 5:{
             //评分题
-            questionTableData.value =  teacherList.value.map(item=>{
+            questionTableData.value =   currentEditQuestion.value?.studentAnswerData?.map((stuAnswer)=>{
+                let answers = stuAnswer.studentQuestionScore
+                // 回显已经填写完的信息
                 return {
-                    teacher:item.teacherName,
-                    score:'',
-                    fullScore:10
+                    teacher:stuAnswer.teacherName,
+                    score:answers,
+                    fullScore:currentEditQuestion.value?.questionScore
                 }
             })
             break
         }    
         case 2:{   //问答题 
-            questionTableData.value =  teacherList.value.map(item=>{
+            // 表行数据获取
+            questionTableData.value =   currentEditQuestion.value?.studentAnswerData?.map((stuAnswer)=>{
+                let answers = stuAnswer.studentAnswer
+                // 回显已经填写完的信息
                 return {
-                    teacher:item.teacherName,
-                    content:'',
+                    teacher:stuAnswer.teacherName,
+                    content:answers
                 }
             })
             break
@@ -865,6 +582,10 @@ const HandleFinishCurrentQuestion = ()=>{
     isQuestionEdit.value = false
 }
 
+/**
+ *  5. 整体
+ */
+
 // 
 // 处理页面的倒计时
 const HandleTimeDeadline = ()=>{
@@ -878,14 +599,7 @@ onMounted( async ()=>{
     let localTeacherList = sessionStorage.getItem('teacherList')
     if(localTeacherList){
         teacherList.value = JSON.parse(localTeacherList || '[]')
-        let teacherIds = teacherList.value.map(item=>{
-            return item.id
-        })
-        let res = await getEvaluationQuestionDataApi(teacherIds)
-        if(res?.code == 200){
-            mockTeacherQuestionnaireData.value = res?.data
-        }
-
+        await GetFullQuestionnaireData()
     }
     // HandleTimeDeadline()
 })