Jelajahi Sumber

feat: 成绩检查新增客观题统分按钮

zhangjie 11 bulan lalu
induk
melakukan
1689a75dbd
2 mengubah file dengan 29 tambahan dan 3 penghapusan
  1. 3 0
      src/modules/mark/api.js
  2. 26 3
      src/modules/mark/views/ScoreCheck.vue

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

@@ -171,6 +171,9 @@ export const packageListPage = (datas) => {
 export const objectiveScoreCalculate = (datas) => {
   return $postParam("/api/admin/mark/student/objective/calculate", datas);
 };
+export const objectiveScoreBatchCalculate = (datas) => {
+  return $postParam("/api/admin/mark/student/objective/calculate_batch", datas);
+};
 export const scoreDetailListExport = (datas) => {
   return $postParam("/api/admin/mark/student/score/export", datas, {
     responseType: "blob",

+ 26 - 3
src/modules/mark/views/ScoreCheck.vue

@@ -18,7 +18,16 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action"></div>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'ObjectiveCalculate')"
+          type="primary"
+          :loading="loading"
+          :disabled="!multipleSelection.length"
+          @click="toObjectiveCalculate"
+          >客观题统分</el-button
+        >
+      </div>
     </div>
 
     <div class="part-box part-box-pad">
@@ -98,7 +107,7 @@
 </template>
 
 <script>
-import { scoreCheckListPage } from "../api";
+import { scoreCheckListPage, objectiveScoreBatchCalculate } from "../api";
 import ScoreCheckDetail from "../components/ScoreCheckDetail.vue";
 import ScoreCheckSign from "../components/ScoreCheckSign.vue";
 
@@ -121,6 +130,7 @@ export default {
       curRow: {},
       multipleSelection: [],
       downloading: false,
+      loading: false,
       // img view
       curImage: {},
       curImageIndex: 0,
@@ -150,8 +160,21 @@ export default {
     search() {
       this.toPage(1);
     },
+    async toObjectiveCalculate() {
+      if (this.loading) return;
+      this.loading = true;
+
+      const res = await objectiveScoreBatchCalculate({
+        ids: this.multipleSelection.join(),
+      }).catch(() => {});
+      this.loading = false;
+
+      if (!res) return;
+      this.$message.success("操作成功!");
+      this.getList();
+    },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
+      this.multipleSelection = val.map((item) => item.markPaperId);
     },
     toDetail(row) {
       this.curRow = row;