zhangjie 1 年之前
父节点
当前提交
7f73f97b2f
共有 1 个文件被更改,包括 18 次插入4 次删除
  1. 18 4
      src/modules/client/components/ScanTaskProcessDialog.vue

+ 18 - 4
src/modules/client/components/ScanTaskProcessDialog.vue

@@ -47,7 +47,10 @@
 
       <div class="box-justify" slot="footer">
         <div>
-          <el-button :disabled="!canSave" type="danger" @click="deleteStage"
+          <el-button
+            :disabled="!canSave || !hasSelectedData"
+            type="danger"
+            @click="deleteStage"
             >删除数据</el-button
           >
           <el-button :disabled="!canSave" type="danger" @click="clearStage"
@@ -57,6 +60,7 @@
         <el-button
           type="primary"
           :loading="scanStatus === 'SCAN'"
+          :disabled="!canScan"
           @click="toScan"
         >
           {{ statusDesc[scanStatus] }}
@@ -142,6 +146,12 @@ export default {
     canSave() {
       return this.scanStatus === "FINISH" && this.scanStageList.length;
     },
+    canScan() {
+      return this.scanStageList.length <= this.maxCacheCount;
+    },
+    hasSelectedData() {
+      return this.scanStageList.some((item) => item.selected);
+    },
   },
   methods: {
     initData() {
@@ -176,6 +186,10 @@ export default {
       this.modalIsShow = true;
     },
     toScan() {
+      if (!this.canScan) {
+        this.$message.error("已超过最大缓存数量,请先保存数据再继续扫描!");
+        return;
+      }
       if (this.scanStatus === "INIT") {
         this.startTask();
       } else {
@@ -262,11 +276,11 @@ export default {
       this.updateStudentCode();
     },
     updateStudentCode() {
-      let lastStudentCode = this.scanStageList[0].studentCode;
+      this.lastStudentCode = this.scanStageList[0].studentCode;
       for (let i = 1, len = this.scanStageList.length; i < len; i++) {
         const fileInfo = this.scanStageList[i];
-        fileInfo.studentCode = fileInfo.studentCode || lastStudentCode;
-        lastStudentCode = fileInfo.studentCode;
+        fileInfo.studentCode = fileInfo.studentCode || this.lastStudentCode;
+        this.lastStudentCode = fileInfo.studentCode;
       }
     },
     // scan relate