Browse Source

成绩归档接口调整

zhangjie 3 năm trước cách đây
mục cha
commit
cd855754d9
2 tập tin đã thay đổi với 18 bổ sung9 xóa
  1. 3 0
      src/modules/stmms/api.js
  2. 15 9
      src/modules/stmms/views/ScoreArchive.vue

+ 3 - 0
src/modules/stmms/api.js

@@ -19,6 +19,9 @@ export const scoreExport = datas => {
 export const scoreSync = datas => {
   return $postParam("/api/admin/sync/score/sync", datas);
 };
+export const scorePreview = id => {
+  return $postParam("/api/admin/sync/score/preview", { id });
+};
 export const scoreDownload = id => {
   return $postParam(
     "/api/admin/sync/score/download",

+ 15 - 9
src/modules/stmms/views/ScoreArchive.vue

@@ -46,7 +46,7 @@
           <el-button
             v-if="checkPrivilege('button', 'select')"
             type="primary"
-            :disabled="!filter.semesterId"
+            :disabled="!filter.semesterId || !filter.courseCode"
             @click="toPage(1)"
             >查询</el-button
           >
@@ -57,7 +57,7 @@
           type="success"
           icon="el-icon-refresh"
           :loading="syncLoading"
-          :disabled="!filter.semesterId"
+          :disabled="!filter.semesterId || !filter.courseCode"
           @click="toSync"
           >同步</el-button
         >
@@ -66,7 +66,7 @@
           type="primary"
           icon="el-icon-download"
           :loading="loading"
-          :disabled="!filter.semesterId"
+          :disabled="!filter.semesterId || !filter.courseCode"
           @click="toDownloadAll"
           >一键下载</el-button
         >
@@ -75,7 +75,7 @@
           type="primary"
           icon="el-icon-download"
           :loading="exportLoading"
-          :disabled="!filter.semesterId"
+          :disabled="!filter.semesterId || !filter.courseCode"
           @click="toExport"
           >成绩导出</el-button
         >
@@ -151,7 +151,8 @@ import {
   scoreExport,
   scoreBatchDownload,
   scoreDownload,
-  scoreSync
+  scoreSync,
+  scorePreview
 } from "../api";
 // import { downloadPaper } from "../components/downloadPaper";
 import { downloadByApi } from "@/plugins/download";
@@ -208,7 +209,8 @@ export default {
       if (this.syncLoading) return;
       this.syncLoading = true;
       const res = await scoreSync({
-        semesterId: this.filter.semesterId
+        semesterId: this.filter.semesterId,
+        courseCode: this.filter.courseCode
       }).catch(() => {});
       this.syncLoading = false;
       if (!res) return;
@@ -249,13 +251,17 @@ export default {
       this.$message.success("下载成功!");
     },
     // img view
-    toViewPaper(row) {
-      if (!row.sheetUrls) {
+    async toViewPaper(row) {
+      const res = await scorePreview(row.id).catch(() => {});
+      if (!res) return;
+
+      if (!res.length) {
         this.$message.error("原卷缺失!");
         return;
       }
+
       this.curImageIndex = 0;
-      this.imageList = JSON.parse(row.sheetUrls).map((item, index) => {
+      this.imageList = res.map((item, index) => {
         return { url: item, name: index + 1 };
       });
       this.selectImage(this.curImageIndex);