Răsfoiți Sursa

期末考试同步

zhangjie 1 an în urmă
părinte
comite
0ac67d5552

+ 4 - 0
src/modules/course/api.js

@@ -57,6 +57,10 @@ export const endScoreEdit = (datas) => {
 export const endScoreSave = (datas) => {
   return $post("/api/admin/course/degree/final_score/save", datas);
 };
+// 成绩管理-期末成绩同步
+export const endScoreSync = (datas) => {
+  return $post("/api/admin/course/degree/final_score/sync", datas);
+};
 // 成绩管理-期末成绩启用/禁用
 export const endScoreEnable = ({ id, enable }) => {
   return $postParam("/api/admin/course/degree/final_score/enable", {

+ 34 - 1
src/modules/course/components/EndScoreManage.vue

@@ -3,7 +3,20 @@
     <div class="part-box part-box-pad box-justify">
       <p></p>
       <div>
-        <el-button type="success" @click="toImport">导入期末成绩</el-button>
+        <el-button
+          type="success"
+          :loading="syncing"
+          :disabled="importing"
+          @click="toSync"
+          >同步成绩</el-button
+        >
+        <el-button
+          type="success"
+          :loading="importing"
+          :disabled="syncing"
+          @click="toImport"
+          >导入期末成绩</el-button
+        >
         <el-button type="success" @click="toSetBlue">设置试卷蓝图</el-button>
       </div>
     </div>
@@ -51,7 +64,9 @@
       :download-handle="downloadHandle"
       :download-filename="dfilename"
       :auto-upload="false"
+      :uploading="uploading"
       @upload-success="uploadSuccess"
+      @upload-error="uploadError"
     ></import-file>
     <!-- SetBlueDialog -->
     <set-blue-dialog ref="SetBlueDialog" :course="course"> </set-blue-dialog>
@@ -63,6 +78,7 @@ import {
   endScoreListPage,
   endScoreEnable,
   endScoreTemplateDownload,
+  endScoreSync,
 } from "../api";
 import ModifyEndScore from "./ModifyEndScore.vue";
 import SetBlueDialog from "./SetBlueDialog.vue";
@@ -92,6 +108,8 @@ export default {
       total: 0,
       dataList: [],
       curRow: {},
+      syncing: false,
+      importing: false,
       // import
       uploadUrl: "/api/admin/course/degree/final_score/import",
       dfilename: "期末成绩导入模板.xlsx",
@@ -130,6 +148,14 @@ export default {
     toImport() {
       this.$refs.ImportFile.open();
     },
+    async toSync() {
+      if (this.syncing) return;
+      this.syncing = true;
+      const res = await endScoreSync(this.filter).catch(() => {});
+      this.syncing = false;
+      if (!res) return;
+      this.$message.success("操作成功!");
+    },
     toSetBlue() {
       this.$refs.SetBlueDialog.open();
     },
@@ -137,11 +163,18 @@ export default {
       this.curRow = { ...row };
       this.$refs.ModifyEndScore.open();
     },
+    uploading() {
+      this.importing = true;
+    },
     uploadSuccess({ data }) {
+      this.importing = false;
       const msg = `${data.success},错误:${data.error}`;
       this.$message.success(msg);
       this.getList();
     },
+    uploadError() {
+      this.importing = false;
+    },
     async downloadHandle() {
       if (this.downloading) return;
       this.downloading = true;