Procházet zdrojové kódy

添加按题填写的评分(星)题数据渲染

lm před 2 týdny
rodič
revize
0324b28485

+ 10 - 1
src/api/questionnaireCommit.ts

@@ -4,7 +4,7 @@ import request from '../utils/request.ts'
 let studentPrefix = import.meta.env.VITE_API_STUDENT_PRE 
 
 
-// 查询评价试卷数据
+// 查询评价试卷数据(整卷填写)
 export const getEvaluationQuestionDataApi = (data:any) => {
   return request({
     url: `${studentPrefix}/api/v1/assessment/center/evaluation/queryEvaluationQuestionData`,
@@ -12,3 +12,12 @@ export const getEvaluationQuestionDataApi = (data:any) => {
     data
   })
 }
+
+// 查询评价试卷数据(按题填写)
+export const getEvaluationQuestionDataSplitApi = (data:any) => {
+   return request({
+    url: `${studentPrefix}/api/v1/assessment/center/evaluation/queryEvaluationManyQuestionData`,
+    method: 'post',
+    data
+  })
+}

+ 1 - 1
src/components/questionAndAnswerBatchFill/table.ts

@@ -3,7 +3,7 @@ import { ref } from "vue"
 export const tableColumns = ref([
     {
         name:'teacher',
-        label:'科目',
+        label:'教师',
         width:'120',
         fixed:'',
         align:'center',

+ 17 - 22
src/components/scoreQuestionBatchFill/ScoreQuestionBatchFill.vue

@@ -48,33 +48,22 @@ const props = defineProps({
         type:Boolean,
         default:true
     },
+    defaultTableData:{
+        type:Array,
+        default:()=>[]
+    }
 
 })
 
 const emit = defineEmits(['questionAnswerChange'])
 
 // 模拟数据
-const tableData = ref([
-    {
-        subject:'语文',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'数学',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'英语',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'物理',
-        score:0,
-        fullScore:10
-    },
+const tableData = ref<any[]>([
+    // {
+    //     teacher:'语文',
+    //     score:0,
+    //     fullScore:10
+    // },
 ])
 
 
@@ -103,7 +92,13 @@ watch(()=>tableData.value,(newVal)=>{
     // 当前问卷没有全部填写完成
         isFinishEdit.value = false
     }
-},{deep:true})
+},{deep:true,immediate:true})
+
+
+watch(()=>props.defaultTableData,(newVal)=>{
+    console.log('传递的表数据变化了---',newVal)
+    tableData.value = newVal
+},{immediate:true,deep:true})
 
 
 </script>

+ 2 - 2
src/components/scoreQuestionBatchFill/table.ts

@@ -2,8 +2,8 @@ import { ref } from "vue"
 
 export const tableColumns = ref([
     {
-        name:'subject',
-        label:'科目',
+        name:'teacher',
+        label:'教师',
         width:'120',
         fixed:'',
         align:'center',

+ 17 - 23
src/components/starRationQuestionBatchFill/StarRationQuestionBatchFill.vue

@@ -47,7 +47,10 @@ const props = defineProps({
         type:Boolean,
         default:true
     },
-    
+    defaultTableData:{
+        type:Array,
+        default:()=>[]
+    }
 })
 
 const emit = defineEmits(['questionAnswerChange'])
@@ -56,27 +59,12 @@ const isFinishEdit = defineModel('isFinishEdit')  //是否已经编辑完成,
 
 
 // 模拟数据
-const tableData = ref([
-    {
-        subject:'语文',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'数学',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'英语',
-        score:0,
-        fullScore:10
-    },
-    {
-        subject:'物理',
-        score:0,
-        fullScore:10
-    },
+const tableData =  ref<any[]>([
+    // {
+    //     teacher:'语文',
+    //     score:0,
+    //     fullScore:10
+    // },
 ])
 
 // 处选项的选中
@@ -102,7 +90,13 @@ watch(()=>tableData.value,(newVal)=>{
     // 当前问卷没有全部填写完成
         isFinishEdit.value = false
     }
-},{deep:true})
+},{deep:true,immediate:true})
+
+
+watch(()=>props.defaultTableData,(newVal)=>{
+    console.log('传递的表数据变化了---',newVal)
+    tableData.value = newVal
+},{immediate:true,deep:true})
 
 
 </script>

+ 2 - 2
src/components/starRationQuestionBatchFill/table.ts

@@ -2,8 +2,8 @@ import { ref } from "vue"
 
 export const tableColumns = ref([
     {
-        name:'subject',
-        label:'科目',
+        name:'teacher',
+        label:'教师',
         width:'120',
         fixed:'',
         align:'center',

+ 17 - 8
src/views/questionnaireCommit/QuestionnaireCommit.vue

@@ -118,6 +118,7 @@
                             :titleMsg="currentEditQuestion"
                             @questionAnswerChange="HandleQuestionAnswerChange"
                             :allowEdit="!isCurrentQuestionnaireTaskFinish"
+                            :defaultTableData="questionTableData"
                         />
 
                         <!-- 星星评分 -->
@@ -128,6 +129,7 @@
                             :titleMsg="currentEditQuestion"
                             :allowEdit="!isCurrentQuestionnaireTaskFinish"
                             @questionAnswerChange="HandleQuestionAnswerChange"
+                            :defaultTableData="questionTableData"
                         />
                      </template>
 
@@ -204,7 +206,7 @@ import { subjectToColor,fillOutStatusToColor,
 import { useTimeCountDown } from '@/utils/dateTransform';
 import {getExcelColumn} from '@/utils/numberConvertExcelColumn'
 
-import { getEvaluationQuestionDataApi } from '@/api/questionnaireCommit'
+import { getEvaluationQuestionDataApi, getEvaluationQuestionDataSplitApi } from '@/api/questionnaireCommit'
 
 import redTimeIcon from '@/assets/icon/red_time_icon.svg'
 import finishIcon from '@/assets/studentQuestionnaire/select_icon.png'
@@ -675,9 +677,15 @@ const defaultQuestionnaireMode = ref('full')  //  split  full
 const QuestionnaireModeDisabled = ref(false)
 
 // 问卷填写模式变更
-const HandleQuestionnaireModeChange = (val)=>{
+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)
+    // }
 }
 
 // 监听从接口获取到的 历史问卷填写方式,变更当前页面的模式和模式的禁选状态
@@ -804,7 +812,6 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
                     custom:true,
                 }
             }) || []
-
             questionTableData.value =  teacherList.value.map(item=>{
                 return {
                     teacher:item.teacherName,
@@ -815,9 +822,13 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
         }    
         case 5:{
             //评分题
-
-
-
+            questionTableData.value =  teacherList.value.map(item=>{
+                return {
+                    teacher:item.teacherName,
+                    score:'',
+                    fullScore:10
+                }
+            })
             break
         }    
         case 2:{   //问答题 
@@ -830,8 +841,6 @@ watch(()=>currentEditQuestion.value?.questionType,(newVal)=>{
             break
         }   
     }
-
-
 },{immediate:true})