|
@@ -76,6 +76,8 @@ import {
|
|
|
import setTimeMixins from "../../../mixins/setTimeMixins";
|
|
|
import db from "../../../plugins/db";
|
|
|
import { evokeScanner } from "../../../plugins/scanner";
|
|
|
+import log4js from "@/plugins/logger";
|
|
|
+const logger = log4js.getLogger("scan");
|
|
|
|
|
|
export default {
|
|
|
name: "scan-task-dialog",
|
|
@@ -127,11 +129,13 @@ export default {
|
|
|
this.realScanCount = 0;
|
|
|
},
|
|
|
visibleChange() {
|
|
|
+ logger.info(`00进入扫描`);
|
|
|
this.initData();
|
|
|
},
|
|
|
close() {
|
|
|
this.modalIsShow = false;
|
|
|
this.$emit("on-close");
|
|
|
+ logger.info(`99退出扫描`);
|
|
|
},
|
|
|
open() {
|
|
|
this.modalIsShow = true;
|
|
@@ -159,7 +163,7 @@ export default {
|
|
|
userId: this.user.id
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ logger.info(`01开始扫描`);
|
|
|
this.scaningImageList = [];
|
|
|
this.scanStatus = "START";
|
|
|
this.getInitFile();
|
|
@@ -167,26 +171,28 @@ export default {
|
|
|
this.evokeScanExe();
|
|
|
},
|
|
|
async continueTask() {
|
|
|
+ logger.info(`01继续扫描`);
|
|
|
this.scanStatus = "START";
|
|
|
this.getInitFile();
|
|
|
|
|
|
this.evokeScanExe();
|
|
|
},
|
|
|
async evokeScanExe() {
|
|
|
- console.log("唤起扫描仪");
|
|
|
+ logger.info("02唤起扫描仪");
|
|
|
// console.log(commandStr);
|
|
|
await evokeScanner(this.GLOBAL.input).catch(error => {
|
|
|
console.error(error);
|
|
|
});
|
|
|
- console.log("扫描仪停止");
|
|
|
this.scanStatus = "PAUSE";
|
|
|
|
|
|
// 缓存已扫描的数据
|
|
|
const res = getPreUploadFiles(this.GLOBAL.input);
|
|
|
if (!res.succeed) {
|
|
|
+ logger.error(`03扫描仪停止,故障:${res.errorMsg}`);
|
|
|
this.$message.error(res.errorMsg);
|
|
|
return;
|
|
|
}
|
|
|
+ logger.info(`03扫描仪停止,扫描数:${res.data.length}`);
|
|
|
this.scaningImageList.push(...res.data);
|
|
|
// console.log(this.scaningImageList);
|
|
|
renamePreUploadJsonFile(this.GLOBAL.input);
|
|
@@ -196,8 +202,9 @@ export default {
|
|
|
this.$message.error("当前没有需要保存的数据!");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ logger.info(`04-1开始保存数据`);
|
|
|
await this.saveScanImage();
|
|
|
+ logger.info(`04-2保存数据结束`);
|
|
|
|
|
|
const confirm = await this.$confirm(`是否继续扫描?`, "提示", {
|
|
|
type: "warning"
|
|
@@ -257,15 +264,11 @@ export default {
|
|
|
|
|
|
await db.saveUploadInfo(fileInfo).catch(err => {
|
|
|
console.error(err);
|
|
|
+ logger.error(`04-1保存数据错误,${err}`);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
clearScanList() {
|
|
|
- // for (let i = 0; i < this.scaningImageList.length; i++) {
|
|
|
- // const item = this.scaningImageList[i];
|
|
|
- // fs.unlinkSync(item.frontFile);
|
|
|
- // fs.unlinkSync(item.versoFile);
|
|
|
- // }
|
|
|
this.scaningImageList = [];
|
|
|
clearDir(this.GLOBAL.input);
|
|
|
}
|