刘洋 пре 8 месеци
родитељ
комит
1526fafa16
1 измењених фајлова са 19 додато и 5 уклоњено
  1. 19 5
      src/render/views/RecognizeCheck/RecognizeArbitrate.vue

+ 19 - 5
src/render/views/RecognizeCheck/RecognizeArbitrate.vue

@@ -100,6 +100,7 @@ import {
   onMounted,
   onBeforeUnmount,
   nextTick,
+  watch,
 } from "vue";
 import { useRoute, useRouter } from "vue-router";
 import {
@@ -137,12 +138,22 @@ const route = useRoute();
 const userStore = useUserStore();
 const groupId = route.params.groupId ? Number(route.params.groupId) : 0;
 
+const paperTypeBarcodeContentAll = ref<any>([]);
 const paperTypeBarcodeContent = ref<string[]>([]);
 async function getConfig() {
-  const res = await getBaseDataConfig({ examId: userStore.curExam.id });
-  paperTypeBarcodeContent.value = res.paperTypeBarcodeContent || [];
+  const res = await getBaseDataConfig({ examId: userStore.curExam?.id });
+  let arr = res.paperTypeBarcodeContent || [];
+  paperTypeBarcodeContentAll.value = arr;
 }
 
+const getPaperTypeBarcodeContent = () => {
+  let paperTypeBarcodeContent =
+    paperTypeBarcodeContentAll.value.find(
+      (item: any) => item.code == subjectCode.value
+    )?.paperTypeBarcodeContent || [];
+  return paperTypeBarcodeContent;
+};
+
 // 任务进度
 const progress = ref({
   finishCount: 0,
@@ -190,7 +201,6 @@ async function getNewTask() {
     curArbitrateTaskDetail.value = null;
     return;
   }
-
   curArbitrateTaskDetails.value = parseDetails(curTask.value);
   curArbitrateTaskDetailIndex.value = 0;
   setCurTaskDetail();
@@ -208,6 +218,7 @@ async function initData() {
 function parseDetails(
   data: RecognizeArbitrateItem
 ): RecognizeArbitrateTaskDetail[] {
+  paperTypeBarcodeContent.value = getPaperTypeBarcodeContent();
   const details: RecognizeArbitrateTaskDetail[] = [];
   data.pages.forEach((page) => {
     const recogData = parseRecogData(page.recogData);
@@ -252,7 +263,6 @@ function parseDetails(
           };
         }
       }
-
       details.push({
         ...parseDetailSize(
           recogData.paperType.fill_result[0],
@@ -548,7 +558,7 @@ function goback() {
 
 onMounted(async () => {
   await releaseTask();
-  getConfig();
+  await getConfig();
   initData();
   registKeyEvent();
 });
@@ -557,4 +567,8 @@ onBeforeUnmount(() => {
   releaseTask();
   removeKeyEvent();
 });
+
+const subjectCode = computed(() => {
+  return curTask.value?.subjectCode || "";
+});
 </script>