ソースを参照

成绩下载按钮

zhangjie 1 年間 前
コミット
ea696a3475
2 ファイル変更36 行追加1 行削除
  1. 5 0
      src/modules/mark/api.js
  2. 31 1
      src/modules/mark/components/ScoreClassDetail.vue

+ 5 - 0
src/modules/mark/api.js

@@ -181,6 +181,11 @@ export const scoreClassDetailScoreExport = (datas) => {
     responseType: "blob",
   });
 };
+export const scoreClassDetailScoreDownload = (datas) => {
+  return $postParam("/api/admin/mark/archive/score/download", datas, {
+    responseType: "blob",
+  });
+};
 export const scoreReport = (datas) => {
   return $postParam("/api/admin/mark/archive/score/report", datas);
 };

+ 31 - 1
src/modules/mark/components/ScoreClassDetail.vue

@@ -168,6 +168,14 @@
           >
             成绩导出
           </el-button>
+          <el-button
+            v-if="checkPrivilege('button', 'DownloadScore')"
+            type="success"
+            :disabled="downloading"
+            @click="toDownloadScore"
+          >
+            成绩下载
+          </el-button>
         </div>
       </div>
 
@@ -270,7 +278,11 @@
 </template>
 
 <script>
-import { scoreClassDetailListPage, scoreClassDetailScoreExport } from "../api";
+import {
+  scoreClassDetailListPage,
+  scoreClassDetailScoreExport,
+  scoreClassDetailScoreDownload,
+} from "../api";
 import SimpleImagePreview from "@/components/SimpleImagePreview";
 import ScoreReportPreview from "./ScoreReportPreview.vue";
 import { downloadByApi } from "@/plugins/download";
@@ -403,6 +415,24 @@ export default {
       if (!res) return;
       this.$message.success("下载成功!");
     },
+    async toDownloadScore() {
+      if (this.downloading) return;
+      this.downloading = true;
+
+      const res = await downloadByApi(() => {
+        return scoreClassDetailScoreDownload({
+          ...this.filter,
+          examId: this.instance.examId,
+          paperNumber: this.instance.paperNumber,
+        });
+      }).catch((e) => {
+        this.$message.error(e || "下载失败,请重新尝试!");
+      });
+      this.downloading = false;
+
+      if (!res) return;
+      this.$message.success("下载成功!");
+    },
     // img view
     async toViewTrack(row) {
       this.toMarkTrack(row.studentId);