|
@@ -29,11 +29,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="scan-history">
|
|
<div class="scan-history">
|
|
- <div
|
|
|
|
- class="history-item"
|
|
|
|
- v-for="(task, tindex) in historyList"
|
|
|
|
- :key="tindex"
|
|
|
|
- >
|
|
|
|
|
|
+ <div class="history-item" v-for="task in historyList" :key="task.id">
|
|
<div class="history-item-body">
|
|
<div class="history-item-body">
|
|
<img :src="task.formalImgPath" :alt="task.name" />
|
|
<img :src="task.formalImgPath" :alt="task.name" />
|
|
</div>
|
|
</div>
|
|
@@ -75,7 +71,7 @@ import {
|
|
import { deepCopy } from "../../../plugins/utils";
|
|
import { deepCopy } from "../../../plugins/utils";
|
|
import ScanAreaDialog from "../components/ScanAreaDialog";
|
|
import ScanAreaDialog from "../components/ScanAreaDialog";
|
|
import ScanExceptionDialog from "../components/ScanExceptionDialog";
|
|
import ScanExceptionDialog from "../components/ScanExceptionDialog";
|
|
-import { mapState, mapMutations } from "vuex";
|
|
|
|
|
|
+import { mapState, mapMutations, mapActions } from "vuex";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "line-scan",
|
|
name: "line-scan",
|
|
@@ -111,6 +107,9 @@ export default {
|
|
]),
|
|
]),
|
|
user() {
|
|
user() {
|
|
return this.$store.state.user;
|
|
return this.$store.state.user;
|
|
|
|
+ },
|
|
|
|
+ curSubjectStartCountTime() {
|
|
|
|
+ return this.startCountTime[this.curSubject.id];
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -118,11 +117,13 @@ export default {
|
|
this.$Message.error("请先完成采集设置!");
|
|
this.$Message.error("请先完成采集设置!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ this.initHistory();
|
|
this.getInitFile();
|
|
this.getInitFile();
|
|
// this.test();
|
|
// this.test();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...mapMutations("client", ["setScanNo", "setStartCountTime"]),
|
|
|
|
|
|
+ ...mapMutations("client", ["setScanNo"]),
|
|
|
|
+ ...mapActions("client", ["updateStartCountTime"]),
|
|
async test() {
|
|
async test() {
|
|
this.curImage = getEarliestFile();
|
|
this.curImage = getEarliestFile();
|
|
const codeAreas = {
|
|
const codeAreas = {
|
|
@@ -166,6 +167,14 @@ export default {
|
|
});
|
|
});
|
|
console.log(examNumber);
|
|
console.log(examNumber);
|
|
},
|
|
},
|
|
|
|
+ async initHistory() {
|
|
|
|
+ const dataList = await db.getHistory(
|
|
|
|
+ this.curSubjectStartCountTime,
|
|
|
|
+ this.curSubject.id
|
|
|
|
+ );
|
|
|
|
+ this.historyList = dataList;
|
|
|
|
+ console.log(dataList);
|
|
|
|
+ },
|
|
getInitFile() {
|
|
getInitFile() {
|
|
this.curImage = getEarliestFile(this.GLOBAL.input);
|
|
this.curImage = getEarliestFile(this.GLOBAL.input);
|
|
|
|
|
|
@@ -273,7 +282,7 @@ export default {
|
|
});
|
|
});
|
|
await this.appendUploadTask();
|
|
await this.appendUploadTask();
|
|
await this.updateScanNo();
|
|
await this.updateScanNo();
|
|
- this.updateHistory(this.curStudent);
|
|
|
|
|
|
+ this.initHistory();
|
|
}
|
|
}
|
|
// 删除扫描文件,继续开始下一个任务
|
|
// 删除扫描文件,继续开始下一个任务
|
|
fs.unlinkSync(this.curImage.url);
|
|
fs.unlinkSync(this.curImage.url);
|
|
@@ -305,18 +314,28 @@ export default {
|
|
},
|
|
},
|
|
// count
|
|
// count
|
|
async updateScanNo() {
|
|
async updateScanNo() {
|
|
- const scanNo = await db.getScanCount(this.startCountTime);
|
|
|
|
|
|
+ const scanNo = await db.getScanCount(this.curSubjectStartCountTime);
|
|
this.setScanNo(scanNo);
|
|
this.setScanNo(scanNo);
|
|
},
|
|
},
|
|
- resetStartCountTime() {
|
|
|
|
- this.setStartCountTime(Math.floor(Date.now() / 1000));
|
|
|
|
- this.updateScanNo();
|
|
|
|
|
|
+ async resetStartCountTime() {
|
|
|
|
+ await this.updateStartCountTime({
|
|
|
|
+ [this.curSubject.id]: Math.floor(Date.now() / 1000)
|
|
|
|
+ });
|
|
|
|
+ await this.updateScanNo();
|
|
|
|
+ this.historyList = [];
|
|
},
|
|
},
|
|
- // history
|
|
|
|
|
|
+ // history 暂时不用
|
|
updateHistory(curStudent) {
|
|
updateHistory(curStudent) {
|
|
const student = deepCopy(curStudent);
|
|
const student = deepCopy(curStudent);
|
|
- if (this.historyList.length >= this.historyLimit) {
|
|
|
|
- this.historyList.pop();
|
|
|
|
|
|
+ const historyIndex = this.historyList.findIndex(
|
|
|
|
+ item => item.examNumber === student.examNumber
|
|
|
|
+ );
|
|
|
|
+ if (historyIndex === -1) {
|
|
|
|
+ if (this.historyList.length >= this.historyLimit) {
|
|
|
|
+ this.historyList.pop();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.historyList.splice(historyIndex, 1);
|
|
}
|
|
}
|
|
this.historyList.unshift(student);
|
|
this.historyList.unshift(student);
|
|
},
|
|
},
|