Browse Source

fix: 课程选择bug以及过滤缺考数据

zhangjie 1 năm trước cách đây
mục cha
commit
c7644c0163

+ 2 - 1
src/api/types/task.ts

@@ -181,7 +181,7 @@ export type StudentObjectiveInfo = {
 export interface TrackExportListFilter {
   semesterId: string;
   examId: string;
-  courseId: string;
+  courseCode: string;
 }
 export type TrackExportListParams = PageParams<TrackExportListFilter>;
 
@@ -208,5 +208,6 @@ export interface TrackExportDetailItem {
   courseName: string;
   studentName: string;
   studentCode: string;
+  sheetUrls: string[] | null;
 }
 export type TrackExportDetailListPageRes = PageResult<TrackExportDetailItem>;

+ 1 - 1
src/components/select-course/index.vue

@@ -48,7 +48,7 @@
     });
 
     optionList.value = (resData || []).map((item) => {
-      return { ...item, value: item.id, label: `${item.name}(${item.code})` };
+      return { ...item, value: item.code, label: `${item.name}(${item.code})` };
     });
   };
 

+ 5 - 2
src/views/base/track-export/index.vue

@@ -21,11 +21,12 @@
         @change="examChange"
       />
       <SelectCourse
-        v-model="searchModel.courseId"
+        v-model="searchModel.courseCode"
         :semester-id="searchModel.semesterId"
         :exam-id="searchModel.examId"
         placeholder="请选择"
         prefix
+        clearable
         @change="courseChange"
       />
       <a-button type="primary" @click="toPage(1)">查询</a-button>
@@ -107,7 +108,7 @@
   const searchModel = reactive({
     semesterId: '',
     examId: '',
-    courseId: '',
+    courseCode: '',
   });
 
   const columns: TableColumnData[] = [
@@ -231,6 +232,7 @@
       pictureType: appStore.trackConfig.pictureType.join(),
       outputDir: appStore.trackConfig.curOutputDir,
       status: 0,
+      courseId: '',
     }).catch(() => {
       result = false;
       setLoading(false);
@@ -277,6 +279,7 @@
       ...seNames,
       courseCode: row.courseCode,
       courseName: row.courseName,
+      courseId: '',
       paperNumber: row.paperNumber,
       schoolId: userStore.curSchoolInfo.id,
       pictureType: appStore.trackConfig.pictureType.join(),

+ 11 - 10
src/views/base/track-export/useTask.ts

@@ -66,7 +66,6 @@ export default function useTask() {
 
   async function getTrackExportDetailList(data: TrackExportItem) {
     const filterData = {
-      filter: 0,
       examId: data.examId,
       paperNumber: data.paperNumber,
       pageSize,
@@ -93,15 +92,17 @@ export default function useTask() {
 
   async function createTrackTaskDetails(params: TrackExportDetailListParams) {
     const res = await trackExportDetailListPage(params);
-    const details = res.records.map((item) => {
-      return {
-        trackTaskId: trackTaskId.value,
-        studentId: item.studentId,
-        studentName: item.studentName,
-        studentCode: item.studentCode,
-        status: TRACK_TASK_DETAIL_STATUS.INIT,
-      };
-    });
+    const details = res.records
+      .filter((item) => item.sheetUrls)
+      .map((item) => {
+        return {
+          trackTaskId: trackTaskId.value,
+          studentId: item.studentId,
+          studentName: item.studentName,
+          studentCode: item.studentCode,
+          status: TRACK_TASK_DETAIL_STATUS.INIT,
+        };
+      });
     await window.db.createTrackTaskDetails(details);
 
     return {