|
@@ -1,51 +1,52 @@
|
|
|
<template>
|
|
|
- <div class="group-scan">
|
|
|
- <div class="home-header">
|
|
|
- <div class="head-logo">
|
|
|
- <h1>试卷采集</h1>
|
|
|
+ <div class="group-scan scan">
|
|
|
+ <div
|
|
|
+ class="scan-task task-list"
|
|
|
+ id="task-list"
|
|
|
+ v-if="studentSerialList.length"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(student, index) in studentSerialList"
|
|
|
+ :key="index"
|
|
|
+ :class="[
|
|
|
+ 'task-item',
|
|
|
+ {
|
|
|
+ 'task-current': student.isCurrent,
|
|
|
+ 'task-over': student.isClient
|
|
|
+ }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <span>{{ student.name }}</span>
|
|
|
+ <span>{{ student.examNumber }}</span>
|
|
|
</div>
|
|
|
- <div class="head-back">
|
|
|
- <i-button type="default" @click="goBack"
|
|
|
- ><i class="icon-font icon-left"></i>返回</i-button
|
|
|
+ <div class="scan-task-action">
|
|
|
+ <Button type="primary" @click="scanOver" :disabled="holding"
|
|
|
+ >扫描完毕</Button
|
|
|
>
|
|
|
+ <Button type="primary" @click="allReScan">整包重扫</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="home-body">
|
|
|
- <div class="home-main home-main-split">
|
|
|
- <div
|
|
|
- class="scan-list student-list"
|
|
|
- id="student-list"
|
|
|
- v-if="studentSerialList.length"
|
|
|
- >
|
|
|
- <div
|
|
|
- v-for="(student, index) in studentSerialList"
|
|
|
- :key="index"
|
|
|
- :class="[
|
|
|
- 'student-item',
|
|
|
- {
|
|
|
- 'student-current': student.isCurrent,
|
|
|
- 'student-over': student.isClient
|
|
|
- }
|
|
|
- ]"
|
|
|
- >
|
|
|
- <span>{{ student.name }}</span>
|
|
|
- <span>{{ student.examNumber }}</span>
|
|
|
- </div>
|
|
|
- <div class="scan-btns">
|
|
|
- <i-button type="primary" @click="scanOver" :disabled="holding"
|
|
|
- >扫描完毕</i-button
|
|
|
- >
|
|
|
- <i-button type="primary" @click="allReScan">整包重扫</i-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="scan-image">
|
|
|
- <div class="scan-main scan-waiting" v-if="isWaiting">
|
|
|
- <p class="scan-waiting-icon"></p>
|
|
|
- <p class="scan-waiting-tips">等待采集试卷</p>
|
|
|
- </div>
|
|
|
- <div class="scan-main scan-picture" v-else>
|
|
|
- <img class="img-contain" :src="curImage.url" :alt="curImage.name" />
|
|
|
- </div>
|
|
|
+ <div class="scan-image">
|
|
|
+ <div class="scan-main scan-waiting" v-if="isWaiting">
|
|
|
+ <p class="scan-waiting-icon"></p>
|
|
|
+ <p class="scan-waiting-tips">等待采集试卷</p>
|
|
|
+ </div>
|
|
|
+ <div class="scan-main scan-picture" v-else>
|
|
|
+ <img class="img-contain" :src="curImage.url" :alt="curImage.name" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="scan-history">
|
|
|
+ <div
|
|
|
+ class="history-item"
|
|
|
+ v-for="(task, tindex) in historyList"
|
|
|
+ :key="tindex"
|
|
|
+ >
|
|
|
+ <p class="history-item-title">
|
|
|
+ <span>{{ task.name }}</span
|
|
|
+ ><span>{{ task.examNumber }}</span>
|
|
|
+ </p>
|
|
|
+ <div class="history-item-body">
|
|
|
+ <img :src="task.url" :alt="task.name" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -75,9 +76,9 @@ import { getStudentGroupByExamNumber } from "../api";
|
|
|
import {
|
|
|
decodeImageCode,
|
|
|
getEarliestFile,
|
|
|
- saveFormalImage
|
|
|
+ saveOutputImage
|
|
|
} from "../../../plugins/imageOcr";
|
|
|
-import { formatDate } from "../../../plugins/utils";
|
|
|
+import { deepCopy } from "../../../plugins/utils";
|
|
|
import ScanAreaDialog from "../components/ScanAreaDialog";
|
|
|
import ScanExceptionDialog from "../components/ScanExceptionDialog";
|
|
|
|
|
@@ -94,6 +95,27 @@ export default {
|
|
|
showAction: true,
|
|
|
message: ""
|
|
|
},
|
|
|
+ historyLimit: 30,
|
|
|
+ historyList: [
|
|
|
+ {
|
|
|
+ name: "张一二三",
|
|
|
+ examNumber: "1901040084",
|
|
|
+ url:
|
|
|
+ "http://127.0.0.1:9000/api/file/image/download/31/1/734/1?random=676176fc-24cd-407a-a7bc-fabc49bd2dbc"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "张一二三",
|
|
|
+ examNumber: "1901040084",
|
|
|
+ url:
|
|
|
+ "http://127.0.0.1:9000/api/file/image/download/31/1/733/1?random=e2966291-ffba-4b19-985d-0cad9ae1b75b"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "张一二三",
|
|
|
+ examNumber: "1901040084",
|
|
|
+ url:
|
|
|
+ "http://127.0.0.1:9000/api/file/image/download/31/1/731/1?random=b305c27c-76d0-4477-a1ef-c9b8554a4671"
|
|
|
+ }
|
|
|
+ ],
|
|
|
setT: "",
|
|
|
holding: false,
|
|
|
curImage: {
|
|
@@ -129,8 +151,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ if (!this.curSubject || !this.curSubject.collectConfig) {
|
|
|
+ this.$Message.error("请先完成采集设置!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
// this.getInitFile();
|
|
|
- this.test();
|
|
|
+ // this.test();
|
|
|
},
|
|
|
methods: {
|
|
|
async test() {
|
|
@@ -182,7 +208,8 @@ export default {
|
|
|
if (this.setT) clearTimeout(this.setT);
|
|
|
return;
|
|
|
}
|
|
|
- this.curImage = getEarliestFile();
|
|
|
+
|
|
|
+ this.curImage = getEarliestFile(this.GLOBAL.input);
|
|
|
|
|
|
if (this.curImage.url) {
|
|
|
if (this.setT) clearTimeout(this.setT);
|
|
@@ -213,7 +240,6 @@ export default {
|
|
|
codeArea
|
|
|
).catch(error => {
|
|
|
const content = `图像:${this.curImage.name},解析错误,错误信息:${error}`;
|
|
|
-
|
|
|
this.$Notice.error({ title: "错误提示", desc: content, duration: 0 });
|
|
|
});
|
|
|
|
|
@@ -246,7 +272,9 @@ export default {
|
|
|
async checkStudentValid(examNumber) {
|
|
|
let validInfo = { valid: true, message: "" };
|
|
|
if (!this.students.length) {
|
|
|
- const students = await getStudentGroupByExamNumber(examNumber);
|
|
|
+ const students = await getStudentGroupByExamNumber(
|
|
|
+ examNumber
|
|
|
+ ).catch(() => {});
|
|
|
if (students && students.length) {
|
|
|
this.students = students.map(item => {
|
|
|
return {
|
|
@@ -271,6 +299,7 @@ export default {
|
|
|
this.curStudent = this.students.find(
|
|
|
item => item.examNumber === examNumber
|
|
|
);
|
|
|
+ // 当前组的第一位考生必定是当前组,但第二位考生则不一定是当前组。
|
|
|
if (!this.curStudent) {
|
|
|
validInfo = {
|
|
|
valid: false,
|
|
@@ -278,11 +307,12 @@ export default {
|
|
|
};
|
|
|
} else {
|
|
|
this.curStudent.isCurrent = true;
|
|
|
+ this.curStudent.imgPath = this.curImage.url;
|
|
|
}
|
|
|
return validInfo;
|
|
|
},
|
|
|
async toSaveStudent(examNumber, type) {
|
|
|
- const outputFile = await saveFormalImage(
|
|
|
+ const result = await saveOutputImage(
|
|
|
this.curImage.url,
|
|
|
{
|
|
|
workId: this.user.workId,
|
|
@@ -292,16 +322,18 @@ export default {
|
|
|
this.getCurCollectConfig()
|
|
|
).catch(error => {
|
|
|
const content = `${this.curStudent.name}的试卷保存失败,请重新扫描!`;
|
|
|
-
|
|
|
this.$Notice.error({ title: "错误提示", desc: content, duration: 5 });
|
|
|
});
|
|
|
|
|
|
- if (outputFile) {
|
|
|
+ if (result) {
|
|
|
this.curStudent = Object.assign(this.curStudent, {
|
|
|
isCurrent: false,
|
|
|
isClient: true,
|
|
|
+ formalImgPath: result.outputFormalPath,
|
|
|
+ sliceImgPath: result.outputSlicelPath,
|
|
|
isManual: type === "MANUAL"
|
|
|
});
|
|
|
+ this.updateHistory(this.curStudent);
|
|
|
}
|
|
|
// 删除扫描文件,继续开始下一个任务
|
|
|
fs.unlinkSync(this.curImage.url);
|
|
@@ -314,7 +346,7 @@ export default {
|
|
|
if (this.holding) return;
|
|
|
this.holding = true;
|
|
|
if (!this.checkAllStudentIsClient()) {
|
|
|
- this.$Message.error("当前考场试卷没有扫完!");
|
|
|
+ this.$Message.error("当前整包试卷没有扫描完毕!");
|
|
|
this.holding = false;
|
|
|
return;
|
|
|
}
|
|
@@ -322,19 +354,21 @@ export default {
|
|
|
for (let i = 0, len = this.students.length; i < len; i++) {
|
|
|
const curStudent = this.students[i];
|
|
|
await this.$parent.addUploadTask({
|
|
|
- workId: this.user.workId,
|
|
|
- workName: this.user.workName,
|
|
|
+ id: null,
|
|
|
+ examId: this.user.examId,
|
|
|
+ examName: this.user.examName,
|
|
|
subjectId: this.curSubject.id,
|
|
|
subjectName: this.curSubject.name,
|
|
|
examNumber: curStudent.examNumber,
|
|
|
studentName: curStudent.name,
|
|
|
siteCode: curStudent.siteCode,
|
|
|
roomCode: curStudent.roomCode,
|
|
|
- createdTime: formatDate(),
|
|
|
+ formalImgPath: curStudent.formalImgPath,
|
|
|
+ sliceImgPath: curStudent.sliceImgPath,
|
|
|
isManual: curStudent.isManual,
|
|
|
clientUserId: this.user.id,
|
|
|
clientUsername: this.user.name,
|
|
|
- clientUserLoginTime: this.user.clientUserLoginTime
|
|
|
+ clientUserLoginTime: this.user.loginTime
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -347,6 +381,14 @@ export default {
|
|
|
getCurCollectConfig() {
|
|
|
return this.curStudent.collectConfig || this.curSubject.collectConfig;
|
|
|
},
|
|
|
+ // history
|
|
|
+ updateHistory(curStudent) {
|
|
|
+ const student = deepCopy(curStudent);
|
|
|
+ if (this.historyList.length >= this.historyLimit) {
|
|
|
+ this.historyList.pop();
|
|
|
+ }
|
|
|
+ this.historyList.unshift(student);
|
|
|
+ },
|
|
|
// scan-exception
|
|
|
resetConfig() {
|
|
|
this.curCollectConfig = this.getCurCollectConfig();
|