Ver Fonte

小提交一下

刘洋 há 9 meses atrás
pai
commit
6c3d3f69eb

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

@@ -94,3 +94,40 @@ export const getStuList = (params: { examId: number }) =>
     url: "/api/admin/student/count",
     params,
   });
+export const getStuImportSet = (params: { examId: number }) =>
+  request({
+    url: "/api/admin/student/import/config",
+    params,
+  });
+
+export const saveStuImportSet = (params: {
+  examId: number;
+  year: number | string;
+  yearHalf: number | string;
+}) =>
+  request({
+    url: "/api/admin/student/import/config/save",
+    params,
+  });
+
+export const clearStuData = (params: { examId: number; subjectCode: string }) =>
+  request({
+    url: "/api/admin/student/clear",
+    params,
+  });
+
+export const importStu = async (params: {
+  examId: number;
+  file: File | null;
+}) => {
+  const md5 = await getFileMD5(params.file as File);
+  const formData = obj2formData(params);
+  return request({
+    url: "/api/admin/student/import",
+    data: formData,
+    headers: {
+      md5,
+      "Content-Type": "multipart/form-data",
+    },
+  });
+};

+ 0 - 38
src/render/ap/scanManage.ts

@@ -43,44 +43,6 @@ export const batchStudentList = (params: { batchId: any }) =>
     params,
   });
 
-export const getStuImportSet = (params: { examId: number }) =>
-  request({
-    url: "/api/admin/student/import/config",
-    params,
-  });
-
-export const saveStuImportSet = (params: {
-  examId: number;
-  year: number | string;
-  yearHalf: number | string;
-}) =>
-  request({
-    url: "/api/admin/student/import/config/save",
-    params,
-  });
-
-export const clearStuData = (params: { examId: number; subjectCode: string }) =>
-  request({
-    url: "/api/admin/student/clear",
-    params,
-  });
-
-export const importStu = async (params: {
-  examId: number;
-  file: File | null;
-}) => {
-  const md5 = await getFileMD5(params.file as File);
-  const formData = obj2formData(params);
-  return request({
-    url: "/api/admin/student/import",
-    data: formData,
-    headers: {
-      md5,
-      "Content-Type": "multipart/form-data",
-    },
-  });
-};
-
 export const scanProcessData = (params: {
   examId: number | undefined;
   subjectCode: string;

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

@@ -15,4 +15,5 @@ export const adminLogin = (params: { loginName: string; password: string }) =>
 export const getSubjectList = (params: { examId: number | null }) =>
   request({
     url: "/api/admin/subject/list",
+    params,
   });

+ 4 - 0
src/render/main.ts

@@ -10,7 +10,11 @@ import "v3-drag-zoom/dist/style.css";
 import "virtual:uno.css";
 import "./styles/index.less";
 // import "./ap/mock/index.ts";
+import { setGlobalOptions } from "vue-request";
 
+setGlobalOptions({
+  manual: true, //当 manual 设置为 true 时,你需要手动触发 run 或者 runAsync 才会发起请求 ,见vue-request文档:https://www.attojs.com/api/#manual
+});
 window.$message = message;
 window.$notification = notification;
 window.$info = Modal.info;

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

@@ -143,7 +143,8 @@ function createRequest(service: any) {
       "Content-Type": get(
         config,
         "headers.Content-Type",
-        "application/json;charset=UTF-8"
+        // "application/json;charset=UTF-8"
+        "application/x-www-form-urlencoded"
       ),
     };
     const configDefault = {

+ 136 - 21
src/render/views/ScanManage/ImageView.vue

@@ -2,13 +2,28 @@
   <div class="image-view h-full">
     <div class="tree-wrap">
       <div class="top">
-        <div class="result-list">科目1;机器1;批次1</div>
+        <div class="result-list">
+          {{ curSubject.label }}{{ curDevice.label && ";" }}{{ curDevice.label
+          }}{{ curBatch.label && ";" }}{{ curBatch.label }}
+        </div>
         <div class="bread">
-          <span :class="{ active: chooseLevel >= 1 }">科目</span>
+          <span
+            :class="{ active: chooseLevel >= 1 }"
+            @click="toggleListType('level1', 1)"
+            >科目</span
+          >
           <i>&gt;</i>
-          <span :class="{ active: chooseLevel >= 2 }">机器</span>
+          <span
+            :class="{ active: chooseLevel >= 2 }"
+            @click="toggleListType('level2', 2)"
+            >机器</span
+          >
           <i>&gt;</i>
-          <span :class="{ active: chooseLevel == 3 }">批次</span>
+          <span
+            :class="{ active: chooseLevel >= 3 }"
+            @click="toggleListType('level3', 3)"
+            >批次</span
+          >
         </div>
       </div>
       <div class="bottom">
@@ -17,8 +32,9 @@
           :key="index"
           class="list-row"
           :class="{ active: activeIndex === index }"
+          @click="chooseLeft(item, index)"
         >
-          {{ item.name }}
+          {{ item[fieldNames.label] }}
         </div>
       </div>
     </div>
@@ -31,27 +47,126 @@
   </div>
 </template>
 <script name="ImageView" lang="ts" setup>
-import { ref, computed } from "vue";
+import { ref, computed, onMounted, reactive } from "vue";
+import { useRequest } from "vue-request";
+import { useUserStore } from "@/store";
+import {
+  batchSubjectList,
+  batchDeviceList,
+  batchList,
+  batchStudentList,
+} from "@/ap/scanManage";
+
+const userStore = useUserStore();
+const examId = computed(() => userStore.curExam?.id);
+// const { runAsync: run1 } = useRequest(batchSubjectList);
+// const { runAsync: run2 } = useRequest(batchDeviceList);
+// const { runAsync: run3 } = useRequest(batchList);
+// const { runAsync: run4 } = useRequest(batchStudentList);
+const _batchSubjectList = () => {
+  batchSubjectList({ examId: examId.value }).then((res: any) => {
+    leftList.value = res || [];
+    listType.value = "level1";
+  });
+};
+
+const _batchDeviceList = () => {
+  batchDeviceList({
+    examId: examId.value,
+    subjectCode: curSubject.value.value,
+  }).then((res: any) => {
+    leftList.value = res || [];
+    listType.value = "level2";
+  });
+};
+const _batchList = () => {
+  batchList({
+    examId: examId.value,
+    subjectCode: curSubject.value.value,
+    device: curDevice.value.value,
+  }).then((res: any) => {
+    leftList.value = res || [];
+    listType.value = "level3";
+  });
+};
+const _batchStudentList = () => {
+  batchStudentList({ batchId: curSubject.value.value }).then((res: any) => {
+    leftList.value = res || [];
+    listType.value = "level4";
+  });
+};
+onMounted(() => {
+  _batchSubjectList();
+});
 
 const arr = ref([{ title: "搜索条件", name: "one", open: true }]);
 
-const listType = ref("kemu");
+const listType = ref("level1");
+const fieldNames = computed(() => {
+  let obj: any = {
+    level1: { label: "subjectName", value: "subjectCode" },
+    level2: { label: "deviceName", value: "device" },
+    level3: { label: "batchId", value: "batchId" },
+    level4: { label: "studentName", value: "studentId" },
+  };
+  return obj[listType.value];
+});
 const chooseLevel = computed(() => {
-  return listType.value === "kemu" ? 1 : listType.value === "jiqi" ? 2 : 3;
+  return listType.value === "level1"
+    ? 1
+    : listType.value === "level2"
+    ? 2
+    : listType.value === "level3"
+    ? 3
+    : 4;
 });
-const leftList = ref([{ name: "批次1" }, { name: "批次2" }, { name: "批次3" }]);
-const activeIndex = ref(0);
-const imgList = ref([
-  {
-    url: "https://cet-test.markingtool.cn/file/slice/1/2/10101/1/031/1/101011221203102-1.jpg",
-  },
-  {
-    url: "https://cet-test.markingtool.cn/file/slice/1/2/10101/1/031/1/101011221203101-1.jpg",
-  },
-  {
-    url: "https://cet-test.markingtool.cn/file/slice/1/2/10100/1/035/1/101001221203502-1.jpg",
-  },
-]);
+const leftList = ref<any>([]);
+const curSubject = ref({ label: "", value: "" });
+const curDevice = ref({ label: "", value: "" });
+const curBatch = ref({ label: "", value: "" });
+
+const chooseLeft = (item: any, index: number) => {
+  activeIndex.value = index;
+  if (listType.value === "level1") {
+    curSubject.value = { value: item.subjectCode, label: item.subjectName };
+    _batchDeviceList();
+  } else if (listType.value === "level2") {
+    curDevice.value = { value: item.device, label: item.deviceName };
+    _batchList();
+  } else if (listType.value === "level3") {
+    curBatch.value = { value: item.batchId, label: item.batchId };
+    _batchStudentList();
+  }
+};
+const toggleListType = (type: string, num: number) => {
+  if (chooseLevel.value < num) {
+    return;
+  }
+  const clearObj = { value: "", label: "" };
+  if (type === "level1") {
+    leftList.value = [];
+    curSubject.value = { ...clearObj };
+    curDevice.value = { ...clearObj };
+    curBatch.value = { ...clearObj };
+    _batchSubjectList();
+  } else if (type === "level2") {
+    curDevice.value = { ...clearObj };
+    curBatch.value = { ...clearObj };
+    _batchDeviceList();
+  }
+};
+const activeIndex = ref();
+// const imgList = ref([
+//   {
+//     url: "https://cet-test.markingtool.cn/file/slice/1/2/10101/1/031/1/101011221203102-1.jpg",
+//   },
+//   {
+//     url: "https://cet-test.markingtool.cn/file/slice/1/2/10101/1/031/1/101011221203101-1.jpg",
+//   },
+//   {
+//     url: "https://cet-test.markingtool.cn/file/slice/1/2/10100/1/035/1/101001221203502-1.jpg",
+//   },
+// ]);
 </script>
 <style lang="less" scoped>
 .image-view {

+ 1 - 1
src/render/views/ScanManage/ScanCheckMiss.vue

@@ -37,7 +37,7 @@ import {
   getCampusList,
   getScannedList,
   exportScanned,
-} from "@/ap/baseDataConfig";
+} from "@/ap/scanManage";
 import type { TableColumnsType } from "@qmth/ui";
 const userStore = useUserStore();
 

+ 1 - 1
src/render/views/ScanManage/ScanProcess.vue

@@ -34,7 +34,7 @@
 </template>
 <script name="ScanProcess" lang="ts" setup>
 import { ref, reactive, onMounted } from "vue";
-import { scanProcessData } from "@/ap/baseDataConfig";
+import { scanProcessData } from "@/ap/scanManage";
 import { useUserStore } from "@/store";
 import SelectSubject from "@/components/SelectSubject/index.vue";
 import type { TableColumnsType } from "@qmth/ui";

+ 1 - 1
src/render/views/ScanManage/StuInfo.vue

@@ -25,7 +25,7 @@ import { useUserStore } from "@/store";
 import { useRequest } from "vue-request";
 import useTable from "@/hooks/useTable";
 import SelectSubject from "@/components/SelectSubject/index.vue";
-import { getSiteList, getCampusList, getStuPage } from "@/ap/baseDataConfig";
+import { getSiteList, getCampusList, getStuPage } from "@/ap/scanManage";
 import type { TableColumnsType } from "@qmth/ui";
 const userStore = useUserStore();
 //考点下拉

+ 1 - 1
src/render/views/ScanManage/WorkStatistics.vue

@@ -15,7 +15,7 @@
 </template>
 <script name="WorkStatistics" lang="ts" setup>
 import { ref, computed, reactive, onMounted } from "vue";
-import { getWorkStatistics, exportWorkStatistics } from "@/ap/baseDataConfig";
+import { getWorkStatistics, exportWorkStatistics } from "@/ap/scanManage";
 import { useUserStore } from "@/store";
 import VueEcharts from "vue-echarts";
 import { graphic } from "echarts";