|
|
@@ -8,6 +8,7 @@
|
|
|
<i class="iconfont icon_open"></i>已打开</span>
|
|
|
<span class="scan_state_close" v-else>
|
|
|
<i class="iconfont icon_close"></i>未打开</span>
|
|
|
+ <span v-if="scanClientStates" class="scan_state_title" style="color: #999;">(当前客户端版本:{{scanClientVersion}})</span>
|
|
|
<!-- <el-select v-model="params.batchNo" placeholder="选择批次" @change="GoSearch()" class="select_width" >
|
|
|
<el-option label="全部批次" value=""></el-option>
|
|
|
<el-option v-for="item in batchList"
|
|
|
@@ -42,30 +43,43 @@
|
|
|
<div class="content_table">
|
|
|
<div class="page_table">
|
|
|
<el-table :data="tableData" style="width: 100%" :height="tableHeight">
|
|
|
- <el-table-column prop="questionName" label="序号" width="100" align="center" >
|
|
|
+ <!-- <el-table-column prop="questionName" label="序号" width="100" align="center" >
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column prop="batchNo" label="批次" width="120" align="center">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="questionType" label="批次" width="120" align="center">
|
|
|
+ <el-table-column prop="scannedPaperNum" label="扫描张数" align="center">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="questionType" label="考号" width="120" align="center">
|
|
|
+ <el-table-column prop="uploadNum" label="待上传张数" align="center" >
|
|
|
+ <template v-slot="scope">
|
|
|
+
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="date" label="客观题" align="center">
|
|
|
+ <el-table-column prop="uploadNum" label="已上传张数" align="center" >
|
|
|
<template v-slot="scope">
|
|
|
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="fullScore" label="状态" width="120" align="center">
|
|
|
+ <el-table-column prop="scanUserName" label="扫描人" align="center" >
|
|
|
<template v-slot="scope">
|
|
|
- <div class="full_mark_input">
|
|
|
- <el-input v-model="scope.row.fullScore" maxlength="3" @input="(val: any) => onScoreInput(scope.row, 'fullScore', val)"></el-input>
|
|
|
- </div>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="scanUserName" label="扫描时间" align="center">
|
|
|
+ <template v-slot="scope">
|
|
|
+ {{formatTimestamp(scope.row.scannedTime) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="操作" width="150" align="center">
|
|
|
+ <el-table-column prop="name" label="操作" width="250" align="center">
|
|
|
<template v-slot="scope">
|
|
|
- <div class="ele_button table_row_button">
|
|
|
- <span class="btn_editor">编辑</span>
|
|
|
- <span class="btn_delete" @click="DeleteSingle(scope.row)">删除</span>
|
|
|
+ <div class="ele_button table_row_button" v-if="scope.row.uploadStatus==0">
|
|
|
+ <i class="el-icon-loading"></i>{{loadingText}}……
|
|
|
+ </div>
|
|
|
+ <div class="ele_button table_row_button" v-else>
|
|
|
+ <span class="btn_editor">详情</span>
|
|
|
+ <span class="btn_delete" v-if="scope.row.scanUserName==currentUserName " @click="OptionDelete(scope.row)">删除</span>
|
|
|
+ <span class="editor_disable" v-else>删除</span>
|
|
|
</div>
|
|
|
+
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -143,16 +157,19 @@
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import { useExamStore } from '@/store/exam'
|
|
|
+import { useUserStore } from '@/store/user'
|
|
|
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 { hasImportStudent,getBatchList } from '@/api/exam'
|
|
|
+import { hasImportStudent,getBatchList,getCurrentBatchNo,deleteBatch } from '@/api/exam'
|
|
|
import scanCommon from '@/utils/scanCommon';
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus'
|
|
|
-
|
|
|
+import { formatTimestamp } from '@/utils/common';
|
|
|
// 实例化 Store
|
|
|
const examStore = useExamStore()
|
|
|
+const userStore = useUserStore()
|
|
|
+
|
|
|
const router = useRouter()
|
|
|
|
|
|
// 考试科目 ID
|
|
|
@@ -160,15 +177,33 @@ const examSubjectId = computed(() => {
|
|
|
return examStore.currentExam?.id
|
|
|
})//计算属性
|
|
|
|
|
|
+//考试科目code
|
|
|
+const examSubjectCode=computed(() => {
|
|
|
+ return examStore.currentExam?.examSubjectCode
|
|
|
+})
|
|
|
+//当前登录人姓名
|
|
|
+const currentUserName=computed(() => {
|
|
|
+ return userStore.userName;
|
|
|
+})
|
|
|
+
|
|
|
+const selectSchoolId=ref(0);//学校ID
|
|
|
+
|
|
|
const params=ref({
|
|
|
batchNo:'',
|
|
|
keyWord:''
|
|
|
})
|
|
|
|
|
|
-const batchList=ref([]);//批次列表
|
|
|
-const listMode=ref('list');
|
|
|
const scanClientStates=ref(false);//客户端状态
|
|
|
-const tableData=ref([]);
|
|
|
+const scanClientVersion=ref('');//客户端版本
|
|
|
+const isScanning=ref(false);//是否正在扫描 扫描状态
|
|
|
+const hasMakeTemplate=ref(false);//模版是否制作完成
|
|
|
+const currentBatchNo=ref('');//当前批次号
|
|
|
+const currentBatchNoId=ref('');//当前批次号id
|
|
|
+const loadingText=ref('');//加载文本
|
|
|
+const baseUrl=import.meta.env.VITE_API_BASE_URL;
|
|
|
+const uploadUrl=`https://dev3.k12100.net/teaching/api/v1/ai_exam_scan/upload_multi_img`;//图片上传地址
|
|
|
+
|
|
|
+const tableData=ref([]);//批次列表
|
|
|
|
|
|
const tableHeight=ref(500);
|
|
|
const scanIdentifyList=[
|
|
|
@@ -197,11 +232,75 @@ const OpenReIdentify=() => {
|
|
|
|
|
|
//开始扫描
|
|
|
const OpenScan = () => {
|
|
|
+
|
|
|
+ if(isScanning.value)
|
|
|
+ {
|
|
|
+ //正在扫描
|
|
|
+ ElMessage.warning('正在扫描中,请勿重复点击哦!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//判断客户端是否已经连接
|
|
|
if(scanClientStates.value)
|
|
|
{
|
|
|
//一打开客户端
|
|
|
console.log('客户端已打开,开始扫描');
|
|
|
+ // isScanning.value=true;//扫描状态
|
|
|
+ const params={
|
|
|
+ examSubjectId:examSubjectId.value,
|
|
|
+ schoolId:selectSchoolId.value,
|
|
|
+ };
|
|
|
+ getCurrentBatchNo(params).then((res:any)=>{
|
|
|
+ console.log("当前获取批次结果",res);
|
|
|
+ if(res.code==200)
|
|
|
+ {
|
|
|
+ currentBatchNo.value=res.data.batchNo;
|
|
|
+ currentBatchNoId.value=res.data.id;
|
|
|
+ let newData={
|
|
|
+ batchNo:currentBatchNo.value,
|
|
|
+ id:currentBatchNoId.value,//批次号
|
|
|
+ batchTypeName:'扫描',
|
|
|
+ scanUserName:currentUserName.value,
|
|
|
+ scannedPaperNum:0,//扫描张数
|
|
|
+ scannedTime:Date.now(),//扫描时间
|
|
|
+ uploadNum:0,//上传张数
|
|
|
+ uploadStatus:0,//扫描状态
|
|
|
+ };
|
|
|
+ tableData.value.push(newData);
|
|
|
+ //开始扫描
|
|
|
+ let jsonParam={
|
|
|
+ examSubjectId:examSubjectId.value,
|
|
|
+ batchNumber:currentBatchNo.value,
|
|
|
+ // sensitive: 35,//灵敏度参数 固定35
|
|
|
+ filter:0,//是否过滤参数 1-是 0-否
|
|
|
+ // heightRatio:this.heightRatio,//占打分框高度比例
|
|
|
+ schoolId:selectSchoolId.value//学校id 联校单校都需要学校id
|
|
|
+ };
|
|
|
+ let json = {
|
|
|
+ "action":"startScan",//交互指令参数
|
|
|
+ "batchNumber":GetBatchStr(res.data.id,currentBatchNo.value),//批次号 这里传给客户端的批次号需要进行处理 截取批次id后5位拼接batchNumber
|
|
|
+ "subjectCode":examSubjectCode.value,//科目编号
|
|
|
+ "paperSchema":1,//this.paperSchema,// 单双面//页面类型 1 单面 2 双面
|
|
|
+ "token":localStorage.getItem('token'),//token信息
|
|
|
+ "uploadUrl":uploadUrl, // 图片上传地址
|
|
|
+ "dpi":150,//dpi参数 设置图片清晰度质量的
|
|
|
+ "isColor":1,//是否彩色图片 手阅卡扫描彩色图片 0 黑白 1 彩色
|
|
|
+ "useDriveUI":1,//startScan和scanTemplate增加useDriveUI参数,=1时会弹框,其他值或不写则不弹
|
|
|
+ "jsonParam":JSON.stringify(jsonParam),// 后端使用的参数 json字符串 后端接口固定三个参数 1:jsonParam 2:seqNumber(这个批次的图片序号:从1开始) 3:file 图片文件
|
|
|
+ };//正式版参数
|
|
|
+ console.log("打印发送的数据",JSON.stringify(json));
|
|
|
+ setTimeout(() => {
|
|
|
+ scanCommon.send(JSON.stringify(json))
|
|
|
+ },100)
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ElMessage.error(res.msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -210,6 +309,80 @@ const OpenScan = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//获取批次字符串
|
|
|
+const GetBatchStr=(batchId:any,batChNo:any)=>{
|
|
|
+ const batchNoValue = batchId.substring(batchId.length - 5);
|
|
|
+ const batchNo=String(batChNo).padStart(3, '0');
|
|
|
+ const batchNumber=batchNoValue+batchNo;//传给客户端的图片批次号 id后五位数加上00批次号
|
|
|
+ return batchNumber;
|
|
|
+}
|
|
|
+
|
|
|
+//根据处理后的批次号转换成处理前的批次号
|
|
|
+const GetBatchNumber=(batchNumber:any)=>{
|
|
|
+ if (!batchNumber) {
|
|
|
+ console.warn('批次号为空或未定义');
|
|
|
+ return currentBatchNo.value;//返回当前的批次号
|
|
|
+ }
|
|
|
+
|
|
|
+ const batchStr = batchNumber.toString();
|
|
|
+ if (batchStr.length < 3) {
|
|
|
+ console.warn('批次号长度小于3位:', batchStr);
|
|
|
+ return currentBatchNo.value;//返回当前的批次号
|
|
|
+ }
|
|
|
+
|
|
|
+ const lastThree = batchStr.slice(-3);
|
|
|
+ const parsedNumber = parseInt(lastThree, 10);
|
|
|
+
|
|
|
+ if (isNaN(parsedNumber)) {
|
|
|
+ console.error('无法解析批次号:', lastThree);
|
|
|
+ return currentBatchNo.value;//返回当前的批次号
|
|
|
+ }
|
|
|
+ console.log("打印最后的批次号",parsedNumber);
|
|
|
+ return parsedNumber.toString();
|
|
|
+}
|
|
|
+
|
|
|
+//删除批次
|
|
|
+const OptionDelete=(row: any) => {
|
|
|
+ console.log('删除批次', row);
|
|
|
+
|
|
|
+ if(row.scanUserName==currentUserName.value)
|
|
|
+ {
|
|
|
+ ElMessageBox.confirm('确定要删除该批次吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // 删除操作
|
|
|
+ console.log('删除', row);
|
|
|
+ const params={
|
|
|
+ examSubjectId:examSubjectId.value,
|
|
|
+ batchNo:row.batchNo,
|
|
|
+ schoolId:selectSchoolId.value,
|
|
|
+ };
|
|
|
+ deleteBatch(params).then((res:any)=>{
|
|
|
+ if(res.code==200)
|
|
|
+ {
|
|
|
+ ElMessage.success("删除成功!")
|
|
|
+ GetScanBatchList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ElMessage.error(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ // 取消操作
|
|
|
+ console.log('取消删除');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ElMessage.warning('只能删除自己上传的记录');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//跳转到异常详情页
|
|
|
const GotoDetail = (type: number) => {
|
|
|
//根据类型跳转到不同的详情页
|
|
|
// switch (type) {
|
|
|
@@ -282,7 +455,8 @@ const GetScanBatchList=async()=>{
|
|
|
const res = await getBatchList(params);
|
|
|
if(res.code==200)
|
|
|
{
|
|
|
- batchList.value=res.data;
|
|
|
+ tableData.value=res.data.scannedWebSocketVO.data;
|
|
|
+ selectSchoolId.value=res.data.schoolId;//获取学校id
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -306,18 +480,227 @@ const CalculateTableHeight = () => {
|
|
|
});
|
|
|
};
|
|
|
// 处理扫描结果
|
|
|
-const HandleScanResult = (data: any) => {
|
|
|
- console.log('收到扫描数据', data);
|
|
|
+const HandleScanResult = (res: any) => {
|
|
|
+ console.log('收到扫描数据', res);
|
|
|
// 业务逻辑...
|
|
|
+ if (res.action == 'uploading') {
|
|
|
+ let batchNumber: any = '';
|
|
|
+ if (res.batchNumber)
|
|
|
+ {
|
|
|
+ batchNumber = GetBatchNumber(res.batchNumber || res.data?.batchNumber);
|
|
|
+ }
|
|
|
+ const targetItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = "启动扫描仪中";
|
|
|
+
|
|
|
+ ElMessage.success("正在启动扫描仪,请稍后…");
|
|
|
+ if (targetItem)
|
|
|
+ {
|
|
|
+ targetItem.uploadStatus = 0; //更新上传状态 0 开始上传
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'startScan') {
|
|
|
+ // 修复:直接调用 GetBatchNumber,去掉 this
|
|
|
+ let batchNumber = GetBatchNumber(res?.batchNumber || res.data?.batchNumber);
|
|
|
+ // 修复:tableData.value
|
|
|
+ let currentItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+ console.log("打印currentItem", currentItem);
|
|
|
+
|
|
|
+ //开始扫描指令
|
|
|
+ if (res.code == 200) {
|
|
|
+ ElMessage.success("扫描仪启动成功,开始扫描…");
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = "正在扫描中";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 502)
|
|
|
+ {
|
|
|
+ console.log("开始扫描指令502错误 未检测到纸张或者卡纸", res);
|
|
|
+ console.log("打印currentItem", currentItem);
|
|
|
+ if (currentItem) {
|
|
|
+ currentItem.uploadStatus = 1; //更新上传状态
|
|
|
+ }
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = ""; //清空上传提示
|
|
|
+ isScanning.value = false; //重置扫描状态
|
|
|
+ ElMessage.error(res.msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 510)
|
|
|
+ {
|
|
|
+ console.log("启动扫描失败,上传正在进行中", res);
|
|
|
+ isScanning.value = true; //重置扫描状态
|
|
|
+ ElMessage.warning(res.msg + '请勿重复点击');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 509) {
|
|
|
+ console.log("扫描仪正在使用中", res);
|
|
|
+
|
|
|
+ if (res.msg == '未找到指定的扫描仪') {
|
|
|
+ isScanning.value = false; //重置扫描状态
|
|
|
+ }
|
|
|
+
|
|
|
+ ElMessage.warning(res.msg + ',请稍后再试!');
|
|
|
+ if (currentItem) {
|
|
|
+ currentItem.uploadStatus = 1; //更新上传状态
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'uploadFinish') {
|
|
|
+ console.log("上传完成uploadFinish 更新上传动画状态", res);
|
|
|
+
|
|
|
+ // 修复:直接调用 GetBatchNumber
|
|
|
+ let batchNumber = GetBatchNumber(res?.batchNumber || res.data?.batchNumber);
|
|
|
+ let targetItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = '正在上传中';
|
|
|
+
|
|
|
+ if (targetItem) {
|
|
|
+ targetItem.scannedPaperNum = res.scanNumber; //更新扫描张数
|
|
|
+ targetItem.failedNumber = res.failedNumber; //更新失败张数
|
|
|
+
|
|
|
+ // 修复:确保 UpdateBatchScanNumber 已定义并直接调用
|
|
|
+ if (typeof UpdateBatchScanNumber === 'function') {
|
|
|
+ UpdateBatchScanNumber(targetItem.id, targetItem.scannedPaperNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ isScanning.value = false; //重置扫描状态
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'uploadNumber') {
|
|
|
+ console.log("上传完成uploadNumber 更新上传张数", res);
|
|
|
+ // 逻辑已注释,保持原样
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'scanNumber') {
|
|
|
+ console.log("扫描张数scanNumber 更新扫描张数");
|
|
|
+ // 修复:直接调用 GetBatchNumber
|
|
|
+ let batchNumber = GetBatchNumber(res.batchNumber || res.data?.batchNumber);
|
|
|
+ let targetItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+ console.log("打印targetItem", targetItem);
|
|
|
+
|
|
|
+ if (targetItem) {
|
|
|
+ targetItem.scannedPaperNum = res.number; //更新上传张数
|
|
|
+ targetItem.uploadStatus = 0; //更新上传状态 0 开始上传
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修复:确保 UpdateBatchScanNumber 已定义
|
|
|
+ if (targetItem && typeof UpdateBatchScanNumber === 'function') {
|
|
|
+ UpdateBatchScanNumber(targetItem.id, targetItem.scannedPaperNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'loadImage') {
|
|
|
+ console.log("加载图片loadImage 获取图片数据", res);
|
|
|
+
|
|
|
+ // 修复:reImageList 必须是 ref
|
|
|
+ if (typeof reImageList !== 'undefined') {
|
|
|
+ reImageList.value = res.data || [];
|
|
|
+ reImageList.value.forEach((item: any) => {
|
|
|
+ item.uploadStatus = -2;
|
|
|
+ item.uploadProgress = 0;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ let batchNumber = GetBatchNumber(res.batchNumber);
|
|
|
+ let targetItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+
|
|
|
+ console.log("打印重新上传图片列表", reImageList.value);
|
|
|
+ console.log("打印重新上传的批次Item", targetItem);
|
|
|
+
|
|
|
+ if (targetItem) {
|
|
|
+ targetItem.uploadStatus = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = '正在上传中';
|
|
|
+ if (typeof uploadDialogTitle !== 'undefined') uploadDialogTitle.value = '未上传的图片';
|
|
|
+ if (typeof showUploadDialog !== 'undefined') showUploadDialog.value = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'finish') {
|
|
|
+ console.log("图片重传finish指令", res);
|
|
|
+
|
|
|
+ let batchNumber = GetBatchNumber(res.batchNumber);
|
|
|
+ let targetItem = tableData.value.find((item: any) => item.batchNo == batchNumber);
|
|
|
+
|
|
|
+ let fileIndex = res.fileIndex.split(",");
|
|
|
+ console.log("打印fileIndex", fileIndex);
|
|
|
+
|
|
|
+ fileIndex.forEach((index: string) => {
|
|
|
+ // 修复:reImageList.value
|
|
|
+ let reImageItem = reImageList.value.find((item: any) => item.fileIndex == index);
|
|
|
+ if (reImageItem) {
|
|
|
+ let progress = reImageItem.uploadProgress;
|
|
|
+ const interval = setInterval(() => {
|
|
|
+ progress += 5;
|
|
|
+ if (progress >= 100) {
|
|
|
+ progress = 100;
|
|
|
+ clearInterval(interval);
|
|
|
+ // 修复:Vue3 不需要 $set,直接赋值即可触发响应式
|
|
|
+ reImageItem.uploadStatus = res.uploadState;
|
|
|
+ }
|
|
|
+ reImageItem.uploadProgress = progress;
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 修复:reImageCount 可能是 ref 或计算属性
|
|
|
+ let currentReImageCount = typeof reImageCount !== 'undefined' ? reImageCount.value : reImageList.value.length;
|
|
|
+
|
|
|
+ if (currentReImageCount === 0) {
|
|
|
+ if (typeof showUploadDialog !== 'undefined') showUploadDialog.value = false;
|
|
|
+ if (targetItem) {
|
|
|
+ targetItem.uploadStatus = 1;
|
|
|
+ isScanning.value = false;
|
|
|
+ // 修复:确保 GetBatchList 已定义
|
|
|
+ if (typeof GetBatchList === 'function') GetBatchList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'getFailedImage') {
|
|
|
+ console.log("获取失败图片getFailedImage", res);
|
|
|
+ let failedList = res.data || [];
|
|
|
+
|
|
|
+ failedList.forEach((item: any) => {
|
|
|
+ let batchNumber = GetBatchNumber(item.batchNumber);
|
|
|
+ let currentItem = tableData.value.find((item1: any) => item1.batchNo == batchNumber);
|
|
|
+
|
|
|
+ if (currentItem) {
|
|
|
+ if (item.failedNumber == 0) {
|
|
|
+ if (currentItem.scannedPaperNum != currentItem.uploadNum) {
|
|
|
+ currentItem.scannedPaperNum = currentItem.uploadNum;
|
|
|
+ if (typeof UpdateBatchScanNumber === 'function') {
|
|
|
+ UpdateBatchScanNumber(currentItem.id, currentItem.uploadNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let number = currentItem.uploadNum + item.failedNumber;
|
|
|
+ currentItem.scannedPaperNum = number;
|
|
|
+ if (typeof UpdateBatchScanNumber === 'function') {
|
|
|
+ UpdateBatchScanNumber(currentItem.id, number);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.action == 'scanFinishBatch') {
|
|
|
+ if (typeof loadingText !== 'undefined') loadingText.value = '本次扫描结束';
|
|
|
+ console.log("本批次扫描完成scanFinishBatch 更新扫描张数", res);
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- // 1. 初始化连接
|
|
|
+ // 初始化连接
|
|
|
scanCommon.init(HandleScanResult);
|
|
|
- // 2. 监听连接状态(可选)
|
|
|
- scanCommon.watchConnection((isOnline) => {
|
|
|
+ // 监听连接状态
|
|
|
+ scanCommon.watchConnection((isOnline,clientVersion) => {
|
|
|
console.log('连接状态:', isOnline ? '在线' : '离线');
|
|
|
scanClientStates.value=isOnline;
|
|
|
+ scanClientVersion.value=clientVersion; //客户端版本号
|
|
|
+ console.log("客户端版本",clientVersion);
|
|
|
});
|
|
|
if (!examStore.currentExam) {
|
|
|
console.warn('当前没有选中的考试信息')
|
|
|
@@ -325,8 +708,7 @@ onMounted(() => {
|
|
|
}
|
|
|
HasImportStudent();//查询是否导入了学生名单
|
|
|
GetScanBatchList();//获取扫描批次列表
|
|
|
- // 初始化计算
|
|
|
- CalculateTableHeight();
|
|
|
+ CalculateTableHeight();//初始化计算表格高度
|
|
|
|
|
|
// 监听窗口大小变化
|
|
|
window.addEventListener('resize', CalculateTableHeight);
|