zhangjie 1 сар өмнө
parent
commit
e1b6084fe3

+ 13 - 1
src/modules/print/components/BarCodeCheck.vue

@@ -23,6 +23,8 @@
             v-model.trim="modalForm.packageCodeStart"
             placeholder="请扫描考场起始条码"
             clearable
+            ref="CodeStartRef"
+            @input="codeStartInputHandle"
           ></el-input>
         </el-form-item>
         <el-form-item label="考场结束条码:" prop="packageCodeEnd">
@@ -30,6 +32,7 @@
             v-model.trim="modalForm.packageCodeEnd"
             placeholder="请扫描考场结束条码"
             clearable
+            ref="CodeEndRef"
           ></el-input>
         </el-form-item>
       </el-form>
@@ -107,13 +110,22 @@ export default {
       this.modalIsShow = false;
       this.$refs.modalFormComp.resetFields();
     },
+    codeStartInputHandle() {
+      console.log("start");
+      if (this.modalForm.packageCodeStart.endsWith("\n")) {
+        this.$refs.CodeEndRef.select();
+      }
+    },
     async confirm() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      const res = await updateBarCodeCheck(this.modalForm).catch(() => {});
+      const res = await updateBarCodeCheck(this.modalForm).catch(() => {
+        this.$refs.CodeStartRef.select();
+        this.modalForm.packageCodeEnd = "";
+      });
       this.isSubmit = false;
       if (!res) return;