zhangjie 2 anos atrás
pai
commit
5fb008d483

+ 3 - 0
src/modules/client/components/ScanTaskProcessDialog.vue

@@ -187,12 +187,14 @@ export default {
         console.error(error);
       });
       this.scanStatus = "PAUSE";
+      this.realScanCount = getPreUploadFileCount(this.GLOBAL.input);
 
       // 缓存已扫描的数据
       const res = getPreUploadFiles(this.GLOBAL.input);
       if (!res.succeed) {
         logger.error(`03扫描仪停止,故障:${res.errorMsg}`);
         this.$message.error(res.errorMsg);
+        renamePreUploadJsonFile(this.GLOBAL.input);
         return;
       }
       logger.info(`03扫描仪停止,扫描数:${res.data.length}`);
@@ -216,6 +218,7 @@ export default {
       const confirm = await this.$confirm(`是否继续扫描?`, "提示", {
         type: "warning"
       }).catch(() => {});
+      this.clearScanList();
 
       if (confirm !== "confirm") {
         this.close();

+ 2 - 1
src/plugins/imageOcr.js

@@ -1,4 +1,5 @@
 import { getInputDir, getOutputDir, makeDirSync } from "./env";
+import { randomCode } from "./utils";
 const fs = require("fs");
 const path = require("path");
 
@@ -127,7 +128,7 @@ export function renamePreUploadJsonFile(dir) {
   files.forEach(file => {
     fs.renameSync(
       path.join(ddir, file),
-      path.join(ddir, path.basename(file, ".json") + ".txt")
+      path.join(ddir, path.basename(file, ".json") + `_${randomCode(8)}.txt`)
     );
   });
 }