浏览代码

519新需求

zhangjie 3 年之前
父节点
当前提交
ab9cbaf8ab

+ 10 - 0
src/api/invigilation.js

@@ -175,6 +175,16 @@ export function invigilationHistoryList(datas) {
     {}
     {}
   );
   );
 }
 }
+export function exportInvigilationHistory(datas) {
+  const data = pickBy(datas, paramFilter);
+  return httpApp.post(
+    "/api/admin/invigilate/history/list/export?" + object2QueryString(data),
+    {},
+    {
+      responseType: "blob",
+    }
+  );
+}
 
 
 // warning-manage
 // warning-manage
 export function invigilationWarningList(datas) {
 export function invigilationWarningList(datas) {

+ 3 - 1
src/constant/constants.js

@@ -15,6 +15,7 @@ export const EXAM_STUDENT_IMPORT_TEMPLATE_DOWNLOAD_URL =
 
 
 // 交卷方式
 // 交卷方式
 export const STUDENT_FINISH_EXAM_TYPE = {
 export const STUDENT_FINISH_EXAM_TYPE = {
+  ALL: "全部",
   MANUAL: "手动交卷",
   MANUAL: "手动交卷",
   AUTO: "自动交卷",
   AUTO: "自动交卷",
   BREACH: "违纪交卷",
   BREACH: "违纪交卷",
@@ -51,7 +52,8 @@ export const VIDEO_SOURCE_TYPE = {
 export const STUDENT_ONLINE_STATUS = {
 export const STUDENT_ONLINE_STATUS = {
   FIRST_PREPARE: "已待考",
   FIRST_PREPARE: "已待考",
   EXAMING: "考试中",
   EXAMING: "考试中",
-  BREAK_OFF: "通讯故障",
+  BREAK_OFF: "已中断",
+  UN_FINISH: "未参加考试",
 };
 };
 // 违纪、缺考
 // 违纪、缺考
 export const STUDENT_BEHAVIOR_STATUS = {
 export const STUDENT_BEHAVIOR_STATUS = {

+ 20 - 0
src/features/invigilation/InvigilationDetail/InvigilationDetail.vue

@@ -170,6 +170,9 @@
             <el-button type="primary" @click="changeFilter">{{
             <el-button type="primary" @click="changeFilter">{{
               showAdvancedFilter ? "隐藏高级查询" : "高级查询"
               showAdvancedFilter ? "隐藏高级查询" : "高级查询"
             }}</el-button>
             }}</el-button>
+            <el-button type="primary" :loading="isDownload" @click="toExport"
+              >导出</el-button
+            >
           </el-form-item>
           </el-form-item>
         </el-form>
         </el-form>
       </div>
       </div>
@@ -244,7 +247,9 @@ import {
   examBatchList,
   examBatchList,
   examActivityRoomList,
   examActivityRoomList,
   invigilationHistoryList,
   invigilationHistoryList,
+  exportInvigilationHistory,
 } from "@/api/invigilation";
 } from "@/api/invigilation";
+import { downloadBlob } from "@/utils/utils";
 import {
 import {
   STUDENT_FINISH_EXAM_TYPE,
   STUDENT_FINISH_EXAM_TYPE,
   STUDENT_ONLINE_STATUS,
   STUDENT_ONLINE_STATUS,
@@ -285,6 +290,7 @@ export default {
       examRooms: [],
       examRooms: [],
       examCourses: [],
       examCourses: [],
       dataList: [],
       dataList: [],
+      isDownload: false,
     };
     };
   },
   },
   computed: {
   computed: {
@@ -345,6 +351,20 @@ export default {
         this.setDetailIds([...new Set(ids)]);
         this.setDetailIds([...new Set(ids)]);
       }
       }
     },
     },
+    async toExport() {
+      this.isDownload = true;
+      const res = await downloadBlob(() => {
+        return exportInvigilationHistory(this.filter);
+      }).catch(() => {});
+
+      this.isDownload = false;
+
+      if (res) {
+        this.$message.success("导出成功!");
+      } else {
+        this.$message.error("导出失败,请重新尝试!");
+      }
+    },
     async getExamBatchList() {
     async getExamBatchList() {
       const userId = this.IS_INVIGILATE ? this.user.id : null;
       const userId = this.IS_INVIGILATE ? this.user.id : null;
       const res = await examBatchList(userId);
       const res = await examBatchList(userId);

+ 3 - 3
src/features/invigilation/common/SummaryLine.vue

@@ -73,7 +73,7 @@ const paramInfo = {
     unit: "人",
     unit: "人",
   },
   },
   unfinish: {
   unfinish: {
-    name: "未完成",
+    name: "未参加考试",
     param: "notComplete",
     param: "notComplete",
     desc: "某科次完成“交卷”的考试次数为0。",
     desc: "某科次完成“交卷”的考试次数为0。",
     pointType: "danger",
     pointType: "danger",
@@ -81,8 +81,8 @@ const paramInfo = {
   },
   },
 };
 };
 const types = {
 const types = {
-  trouble: ["all", "prepare", "exam", "trouble"],
-  complete: ["all", "prepare", "exam", "complete"],
+  trouble: ["all", "prepare", "exam", "trouble", "unfinish"],
+  complete: ["all", "prepare", "exam", "complete", "unfinish"],
   progress: ["all", "finish", "prepare", "unfinish"],
   progress: ["all", "finish", "prepare", "unfinish"],
 };
 };
 
 

+ 17 - 1
src/utils/utils.js

@@ -91,6 +91,19 @@ export function objAssign(target, sources) {
   return targ;
   return targ;
 }
 }
 
 
+function parseDownloadFilename(dispositionInfo) {
+  const strs = dispositionInfo.split(";");
+  let filename = "";
+  strs
+    .map((item) => item.split("="))
+    .find((item) => {
+      if (item[0].indexOf("filename") !== -1) {
+        filename = decodeURI(item[1]);
+      }
+    });
+  return filename;
+}
+
 /**
 /**
  * 文件流下载
  * 文件流下载
  * @param {Function} fetchFunc 下载程序,返回promise
  * @param {Function} fetchFunc 下载程序,返回promise
@@ -100,9 +113,12 @@ export async function downloadBlob(fetchFunc, fileName) {
   const res = await fetchFunc().catch(() => {});
   const res = await fetchFunc().catch(() => {});
   if (!res) return;
   if (!res) return;
 
 
+  const filename =
+    fileName || parseDownloadFilename(res.headers["content-disposition"]);
+
   const blobUrl = URL.createObjectURL(new Blob([res.data]));
   const blobUrl = URL.createObjectURL(new Blob([res.data]));
   let a = document.createElement("a");
   let a = document.createElement("a");
-  a.download = fileName;
+  a.download = filename;
   a.href = blobUrl;
   a.href = blobUrl;
   document.body.appendChild(a);
   document.body.appendChild(a);
   a.click();
   a.click();