Forráskód Böngészése

客观题回显更新

dengshaobo 1 hónapja
szülő
commit
cf003e53a0
3 módosított fájl, 251 hozzáadás és 16 törlés
  1. 9 0
      src/api/exam.ts
  2. 161 12
      src/views/exam/abnormal/abnormal.vue
  3. 81 4
      src/views/exam/scanList.vue

+ 9 - 0
src/api/exam.ts

@@ -371,4 +371,13 @@ export const getExamScoreSummary= (data:any):Promise<ApiResponse> => {
     method: 'post',
     data
   })
+}
+
+// 41. 扫描学生 考号填涂位置设置
+export const setExamNumberPosition= (data:any):Promise<ApiResponse> => {
+  return request({
+    url: '/api/v1/ai_exam_scan/set_card_number_seq',
+    method: 'post',
+    data
+  })
 }

+ 161 - 12
src/views/exam/abnormal/abnormal.vue

@@ -54,7 +54,7 @@
                         </div>
                     </div>
                     <div class="content_canvas">
-                        <PositionCanvas ref="PositionCanvas" :usedCardType="usedCardType" :positionList="sourcePoints"  :paperImgUrl="currentTemplateUrl" @GetCutPosition="GetCutTemaplatePosition" :paperType="usedCardType==1?'template':'student'"   v-if="currentTemplateUrl"> </PositionCanvas>
+                        <PositionCanvas  :usedCardType="usedCardType" :positionList="sourcePoints"  :paperImgUrl="currentTemplateUrl" @GetCutPosition="GetCutTemaplatePosition" paperType="'template'"   v-if="currentTemplateUrl"> </PositionCanvas>
                     </div>
                 </div>
                 <div class="paper_content">
@@ -72,7 +72,7 @@
                         </div>
                     </div>
                     <div class="content_canvas">
-                        <PositionCanvas ref="PaperCanvas" :usedCardType="usedCardType" :positionList="targetPoints"  :paperImgUrl="currentPaperUrl"  @GetCutPosition="GetCutStudentPosition" paperType="student" v-if="currentPaperUrl"> </PositionCanvas>
+                        <PositionCanvas  :usedCardType="usedCardType" :positionList="targetPoints"  :paperImgUrl="currentPaperUrl"  @GetCutPosition="GetCutStudentPosition" paperType="student" v-if="currentPaperUrl"> </PositionCanvas>
                     </div>
                 </div>
 
@@ -412,7 +412,7 @@ const currentPageInfo = ref<any>({})    // 当前页面信息
 const usedCardType = ref(2) // 1 系统卡  2 三方卡  默认2
 const sourcePoints = ref<any[]>([]) // 模板点位
 const targetPoints = ref<any[]>([]) // 学生点位
-const currentTemplateList = ref<any[]>([]) // 模板页码列表
+const currentTemplateList = ref<any[]>([]) // 模板数据
 
 //客观题异常相关
 const currentQuestionList= ref<any[]>([]);//客观题题目异常校正列表
@@ -485,6 +485,7 @@ const AbnormalChanage = (type: number) => {
             console.log('试卷图片列表',currentPaperList.value)
             currentPaperUrl.value=currentPaperList.value[0].recognizeUrl;//当前图片地址
         }
+        GetTemplateDetail();//调用模板数据
     }
 
     //考号异常 3
@@ -499,6 +500,10 @@ const AbnormalChanage = (type: number) => {
             currentPaperUrl.value=currentPaperList.value[0].recognizeUrl;//当前图片地址
             currentImagePageNo.value=currentPaperList.value[0].pageNo;//当前图片的页码
         }
+        else
+        {
+            ClearCurrentData();
+        }
     }
     //客观题异常
     if(type==4)
@@ -519,11 +524,24 @@ const AbnormalChanage = (type: number) => {
             console.log('客观题异常',currentItem.value)
             ObjectDataChange();//客观题答案回显
         }
+        else
+        {
+            ClearCurrentData();
+        }
 
     }
     CalculateTableHeight();//计算表格高度
 }
 
+//当前数据数据重置
+const ClearCurrentData = () => {
+    currentIndex.value = 0;//重置索引
+    currentItem.value={};//当前学生数据
+    currentPaperList.value=[];//试卷图片列表
+    currentPaperUrl.value="";//当前图片地址
+    currentQuestionList.value=[];//清空客观题数据
+}
+
 // 2. 刷新异常列表
 const RefreshAbnormalList = () => {
     // TODO: 调用接口刷新当前 abnormalType 的数据
@@ -542,10 +560,107 @@ const ShowDrawData = () => {
     // TODO: 更新 ActionImage 的 drawData 显示状态
 }
 
-// 5. 客观题答案回显数据设置切换
+// 5. 客观题答案回显数据设置切换  客观题数据处理 客观题回显
 const ObjectDataChange = () => {
     // TODO: 根据 isShowDrawType 重新渲染右侧列表或 Canvas
     console.log('客观题答案回显', )
+    console.log("打印模板数据",currentTemplateList.value);
+    let questionList=currentTemplateList.value[0].examCardGroupVOS;//选择题判分就一页 
+    console.log("打印客观题模板数据",questionList);
+    const drawList: any[] = [];
+    questionList.forEach((item:any, index:number) => {
+
+        console.log("打印第"+index+"个切块数据",item);
+        if (item.position) {
+            let position = JSON.parse(item.position);
+            let unit = 'px';//默认px单位
+            let topiclist = [];
+            if(item.groupTopicList)
+            {
+                //处理答案数据
+                item.groupTopicList.forEach((topic:any) => {
+                    let answerItem=currentQuestionList.value.find(questionItem => questionItem.objectiveName == topic.topicName);
+                    console.log("打印topic",topic);
+                    console.log("打印currentQuestionList", currentQuestionList.value);
+                    console.log("打印answerItem",answerItem);
+                    let answerList=JSON.parse(topic.optionJsons);
+                    console.log("打印answerList",answerList);
+                    topic.answerList=answerList;
+                    if(answerItem)
+                    {
+                        if(answerItem.selectValue)
+                        {
+                                // 将多个字母拆分成数组
+                            // const answerLetters = answerItem.selectValue.split('');
+                            // 将多个字母拆分成数组(兼容多种分隔符)
+                            const answerLetters = answerItem.selectValue.match(/[A-Za-z]/g) || [];
+                            // console.log('answerLetters',answerLetters);
+                            answerLetters.forEach((letter:any) => {
+                                let answerIndex = GetAnswerIndexToLetter(letter);
+                                if(topic.topicType==3)
+                                {
+                                    //判断题
+                                    answerIndex=GetAnswerIndexToLetterTF(letter);
+                                }
+                                
+                                console.log("打印answerIndex", answerIndex);
+                                if (answerIndex !== -1 && topic.answerList[answerIndex]) {
+                                    topic.answerList[answerIndex].isCheck = true;
+                                }
+                            });
+                        }
+
+                        if(answerItem.hasAbnormal==1)
+                        {
+                            //异常的背景显示红色
+                            topic.hasAbnormal=true;//是否异常
+
+                        }
+                        
+                    }
+                });
+                item.groupTopicList[0].answerList
+                topiclist=item.groupTopicList;
+            }
+
+            var obj = {
+                x: position.x,
+                y: position.y,
+                w: position.w,
+                h: position.h,
+                position: item.position,
+                blockArea: item.blockArea,
+                page: 1,//选择题就一页 默认1
+                blockName: item.name,
+                id: item.groupId,
+                unit: unit,//单位
+                usedCardType:2,//默认三方卡 选择题,
+                areaOption: item.groupConfig,//添加选择题设置信息
+                topiclist: topiclist,
+            };
+            // 1 全部区域  2 定位区 3 标题区 4 学号区 5 姓名区 6 缺考区 7 AB卷区 8 客观题区 9 选做题区
+        
+
+            drawList.push(obj);
+        }
+    });
+    currentDrawData.value=drawList;
+    console.log("打印客观题画框数据",currentDrawData.value);
+
+}
+
+
+// 根据字母转换成索引
+const GetAnswerIndexToLetter = (value: string) => {
+    const letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 
+           'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
+    return letters.findIndex(letter => letter == value);
+}
+
+// 判断题的
+const GetAnswerIndexToLetterTF = (value: string) => {
+    const letters = ['T', 'F'];
+    return letters.findIndex(letter => letter == value);
 }
 
 // 6. 模板页码切换
@@ -1197,14 +1312,14 @@ const ObjectiveCheck = async () => {
             console.log("打印学生列表", studentList)
             console.log("打印当前学生索引", currentIndex.value)
             
-            // if (currentIndex.value < studentList.length - 1) {
-            //     if(rightTab.value === 'processed') {
-            //         currentIndex.value = currentIndex.value + 1
-            //     }
-            // } else {
-            //     console.log("已经是最后一个学生")
-            //     currentIndex.value = 0
-            // }
+            if (currentIndex.value < studentList.length - 1) {
+                if(rightTab.value === 'processed') {
+                    currentIndex.value = currentIndex.value + 1
+                }
+            } else {
+                console.log("已经是最后一个学生")
+                currentIndex.value = 0
+            }
             console.log("打印当前索引", currentIndex.value)
             GetAbnormalList()
         } else {
@@ -1313,8 +1428,28 @@ const GetAbnormalList = async () => {
             if(res.data.abnormalGroupVO.objectiveAbnormal)
             {
                 objectData.value.pendingList = res.data.abnormalGroupVO.objectiveAbnormal || [];
+                
+            }
+            else
+            {
+                //清空数据
+                objectData.value.pendingList = [];
+                currentIndex.value = 0;
+                currentItem.value={};//当前学生数据
+                currentPaperList.value=[];//试卷图片列表
+                currentPaperUrl.value="";//当前图片地址
+                currentQuestionList.value=[];//清空客观题数据
+
+            }
+            if(res.data.abnormalGroupVO.dealObjectiveAbnormal)
+            {
                 objectData.value.processedList = res.data.abnormalGroupVO.dealObjectiveAbnormal || [];
             }
+            else
+            {
+                objectData.value.processedList = [];
+                currentIndex.value = 0;
+            }
 
             abnormalObj.value={
                 locationErrorNum: positionData.value.pendingList.length, // 定位异常数量
@@ -1349,6 +1484,20 @@ const GetTemplateDetail = async () => {
     console.log("打印模板数据",res);
     if(res.code == 200)
     {
+       currentTemplateList.value=[];
+       res.data.forEach((item:any)=>{ 
+        let obj={
+            examCardGroupVOS: item.examCardGroupVOS,
+            pageNo: item.pageNo,
+            paperInfo: item.paperInfo,
+            templateUrl: item.templateUrl,
+            pageNum: item.pageNo,
+
+        };
+        currentTemplateList.value.push(obj);
+        currentTemplatePageIndex.value=currentTemplateList.value[0].pageNum;
+        currentTemplateUrl.value=item.templateUrl;
+       })
        
 
 

+ 81 - 4
src/views/exam/scanList.vue

@@ -91,7 +91,7 @@
         </div>
         <div class="content_right">
             <div class="right_header">
-               <div class="scan_set"> 扫描设置</div>
+               <div class="scan_set" @click="OpenNumberSet()"> 考号设置</div>
                <div class="scan_set_scan_code">
     
                     <el-select style="width: 100px;margin-right: 6px;" v-model="useDriveUI" placeholder="是否显示驱动弹窗" @change="ChangeDriveUI">
@@ -160,8 +160,38 @@
             </div>
         </div>
     </div>
-    <SelectStudent v-model="showSelectStudent"  @success="StudentSuccess"></SelectStudent>
+    <!-- <SelectStudent v-model="showSelectStudent"  @success="StudentSuccess"></SelectStudent> -->
     <AbnormalDetail v-model="showAbnormalDialog" :scanState="scanState"></AbnormalDetail>
+    <div class="page_dialog">
+          <el-dialog
+            v-model="showNumberSetDialog"
+            title="考号设置"
+            width="480px"
+            class="page_dialog"
+            
+        >
+            <el-form ref="formRef"   label-width="130px">
+                <el-form-item label="考号识别顺序:" prop="examSubjectName">
+                    <el-select style="width: 60px;margin-right: 6px;" v-model="examCodeStart" placeholder="开始位置" >
+                        <el-option v-for="item in 10" :key="item" :label="item" :value="item"></el-option>
+                    </el-select>
+                    -
+                    <el-select style="width: 60px;margin-right: 6px;margin-left: 6px;" v-model="examCodeEnd" placeholder="结束位置">
+                        <el-option v-for="item in 10" :key="item" :label="item" :value="item"></el-option>
+                    </el-select>
+                </el-form-item>
+                
+               
+            </el-form>
+
+            <template #footer>
+            <span class="dialog-footer">
+                <el-button @click="CloseNumberSet()">取消</el-button>
+                <el-button type="primary" :loading="setLoading" @click="HandleSubmit">确定</el-button>
+            </span>
+            </template>
+        </el-dialog>
+    </div>
   </div>
 </template>
 <script lang="ts" setup>
@@ -171,7 +201,7 @@ import { useRouter } from 'vue-router'
 import { onMounted ,ref,computed,onUnmounted,nextTick } from 'vue';
 import ScanButton from './components/scanButton.vue'
 import SelectStudent from './components/selectStudent.vue'
-import { finishScanned,getExamScoreSummary,hasImportStudent,getBatchList,getCurrentBatchNo,deleteBatch,updateScanCount,setExamScanSetting,saveChooseCode} from '@/api/exam'
+import {setExamNumberPosition,finishScanned,getExamScoreSummary,hasImportStudent,getBatchList,getCurrentBatchNo,deleteBatch,updateScanCount,setExamScanSetting,saveChooseCode} from '@/api/exam'
 import scanCommon from '@/utils/scanCommon';
 import { ElMessageBox, ElMessage } from 'element-plus'
 import { formatTimestamp } from '@/utils/common';
@@ -237,6 +267,11 @@ const selectSchoolId=ref(0);//学校ID
 const showAbnormalDialog=ref(false);//异常弹窗
 const scanState = ref(0);//扫描状态//默认未扫描
 
+const showNumberSetDialog=ref(false);//考号识别顺序设置
+const examCodeStart=ref(1);//考号开始位置
+const examCodeEnd=ref(10);//考号结束位置
+const setLoading=ref(false);//考号设置加载中
+
 const params=ref({
     batchNo:'',
     keyWord:''
@@ -391,6 +426,44 @@ const ConfigRequestUrlByEnv= () =>{
           
 }
 
+
+//打开考号位数设置
+const OpenNumberSet=()=>{
+    console.log("打印考号位数设置");
+    showNumberSetDialog.value=true;
+}
+
+//关闭考号位数设置
+const CloseNumberSet=()=>{
+    showNumberSetDialog.value=false;
+}
+
+//确定考号设置
+const HandleSubmit=()=>{
+
+    if(examCodeStart.value > examCodeEnd.value) {
+        ElMessage.error("开始考号位置不能大于结束考号位置");
+        return;
+    }
+
+    let params={
+        examSubjectId:examSubjectId.value,
+        examCodeStart:examCodeStart.value,
+        examCodeEnd:examCodeEnd.value,
+    };
+    setExamNumberPosition(params).then(res => {
+        if(res.code == 200) 
+        {
+            ElMessage.success("设置成功!")
+            showNumberSetDialog.value=false;
+        }
+        else
+        {
+            ElMessage.error(res.msg);
+        
+        }
+    })
+}
 //切换弹窗模式
 const ChangeDriveUI=()=>{
     console.log("打印弹窗模式", useDriveUI.value);
@@ -751,7 +824,7 @@ const StudentSuccess = () => {
 
 
 
-//获取扫描批次列表
+//获取批次列表 获取扫描批次列表
 const GetScanBatchList=async()=>{
     const params = {
       examSubjectId: examSubjectId.value,
@@ -762,6 +835,10 @@ const GetScanBatchList=async()=>{
     {
         
         selectSchoolId.value=res.data.schoolId;//获取学校id
+        scanIdentifyCode.value=res.data.chooseCode;//获取识别码
+        //1-单面 2-双面
+        examCodeEnd.value=res.data.examCodeEnd;
+        examCodeStart.value=res.data.examCodeStart;
         if(res.data.scannedWebSocketVO)
         {
             tableData.value=res.data.scannedWebSocketVO?.data || [];