Browse Source

成绩导出任务

Michael Wang 4 years ago
parent
commit
a963c7019d

+ 25 - 0
src/api/examwork-markresult.js

@@ -27,3 +27,28 @@ export function searchMarkResult({
     "/api/admin/examStudent/mark/result?" + object2QueryString(data)
   );
 }
+
+export function exportMarkResult({
+  examId = "",
+  examActivityId = "",
+  courseCode = "",
+  name = "",
+  identity = "",
+  type = "",
+}) {
+  const data = pickBy(
+    {
+      examId,
+      examActivityId,
+      name,
+      courseCode,
+      identity,
+      type,
+    },
+    (v) => v !== "" && v !== null
+  );
+  return httpApp.post(
+    `/api/admin/examStudent/mark/result/${type}/export?` +
+      object2QueryString(data)
+  );
+}

+ 2 - 0
src/constant/constants.js

@@ -136,6 +136,8 @@ export const IMPORT_EXPORT_TASKS = [
   { code: "IMPORT_INVIGILATE_USER", name: "导入监考员" },
   { code: "EXPORT_INVIGILATE_USER", name: "导出监考员" },
   { code: "EXPORT_EXAM_STUDENT", name: "导出考生" },
+  { code: "EXPORT_MARK_RESULT_SIMPLE", name: "导出成绩简版" },
+  { code: "EXPORT_MARK_RESULT_STANDARD", name: "导出成绩标准版" },
 ];
 
 let domain;

+ 31 - 11
src/features/examwork/MarkResultManagement/MarkResultManagement.vue

@@ -28,6 +28,19 @@
             <el-button type="primary" @click="handleCurrentChange(0)"
               >查询</el-button
             >
+
+            <el-dropdown
+              class="mx-2"
+              split-button
+              type="primary"
+              @command="exportMarkResult"
+            >
+              导出
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item command="simple">简化版</el-dropdown-item>
+                <el-dropdown-item command="standard">标准版</el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
           </el-form-item>
         </el-form>
       </div>
@@ -97,7 +110,7 @@
 </template>
 
 <script>
-import { searchMarkResult } from "@/api/examwork-markresult";
+import { searchMarkResult, exportMarkResult } from "@/api/examwork-markresult";
 export default {
   name: "MarkResultManagement",
   data() {
@@ -116,9 +129,6 @@ export default {
       currentPage: 1,
       pageSize: 10,
       total: 10,
-      basePhotoDialogVisible: false,
-      selectedBasePhoto: null,
-      selectedStudent: {},
     };
   },
   async created() {},
@@ -152,13 +162,23 @@ export default {
       this.currentPage = 1;
       this.searchForm();
     },
-    openBasePhotoDialog(url) {
-      this.selectedBasePhoto = url;
-      this.basePhotoDialogVisible = true;
-    },
-    openExamRecord(user) {
-      this.selectedStudent = user;
-      this.$refs.theDialog.openDialog();
+    async exportMarkResult(type) {
+      try {
+        const valid = await this.$refs.form.validate();
+        if (!valid) return;
+      } catch (error) {
+        console.log(error);
+        return;
+      }
+      await exportMarkResult({
+        examId: this.form.examId,
+        examActivityId: this.form.examActivityId,
+        identity: this.form.identity,
+        courseCode: this.form.courseCode,
+        name: this.form.name,
+        type,
+      });
+      this.$notify({ title: "导入任务已成功启动", type: "success" });
     },
   },
 };