zhangjie 9 місяців тому
батько
коміт
f839bd0513

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

@@ -14,7 +14,7 @@ export const getBaseDataConfig = (params: { examId: any }) =>
     params,
   });
 export const saveBaseDataConfig = (data: {
-  examId: any;
+  examId: number;
   paperTypeBarcodeContent: string[];
   imageCheckRatio: string | number;
   imageCheckOrder: string;
@@ -25,6 +25,9 @@ export const saveBaseDataConfig = (data: {
   request({
     url: "/api/admin/exam/config/save",
     data,
+    headers: {
+      "Content-Type": "application/json;charset=UTF-8",
+    },
   });
 
 export const getUserList = (params: { role: string } & PageBaseParams) =>

+ 8 - 0
src/render/styles/pages.less

@@ -741,8 +741,16 @@
   .audit-body {
     left: 357px;
 
+    &-imgs {
+      height: 100%;
+      overflow-x: hidden;
+      overflow-y: auto;
+    }
+
     .paper-img {
       display: block;
+      width: 100%;
+      max-width: none;
       height: auto;
       max-height: none;
       margin-bottom: 10px;

+ 6 - 1
src/render/utils/request.ts

@@ -66,7 +66,12 @@ function createService() {
       return Promise.reject(error);
     }
   );
-  const rejectWhiteList: string[] = [];
+  const rejectWhiteList: string[] = [
+    // 审核员图片检查任务获取
+    "/api/auditor/batch/inspect/get",
+    // 审核员实时审核任务获取
+    "/api/auditor/batch/verify/get",
+  ];
   // HTTP response 拦截器
   service.interceptors.response.use(
     (response: any) => {

+ 10 - 51
src/render/views/Audit/ImageCheck/index.vue

@@ -50,8 +50,7 @@
       </a-row>
     </div>
     <div class="audit-body">
-      <!-- <img src="" alt=""> -->
-      <img src="@/assets/imgs/paper.jpg" />
+      <img v-if="curImage" :src="getFileUrl(curImage.url)" alt="origin" />
     </div>
     <div class="audit-topinfo">
       <a-space :size="6">
@@ -85,7 +84,7 @@ import { message } from "ant-design-vue";
 import { AuditBatchResult, AuditBatchStudent } from "@/ap/types/audit";
 import { imageAuditBatch, imageAuditSave, imageAuditRelease } from "@/ap/audit";
 import { useUserStore } from "@/store";
-import { dateFormat } from "@/utils/tool";
+import { dateFormat, getFileUrl } from "@/utils/tool";
 import useLoop from "@/hooks/useLoop";
 
 defineOptions({
@@ -229,53 +228,13 @@ function getPrevImage() {
 }
 
 // init
-// onMounted(async () => {
-//   await releaseBatch();
-//   startLoopGetData();
-// });
-// onBeforeUnmount(async () => {
-//   stopLoopGetData();
-//   stopLoopRemainTime();
-//   await releaseBatch();
-// });
-
-// TODO:测试数据
-onMounted(() => {
-  const students = "#"
-    .repeat(30)
-    .split("")
-    .map((item, index) => {
-      return {
-        examNumber: `3600802404012${index}`,
-        name: `张三${index + 1}`,
-        studentCode: `36008${index + 1}`,
-        subjectCode: "sx001",
-        subjectName: "数学",
-        seatNumber: "11",
-        papers: [
-          {
-            number: 1,
-            // 是否本张为人工绑定
-            assigned: true,
-            // 数组为空表示缺纸
-            pages: ["xxx.jpg", "xxx.png"],
-          },
-        ],
-      };
-    });
-  batchInfo.value = {
-    batchId: 123,
-    device: "192.168.0.1",
-    deviceName: "scan01",
-    createTime: Date.now(),
-    // 实时审核批次此字段有值
-    packageCode: "ET01245124",
-    students,
-  };
-  hasTask.value = true;
-  loopImageStoped.value = true;
-
-  initImageData();
-  setCurImage(0);
+onMounted(async () => {
+  await releaseBatch();
+  startLoopGetData();
+});
+onBeforeUnmount(async () => {
+  stopLoopGetData();
+  stopLoopRemainTime();
+  await releaseBatch();
 });
 </script>

+ 56 - 55
src/render/views/Audit/InTime/index.vue

@@ -57,11 +57,20 @@
               style="height: 22px; background-color: #d9d9d9"
             />
           </template>
-          <a-button type="success" @click="onConfirm(true)">
+          <a-button
+            type="success"
+            :disabled="canSubmit"
+            :loading="loading"
+            @click="onConfirm(true)"
+          >
             <template #icon><CheckCircleOutlined /></template>
             通过
           </a-button>
-          <a-button type="error-light" @click="onConfirm(false)">
+          <a-button
+            type="error-light"
+            :loading="loading"
+            @click="onConfirm(false)"
+          >
             <template #icon><CloseCircleOutlined /></template>
             拒绝
           </a-button>
@@ -70,18 +79,15 @@
     </div>
     <div class="audit-body">
       <template v-if="curStudent">
-        <div v-for="paper in curStudent.papers" :key="paper.number">
-          <img
-            v-for="(page, pindex) in paper.pages"
-            :key="pindex"
-            class="paper-img"
-            src="@/assets/imgs/paper.jpg"
-          />
-          <!-- <img
-            v-for="(page, pindex) in paper.pages"
-            :key="pindex"
-            :src="page"
-          /> -->
+        <div class="audit-body-imgs">
+          <div v-for="paper in curStudent.papers" :key="paper.number">
+            <img
+              v-for="(page, pindex) in paper.pages"
+              :key="pindex"
+              class="paper-img"
+              :src="getFileUrl(page)"
+            />
+          </div>
         </div>
         <ReviewMarkPan
           :task-info="{
@@ -102,7 +108,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, onMounted, onBeforeUnmount } from "vue";
+import { ref, onMounted, onBeforeUnmount, computed } from "vue";
 import {
   CheckCircleOutlined,
   CloseCircleOutlined,
@@ -116,12 +122,17 @@ import {
   AuditBatchStudent,
   AuditBatchData,
 } from "@/ap/types/audit";
-import { intimeAuditBatch, intimeAuditBatchSubmit } from "@/ap/audit";
+import {
+  intimeAuditBatch,
+  intimeAuditBatchSubmit,
+  intimeAuditBatchRelease,
+} from "@/ap/audit";
 import { useUserStore } from "@/store";
-import { dateFormat } from "@/utils/tool";
+import { dateFormat, getFileUrl } from "@/utils/tool";
 import useLoop from "@/hooks/useLoop";
 
 import ReviewMarkPan from "../../Review/ReviewMarkPan.vue";
+import useLoading from "@/hooks/useLoading";
 
 defineOptions({
   name: "IntimeAudit",
@@ -139,6 +150,18 @@ const curStudentIndex = ref(0);
 const batchInfo = ref({} as AuditBatchData);
 const hasTask = ref(false);
 
+const canSubmit = computed(() => {
+  return !dataList.value.some((item) => !item.status);
+});
+
+function initData() {
+  dataList.value = [];
+  curStudent.value = null;
+  curStudentIndex.value = 0;
+  batchInfo.value = {};
+  hasTask.value = false;
+}
+
 const { start: startLoopGetData, stop: stopLoopGetData } = useLoop(
   getData,
   2000
@@ -178,55 +201,33 @@ function getPrevStudent() {
 }
 
 // confirm
+const { loading, setLoading } = useLoading();
 async function onConfirm(confirm: boolean) {
+  if (loading.value) return;
+  setLoading(true);
   const res = await intimeAuditBatchSubmit({
     batchId: batchInfo.value.batchId,
     confirm,
-  });
+  }).catch(() => {});
+  setLoading(false);
+  if (!res) return;
 
+  message.success("操作成功!");
+  initData();
   startLoopGetData();
 }
 
+async function releaseBatch() {
+  await intimeAuditBatchRelease({ examId: userStore.curExam.id });
+}
+
 onBeforeUnmount(() => {
+  releaseBatch();
   stopLoopGetData();
 });
 
-onMounted(() => {
-  // startLoopGetData();
-
-  // TODO: 测试数据
-  hasTask.value = true;
-  batchInfo.value = {
-    batchId: 123,
-    device: "192.168.0.1",
-    createTime: Date.now(),
-    // 实时审核批次此字段有值
-    packageCode: "ET01245124",
-  };
-  dataList.value = "#"
-    .repeat(30)
-    .split("")
-    .map((item, index) => {
-      return {
-        examNumber: `3600802404012${index}`,
-        name: `考生名${index}`,
-        studentCode: `36008${index}`,
-        subjectCode: "科目代码",
-        subjectName: "科目名称",
-        seatNumber: "11",
-        status: Math.random() > 0.5,
-        papers: [
-          {
-            number: 1,
-            // 是否本张为人工绑定
-            assigned: true,
-            // 数组为空表示缺纸
-            pages: ["xxx.jpg", "111.png"],
-          },
-        ],
-      };
-    });
-  curStudentIndex.value = 0;
-  setCurStudent();
+onMounted(async () => {
+  await releaseBatch();
+  startLoopGetData();
 });
 </script>

+ 1 - 1
src/render/views/BaseDataConfig/ScanParams.vue

@@ -207,7 +207,7 @@ const rules = {
 };
 const save = () => {
   form.value.formRef.validate().then(() => {
-    let p: any = { ...params };
+    let p: any = { ...params, examId: userStore.curExam.id };
     delete p.paperTypeBarcodeContentItem;
     saveBaseDataConfig(p).then((res: any) => {
       window.$message.success("保存成功");