|
@@ -108,6 +108,8 @@ import { deepCopy } from "../../../plugins/utils";
|
|
|
import ScanAreaDialog from "../components/ScanAreaDialog";
|
|
|
import ScanExceptionDialog from "../components/ScanExceptionDialog";
|
|
|
import { mapState, mapActions } from "vuex";
|
|
|
+import log4js from "@/plugins/logger";
|
|
|
+const logger = log4js.getLogger("scan");
|
|
|
|
|
|
const fs = require("fs");
|
|
|
const { ipcRenderer } = require("electron");
|
|
@@ -272,6 +274,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
async startDecodeTask(codeArea) {
|
|
|
+ logger.info(`01开始采集:${this.curImage.name}`);
|
|
|
const examNumber = await decodeImageCode(
|
|
|
this.curImage.url,
|
|
|
codeArea
|
|
@@ -281,8 +284,10 @@ export default {
|
|
|
});
|
|
|
|
|
|
if (examNumber) {
|
|
|
+ logger.info(`02解析成功:${examNumber}`);
|
|
|
this.examNumberValid(examNumber);
|
|
|
} else {
|
|
|
+ logger.error(`02解析失败:该图片无法识别!`);
|
|
|
// 未解析到考号异常
|
|
|
this.curException = {
|
|
|
showAction: true,
|
|
@@ -296,8 +301,10 @@ export default {
|
|
|
const validRes = await this.checkStudentValid(examNumber);
|
|
|
if (validRes.valid) {
|
|
|
// 保存扫描到的试卷
|
|
|
+ logger.info(`03考号校验合法:[${type}] ${examNumber}`);
|
|
|
this.toSaveStudent(examNumber, type);
|
|
|
} else {
|
|
|
+ logger.error(`03考号校验不合法:[${type}] ${validRes.message}`);
|
|
|
// 考号不合法异常
|
|
|
this.curException = {
|
|
|
showAction: false,
|
|
@@ -362,10 +369,14 @@ export default {
|
|
|
this.getCurCollectConfig()
|
|
|
).catch(error => {
|
|
|
const content = `${this.curStudent.name}的试卷保存失败,请重新扫描!`;
|
|
|
+ logger.errro(`04保存试卷失败:${this.curStudent.name}`);
|
|
|
this.$Notice.error({ title: "错误提示", desc: content, duration: 0 });
|
|
|
});
|
|
|
|
|
|
if (result) {
|
|
|
+ logger.info(
|
|
|
+ `04保存试卷成功:${this.curStudent.examNumber} - ${this.curStudent.name}`
|
|
|
+ );
|
|
|
this.curStudent = Object.assign(this.curStudent, {
|
|
|
isCurrent: false,
|
|
|
isClient: true,
|
|
@@ -380,6 +391,7 @@ export default {
|
|
|
// 更新采集数
|
|
|
this.updateScanList(this.curStudent.examNumber);
|
|
|
}
|
|
|
+ logger.info(`05采集结束:${this.curImage.name}`);
|
|
|
// 删除扫描文件,继续开始下一个任务
|
|
|
fs.unlinkSync(this.curImage.url);
|
|
|
this.scrollTaskList();
|
|
@@ -396,6 +408,7 @@ export default {
|
|
|
this.holding = false;
|
|
|
return;
|
|
|
}
|
|
|
+ logger.info(`09-01整包数据开始保存`);
|
|
|
// 添加上传任务
|
|
|
for (let i = 0, len = this.students.length; i < len; i++) {
|
|
|
const curStudent = this.students[i];
|
|
@@ -421,6 +434,7 @@ export default {
|
|
|
clientUserLoginTime: this.user.loginTime
|
|
|
});
|
|
|
}
|
|
|
+ logger.info(`09-02整包数据保存完毕,扫描结束!`);
|
|
|
|
|
|
this.scanList = [];
|
|
|
this.students = [];
|
|
@@ -428,6 +442,7 @@ export default {
|
|
|
this.restartInitFile();
|
|
|
},
|
|
|
allReScan() {
|
|
|
+ logger.warn(`00整包重扫!`);
|
|
|
this.$Modal.confirm({
|
|
|
content: "确定要整包重扫吗?",
|
|
|
onOk: () => {
|
|
@@ -475,6 +490,7 @@ export default {
|
|
|
},
|
|
|
// scan-exception
|
|
|
resetConfig() {
|
|
|
+ logger.info(`重新设置采集区域:${this.curImage.name}`);
|
|
|
this.curCollectConfig = this.getCurCollectConfig();
|
|
|
this.$refs.ScanAreaDialog.open();
|
|
|
},
|