刘洋 hai 8 meses
pai
achega
28dc6a2bc9

+ 1 - 0
src/render/ap/baseDataConfig.ts

@@ -86,6 +86,7 @@ export const importCard = async (params: {
       md5,
       "Content-Type": "multipart/form-data",
     },
+    loading: true,
   });
 };
 

+ 13 - 0
src/render/views/BaseDataConfig/ImportCardDialog.vue

@@ -39,6 +39,7 @@ const params = reactive({
   remark: "",
   file: null,
   paperCount: void 0,
+  singlePage: false,
 });
 const fields = ref([
   { prop: "subjectCode", cell: "subjectCode", label: "科目题卡", colSpan: 24 },
@@ -51,6 +52,18 @@ const fields = ref([
     colSpan: 24,
     attrs: { min: 1 },
   },
+  {
+    prop: "singlePage",
+    type: "radio",
+    label: "单页题卡",
+    colSpan: 24,
+    attrs: {
+      options: [
+        { value: false, label: "否" },
+        { value: true, label: "是" },
+      ],
+    },
+  },
 ]);
 
 const rules = {

+ 69 - 9
src/render/views/ScanManage/ImageView.vue

@@ -90,7 +90,7 @@
   </div>
 </template>
 <script name="ImageView" lang="ts" setup>
-import { ref, computed, onMounted, watch } from "vue";
+import { ref, computed, onMounted, watch, onBeforeUnmount } from "vue";
 import VerticalDateRange from "@/components/VerticalDateRange/index.vue";
 import { useUserStore, useDataCheckStore } from "@/store";
 import { IMAGE_TYPE, enum2Options } from "@/constants/enums";
@@ -178,15 +178,21 @@ function parseStudentPage(student: any) {
     });
   });
 }
+const loading = ref(false);
 const _getStuCardDetail = () => {
+  loading.value = true;
   getStuCardDetail({
     batchId: curBatch.value.value,
     studentId: curStu.value.studentId,
-  }).then((res: any) => {
-    curStuCardData.value = res || {};
-    parseStudentPage(curStuCardData.value);
-    selectPage(0);
-  });
+  })
+    .then((res: any) => {
+      curStuCardData.value = res || {};
+      parseStudentPage(curStuCardData.value);
+      selectPage(0);
+    })
+    .finally(() => {
+      loading.value = false;
+    });
 };
 function selectPage(index: number) {
   dataCheckStore.setInfo({
@@ -197,9 +203,6 @@ function selectPage(index: number) {
   if (!dataCheckStore.curPage) return;
   dataCheckStore.setInfo({ curStudent: curStuCardData.value as any });
 }
-onMounted(() => {
-  _batchSubjectList();
-});
 
 const arr = ref([
   { title: "搜索条件", name: "one", open: true },
@@ -239,6 +242,7 @@ const curStuCardData = ref({});
 const dataList = ref<any>([]);
 
 const chooseLeft = (item: any, index: number) => {
+  if (loading.value) return;
   activeIndex.value = index;
   if (listType.value === "level1") {
     curSubject.value = { value: item.subjectCode, label: item.subjectName };
@@ -360,6 +364,62 @@ async function onNextPage() {
 
   selectPage(dataCheckStore.curPageIndex + 1);
 }
+
+function registShortcut() {
+  document.addEventListener("keydown", shortcutHandle);
+}
+function removeShortcut() {
+  document.removeEventListener("keydown", shortcutHandle);
+}
+function onPrevStudent() {
+  if (activeIndex.value == 0) {
+    window.$message.error("没有上一个学生了");
+    return;
+  }
+  chooseLeft(leftList.value[activeIndex.value - 1], activeIndex.value - 1);
+}
+function onNextStudent() {
+  if (activeIndex.value == leftList.value.length - 1) {
+    window.$message.error("没有下一个学生了");
+    return;
+  }
+  chooseLeft(leftList.value[activeIndex.value + 1], activeIndex.value + 1);
+}
+function shortcutHandle(e: KeyboardEvent) {
+  if (!leftList.value.length || listType.value !== "level4") {
+    return;
+  }
+  const moveAction = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
+  if (!moveAction.includes(e.code) || e.repeat) {
+    return;
+  }
+
+  e.preventDefault();
+
+  if (e.code === "ArrowUp") {
+    onPrevStudent();
+    return;
+  }
+  if (e.code === "ArrowDown") {
+    onNextStudent();
+    return;
+  }
+  if (e.code === "ArrowLeft") {
+    onPrevPage();
+    return;
+  }
+  if (e.code === "ArrowRight") {
+    onNextPage();
+    return;
+  }
+}
+onMounted(() => {
+  _batchSubjectList();
+  registShortcut();
+});
+onBeforeUnmount(() => {
+  removeShortcut();
+});
 </script>
 <style lang="less" scoped>
 .image-view {