Browse Source

导出考场安排,需求变更

Michael Wang 4 years ago
parent
commit
75e9864d7b

+ 6 - 2
src/api/examwork-task.js

@@ -62,6 +62,10 @@ export function importInvigilator({ examId, fileName, file, md5 }) {
   });
   });
 }
 }
 
 
-export function exportInvigilate() {
-  return httpApp.post("/api/admin/invigilateUser/export");
+export function exportInvigilate({ examId, roomCode, userId }) {
+  const form = new FormData();
+  form.append("examId", examId);
+  form.append("roomCode", roomCode);
+  form.append("userId", userId);
+  return httpApp.post("/api/admin/invigilateUser/export", form);
 }
 }

+ 21 - 5
src/features/examwork/InvigilateManagement/InvigilateManagement.vue

@@ -129,11 +129,17 @@ export default {
       downloadUrl: INVIGILATOR_IMPORT_TEMPLATE_DOWNLOAD_URL,
       downloadUrl: INVIGILATOR_IMPORT_TEMPLATE_DOWNLOAD_URL,
     };
     };
   },
   },
-  async created() {
-    this.searchForm();
-  },
+  // async created() {
+  //   this.searchForm();
+  // },
   methods: {
   methods: {
     async searchForm() {
     async searchForm() {
+      try {
+        await this.$refs.form.validate();
+      } catch (error) {
+        console.log(error);
+        return;
+      }
       const res = await searchInvigilators({
       const res = await searchInvigilators({
         examId: this.form.examId,
         examId: this.form.examId,
         userId: this.form.userId,
         userId: this.form.userId,
@@ -167,8 +173,18 @@ export default {
       }
       }
       this.$refs.theDialog2.openDialog();
       this.$refs.theDialog2.openDialog();
     },
     },
-    exportInvigilate() {
-      exportInvigilate();
+    async exportInvigilate() {
+      try {
+        await this.$refs.form.validate();
+      } catch (error) {
+        console.log(error);
+        return;
+      }
+      exportInvigilate({
+        examId: this.form.examId,
+        userId: this.form.userId,
+        roomCode: this.form.roomCode,
+      });
       this.$notify({ title: "导入任务已成功启动", type: "success" });
       this.$notify({ title: "导入任务已成功启动", type: "success" });
     },
     },
   },
   },