浏览代码

评卷设置

zhangjie 1 年之前
父节点
当前提交
22469bc8b3

+ 1 - 0
card/mixins/exchange.js

@@ -379,6 +379,7 @@ export default {
         top: pageT,
       } = this.curPageOffsetInfo;
 
+      // [x,y,w,h]
       const infos = [
         (domL - pageL) / pageW,
         (domT - pageT) / pageH,

+ 4 - 0
src/assets/styles/element-ui-costom.scss

@@ -142,6 +142,10 @@
         line-height: 1;
       }
     }
+
+    &.form-item-info {
+      margin-bottom: 0;
+    }
   }
   // form-info
   &.form-info {

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

@@ -18,6 +18,9 @@ export const markSettingDetail = (datas) => {
 export const markSettingSave = (datas) => {
   return $post("/api/admin/mark/setting/paper/save", datas);
 };
+export const markSettingBatchSave = (datas) => {
+  return $post("/api/admin/mark/setting/paper/batch-save", datas);
+};
 // mark-params --------->
 // structure
 export const markStructureList = (datas) => {

+ 94 - 23
src/modules/mark/components/ModifyMarkSetting.vue

@@ -3,7 +3,7 @@
     <el-dialog
       class="modify-mark-setting"
       :visible.sync="modalIsShow"
-      title="评卷设置"
+      :title="title"
       top="10px"
       width="660px"
       :close-on-click-modal="false"
@@ -17,7 +17,7 @@
         :model="modalForm"
         :rules="rules"
         :key="modalForm.paperNumber"
-        label-width="160px"
+        label-width="120px"
       >
         <el-form-item prop="markMode" label="评卷模式:">
           <el-select v-model="modalForm.markMode">
@@ -44,15 +44,6 @@
           >
           </el-date-picker>
         </el-form-item>
-        <!-- <el-form-item label="小助手原卷:">
-          <el-checkbox v-model="modalForm.sheetView"></el-checkbox>
-        </el-form-item> -->
-        <el-form-item label="评卷是否显示客观分:">
-          <el-checkbox v-model="modalForm.showObjectScore"></el-checkbox>
-        </el-form-item>
-        <el-form-item label="评卷提交自动定位:">
-          <el-checkbox v-model="modalForm.autoScroll"></el-checkbox>
-        </el-form-item>
         <el-form-item prop="passScore" label="及格分:">
           <el-input-number
             style="width: 125px"
@@ -77,7 +68,7 @@
           ></el-input-number>
           <span class="ml-1">%</span>
         </el-form-item>
-        <el-form-item prop="sheetConfig" label="原图遮盖:">
+        <el-form-item v-if="!isMultiple" prop="sheetConfig" label="原图遮盖:">
           <el-button
             class="btn-act-primary"
             type="text"
@@ -85,12 +76,32 @@
             >设置</el-button
           >
           <i
-            v-if="modalForm.sheetConfig.length"
+            v-if="modalForm.sheetConfig?.length"
             class="el-icon-success color-success ml-1"
           ></i>
         </el-form-item>
-        <el-form-item label="是否开启双评:">
-          <el-checkbox v-model="modalForm.openDoubleMarking"></el-checkbox>
+        <!-- <el-form-item label="小助手原卷:">
+          <el-checkbox v-model="modalForm.sheetView"></el-checkbox>
+        </el-form-item> -->
+        <el-form-item class="form-item-info">
+          <el-checkbox v-model="modalForm.showObjectScore"
+            >评卷显示客观分</el-checkbox
+          >
+        </el-form-item>
+        <el-form-item class="form-item-info">
+          <el-checkbox v-model="modalForm.autoScroll"
+            >评卷提交自动定位</el-checkbox
+          >
+        </el-form-item>
+        <el-form-item class="form-item-info">
+          <el-checkbox v-model="modalForm.openReject"
+            >成绩检查是否允许打回</el-checkbox
+          >
+        </el-form-item>
+        <el-form-item class="form-item-info">
+          <el-checkbox v-model="modalForm.openDoubleMarking"
+            >是否开启双评</el-checkbox
+          >
         </el-form-item>
       </el-form>
       <div slot="footer">
@@ -114,9 +125,12 @@
 <script>
 import {
   markSettingSave,
+  markSettingBatchSave,
   markSettingDetail,
   examStructureFindJpg,
 } from "../api";
+import { cardDetail } from "../../card/api";
+
 import { MARK_MODE_TYPE } from "@/constants/enumerate";
 import ModifyPaperArea from "./ModifyPaperArea.vue";
 import pickerOptions from "@/constants/datePickerOptions";
@@ -131,6 +145,7 @@ const initModalForm = {
   showObjectScore: false,
   openDoubleMarking: false,
   autoScroll: false,
+  openReject: false,
   passScore: 60,
   excellentScore: 80,
   sheetConfig: [],
@@ -146,6 +161,12 @@ export default {
         return {};
       },
     },
+    multipleInst: {
+      type: Array,
+      default() {
+        return [];
+      },
+    },
   },
   data() {
     return {
@@ -189,6 +210,14 @@ export default {
       pickerOptions,
     };
   },
+  computed: {
+    isMultiple() {
+      return !!this.multipleInst.length;
+    },
+    title() {
+      return this.isMultiple ? "评卷批量设置" : "评卷设置";
+    },
+  },
   methods: {
     async getPaperList() {
       this.paperList = [];
@@ -208,6 +237,11 @@ export default {
       });
     },
     async initData(val) {
+      if (this.isMultiple) {
+        this.modalForm = { ...initModalForm };
+        this.markTime = [undefined, undefined];
+        return;
+      }
       await this.getPaperList();
       const res = await markSettingDetail({
         examId: this.instance.examId,
@@ -218,11 +252,35 @@ export default {
         this.modalForm.markStartTime || undefined,
         this.modalForm.markEndTime || undefined,
       ];
-      const sheetConfig = res.sheetConfig || "[]";
-      this.modalForm.sheetConfig = JSON.parse(sheetConfig);
+      if (res.sheetConfig) {
+        this.modalForm.sheetConfig = JSON.parse(res.sheetConfig);
+      } else {
+        this.modalForm.sheetConfig = await this.getDefaultSheetConfig();
+      }
+
       this.modalForm.passScore = this.modalForm.passScore || 60;
       this.modalForm.excellentScore = this.modalForm.excellentScore || 80;
     },
+    async getDefaultSheetConfig() {
+      const detData = await cardDetail(this.instance.cardId);
+      const cardContent = JSON.parse(detData.content);
+      const areas = [];
+      cardContent.pages.forEach((item, index) => {
+        if (item.exchange.info_area && item.exchange.info_area.length) {
+          item.exchange.info_area.forEach((area) => {
+            const [x, y, w, h] = area;
+            areas.push({
+              i: index + 1,
+              x,
+              y,
+              w,
+              h,
+            });
+          });
+        }
+      });
+      return areas;
+    },
     visibleChange() {
       this.initData(this.instance);
     },
@@ -253,15 +311,28 @@ export default {
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      const data = { ...this.modalForm };
-      data.sheetConfig = JSON.stringify(data.sheetConfig);
-      const res = await markSettingSave(data).catch(() => {
-        this.isSubmit = false;
-      });
 
-      if (!res) return;
+      let res = null;
+      if (this.isMultiple) {
+        const datas = {
+          list: this.multipleInst.map((item) => {
+            return {
+              examId: item.examId,
+              paperNumber: item.paperNumber,
+            };
+          }),
+          config: { ...this.modalForm },
+        };
+        res = await markSettingBatchSave(datas).catch(() => {});
+      } else {
+        const data = { ...this.modalForm };
+        data.sheetConfig = JSON.stringify(data.sheetConfig);
+        res = await markSettingSave(data).catch(() => {});
+      }
 
       this.isSubmit = false;
+      if (!res) return;
+
       this.$message.success("修改成功!");
       this.$emit("modified");
       this.cancel();

+ 8 - 2
src/modules/mark/views/MarkSetting.vue

@@ -34,7 +34,7 @@
         <div></div>
         <div>
           <el-button
-            v-if="checkPrivilege('button', 'add')"
+            v-if="checkPrivilege('button', 'MarkConfig')"
             type="primary"
             :disabled="!multipleSelection.length"
             @click="toBatchModifySetting"
@@ -151,6 +151,7 @@
     <modify-mark-setting
       ref="ModifyMarkSetting"
       :instance="curRow"
+      :multiple-inst="multipleInst"
       @modified="getList"
     ></modify-mark-setting>
     <!-- ModifyMarkParams -->
@@ -224,6 +225,7 @@ export default {
       curExam: {},
       multipleSelection: [],
       questionType: "",
+      multipleInst: [],
     };
   },
   computed: {
@@ -258,7 +260,7 @@ export default {
       this.curExam = val;
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val.map((item) => item.id);
+      this.multipleSelection = val;
     },
     toSetParams(row) {
       this.curRow = row;
@@ -266,6 +268,7 @@ export default {
     },
     toModifySetting(row) {
       this.curRow = row;
+      this.multipleInst = [];
       this.$refs.ModifyMarkSetting.open();
     },
     toBatchModifySetting() {
@@ -273,6 +276,9 @@ export default {
         this.$message.error("请选择数据");
         return;
       }
+      this.curRow = {};
+      this.multipleInst = [...this.multipleSelection];
+      this.$refs.ModifyMarkSetting.open();
     },
     toImportSubjective() {
       this.$refs.ImportSubjectiveFile.open();