|
|
@@ -327,7 +327,7 @@ import { onMounted,onUnmounted, ref, computed, nextTick, watch } from 'vue';
|
|
|
import { ElMessage,ElMessageBox } from 'element-plus'
|
|
|
|
|
|
// 引入可能需要的 API (请根据实际路径调整)
|
|
|
-import { getExamAbnormalList,getSearchScanStudents,claimAnswerCard, correctObjectiveQuestion,markPositionAbnormal, deletePaper } from '@/api/exam'
|
|
|
+import { getExamAbnormalList,getSearchScanStudents,claimAnswerCard, correctObjectiveQuestion,markPositionAbnormal, deletePaper ,reRecognizePosition} from '@/api/exam'
|
|
|
|
|
|
// 引入子组件 (确保路径正确)
|
|
|
import PositionCanvas from '@/components/PositionCanvas.vue' // 假设路径
|
|
|
@@ -396,7 +396,7 @@ const currentTemplateUrl = ref('')//试卷图片模板地址
|
|
|
const currentPaperUrl = ref('')//试卷图片地址
|
|
|
const currentImagePageNo = ref('')//当前图片页码
|
|
|
const currentPaperIndex = ref(0)//当前图片索引
|
|
|
-const currentTemplatePageIndex = ref(0)////当前模板页索引
|
|
|
+const currentTemplatePageIndex = ref(1)////当前模板页索引
|
|
|
const currentDrawData= ref<any[]>([]);//画框数据
|
|
|
const currentPaperList = ref<any[]>([]) // 底部缩略图列表
|
|
|
const currentPageInfo = ref<any>({}) // 当前页面信息
|
|
|
@@ -437,10 +437,12 @@ const objectTableHeight = ref(200);//客观题异常处理表格高度
|
|
|
const subjectiveTableHeight = ref(200)
|
|
|
const tableKey = ref(0)
|
|
|
|
|
|
+const rotationAngle=ref(0);//旋转角度
|
|
|
+
|
|
|
// 其他状态
|
|
|
const rightTab = ref('pending') // pending | processed
|
|
|
const reCutLoading = ref(false)
|
|
|
-const reCutText = ref('重新切割')
|
|
|
+const reCutText = ref('重新识别')
|
|
|
const correctionLoading = ref(false)
|
|
|
const subjectStudentIndex = ref(-1)
|
|
|
const subjectStudentAbnormal = ref<any[]>([])
|
|
|
@@ -476,6 +478,7 @@ const AbnormalChanage = (type: number) => {
|
|
|
currentIndex.value=0;
|
|
|
currentItem.value=positionData.value.pendingList[currentIndex.value];//当前学生数据
|
|
|
currentPaperList.value=currentItem.value.scanPictureVOS || [];//试卷图片列表
|
|
|
+ console.log('试卷图片列表',currentPaperList.value)
|
|
|
currentPaperUrl.value=currentPaperList.value[0].recognizeUrl;//当前图片地址
|
|
|
}
|
|
|
}
|
|
|
@@ -579,6 +582,69 @@ const MarkBlankPage = () => {
|
|
|
const SavePositionImage = () => {
|
|
|
// TODO: 提交 sourcePoints 和 targetPoints 到后端
|
|
|
console.log('保存定位')
|
|
|
+
|
|
|
+ if(currentPaperList.value.length==0)
|
|
|
+ {
|
|
|
+ ElMessage.error('没有定位异常哦!');
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("打印当前的模板页",currentTemplateList.value);
|
|
|
+ console.log("打印当前的模板页码",currentTemplatePageIndex.value);
|
|
|
+ console.log("打印当前currentPaperList",currentPaperList.value);
|
|
|
+ console.log("打印当前图片的地址",currentPaperUrl.value);
|
|
|
+ console.log("打印当前currentPaperNumber",currentPaperIndex.value);
|
|
|
+ console.log("打印当前的系统卡类型",usedCardType.value);
|
|
|
+
|
|
|
+ let hasError = false;
|
|
|
+ currentPaperList.value.forEach((item,index) => {
|
|
|
+ console.log("打印当前图片的索引",item);
|
|
|
+ if(index==currentPaperIndex.value)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(usedCardType.value==1)
|
|
|
+ {
|
|
|
+ //系统卡 需要把两个点转成4个点
|
|
|
+ item.sourcePoints=sourcePoints.value;//模板上的四个点的坐标
|
|
|
+ item.targetPoints=targetPoints.value;//坐标位置 左上 右上 右下 左下
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.sourcePoints=sourcePoints.value;//模板上的四个点的坐标
|
|
|
+ item.targetPoints=targetPoints.value;//学生图片上的四个点的坐标
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.targetPoints.length==0)
|
|
|
+ {
|
|
|
+ //定位点未设置 不可保存
|
|
|
+ ElMessage.error('请选择定位点!');
|
|
|
+ hasError = true;
|
|
|
+ return; //跳出当前循环
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ item.pageNo=currentTemplatePageIndex.value;
|
|
|
+ item.rotate=rotationAngle.value;//旋转角度
|
|
|
+ currentImagePageNo.value=item.pageNo;
|
|
|
+ console.log("打印当前的图片页码",currentImagePageNo);
|
|
|
+ item.isSave=true;//增加是否处理保存图片页码的标识
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if(hasError) {
|
|
|
+ return; //如果有错误,不执行后续的保存成功提示
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("打印保存后currentPaperList",currentPaperList.value);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ console.log("打印保存后currentPaperList",currentPaperList.value);
|
|
|
+ ElMessage.success('保存成功');
|
|
|
}
|
|
|
|
|
|
// 12. 底部缩略图切换
|
|
|
@@ -664,14 +730,131 @@ const GetPositionSelNumber = (row: any) => {
|
|
|
return row.batchNo || '-'
|
|
|
}
|
|
|
|
|
|
-// 16. 重新切割 (定位异常)
|
|
|
-const ReCutPaper = () => {
|
|
|
- reCutLoading.value = true
|
|
|
- // TODO: 调用重新切割接口
|
|
|
- setTimeout(() => {
|
|
|
- reCutLoading.value = false
|
|
|
- ElMessage.success('切割成功')
|
|
|
- }, 1000)
|
|
|
+// 16. 重新识别 (定位异常)
|
|
|
+const ReCutPaper = async () => {
|
|
|
+
|
|
|
+
|
|
|
+ // if(currentPaperList.value.length==0)
|
|
|
+ // {
|
|
|
+ // ElMessage.error('没有定位异常哦!');
|
|
|
+ return
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 先判断是否图片都做过校正对应处理
|
|
|
+ const unsavedItems = currentPaperList.value.filter(item => !item.isSave);
|
|
|
+ console.log("打印未保存的图片", unsavedItems);
|
|
|
+ if (unsavedItems.length > 0) {
|
|
|
+ // 提取未保存图片的索引信息(索引+1)
|
|
|
+ const indices = unsavedItems.map(item => {
|
|
|
+ const index = currentPaperList.value.indexOf(item);
|
|
|
+ return index + 1; // 索引从0开始,显示时加1
|
|
|
+ }).join('、');
|
|
|
+ ElMessage.error(`请给第${indices}张图片设置对应的模板页码!`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let pictures=[];
|
|
|
+ let templatePageList=[];
|
|
|
+ console.log("打印当前卡类型",usedCardType.value);
|
|
|
+ console.log("打印当前的卡类型",currentPaperList.value);
|
|
|
+ currentPaperList.value.forEach(item => {
|
|
|
+
|
|
|
+ let sourcePoints= [];
|
|
|
+ let targetPoints= [];
|
|
|
+ if(item.pageNo!=-1)
|
|
|
+ {
|
|
|
+ sourcePoints= item.sourcePoints.map(point => [point.x, point.y]);
|
|
|
+ targetPoints= item.targetPoints.map(point => [point.x, point.y]);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sourcePoints= [[0,0],[0,0],[0,0],[0,0]];
|
|
|
+ targetPoints= [[0,0],[0,0],[0,0],[0,0]];
|
|
|
+ }
|
|
|
+ if(usedCardType.value==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ //三方卡 需要把四个点转成两个点
|
|
|
+
|
|
|
+
|
|
|
+ console.log("打印三方卡的定位坐标",sourcePoints,targetPoints);
|
|
|
+ if(item.pageNo==-1)
|
|
|
+ {
|
|
|
+ sourcePoints=[[0,0],[0,0]];
|
|
|
+ targetPoints=[[0,0],[0,0]];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ console.log("打印当前三方卡的定位坐标",item.sourcePoints,item.targetPoints);
|
|
|
+ sourcePoints=[];
|
|
|
+ sourcePoints.push([item.sourcePoints[0].x,item.sourcePoints[0].y]);
|
|
|
+ sourcePoints.push([item.sourcePoints[2].x,item.sourcePoints[2].y]);
|
|
|
+ targetPoints=[];
|
|
|
+ targetPoints.push([item.targetPoints[0].x,item.targetPoints[0].y]);
|
|
|
+ targetPoints.push([item.targetPoints[2].x,item.targetPoints[2].y]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ pictures.push({
|
|
|
+ picId:item.id,//图片id
|
|
|
+ pageNo:item.pageNo,//图标页码
|
|
|
+ rotate:item.rotate,//旋转角度
|
|
|
+ sourcePoints:sourcePoints,//模板上的四个点的坐标
|
|
|
+ targetPoints:targetPoints,//学生图片上的四个点的坐标
|
|
|
+ });
|
|
|
+ let obj={
|
|
|
+ pageNo:item.pageNo,
|
|
|
+ sourcePoints:item.sourcePoints,//模板上的四个点的坐标
|
|
|
+ targetPoints:item.targetPoints,//学生图片上的四个点的坐标
|
|
|
+ };
|
|
|
+ templatePageList.push(obj)
|
|
|
+ });
|
|
|
+
|
|
|
+ // 注意:templatePageList 需要在组件中定义为响应式变量
|
|
|
+ // const templatePageList = ref<any[]>([])
|
|
|
+ // paperSchema 也需要定义
|
|
|
+ // const paperSchema = ref(1) // 1-单面 2-双面
|
|
|
+
|
|
|
+ let param={
|
|
|
+ examSubjectId:examSubjectId.value,
|
|
|
+ schema:paperSchema.value,//双面扫描 1-单面 2-双面
|
|
|
+ pictures:pictures,//图片列表集合 图片id picId 图片页码 pageNo
|
|
|
+ };
|
|
|
+
|
|
|
+ reCutLoading.value=true;//重新识别loading
|
|
|
+ reCutText.value='识别中,请稍候...';
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 注意:需要在 API 文件中添加 reRecognizePosition 方法
|
|
|
+ // import { reRecognizePosition } from '@/api/exam'
|
|
|
+ const res = await reRecognizePosition(param);
|
|
|
+
|
|
|
+ reCutLoading.value=false;//重新识别loading
|
|
|
+ reCutText.value='重新识别';
|
|
|
+
|
|
|
+ if(res.code==200)
|
|
|
+ {
|
|
|
+
|
|
|
+ console.log("重新识别结果",res);
|
|
|
+ ElMessage.success('重新识别成功!');
|
|
|
+ currentPaperUrl.value='';
|
|
|
+ GetAbnormalList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ElMessage.error(res.msg);
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ reCutLoading.value=false;
|
|
|
+ reCutText.value='重新识别';
|
|
|
+ ElMessage.error('重新识别失败');
|
|
|
+ console.error('重新识别错误:', error);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 17. 删除当前试卷
|