Преглед на файлове

feat: 评卷参数设置-主观题填空题

zhangjie преди 3 месеца
родител
ревизия
6ba0f450d0

+ 2 - 2
src/modules/mark/components/ModifyMarkSetting.vue

@@ -97,7 +97,7 @@
           >
         </el-form-item>
         <el-form-item class="form-item-info">
-          <el-checkbox v-model="modalForm.fillBlankAsOne"
+          <el-checkbox v-model="modalForm.openMergeMarker"
             >填空题作为一个整体设置评卷员及评卷方式</el-checkbox
           >
         </el-form-item>
@@ -147,7 +147,7 @@ const initModalForm = {
   allowMarkByQuestion: false,
   openDoubleMarking: false,
   autoScroll: false,
-  fillBlankAsOne: true,
+  openMergeMarker: true,
   allowCloseBeforeFinish: false,
   passScore: 60,
   excellentScore: 80,

+ 79 - 30
src/modules/mark/components/markParam/MarkParamGroup.vue

@@ -15,7 +15,11 @@
     </div>
 
     <div class="part-box part-box-pad">
-      <el-table :data="subjectiveTaskList" border>
+      <el-table
+        :data="subjectiveTaskList"
+        border
+        :span-method="openMergeMarker ? objectSpanMethod : undefined"
+      >
         <el-table-column label="大题名称" prop="mainTitle"> </el-table-column>
         <el-table-column label="大题号" prop="mainNumber"> </el-table-column>
         <el-table-column label="小题号" prop="subNumber"> </el-table-column>
@@ -137,7 +141,6 @@ export default {
       SCORE_POLICY_TYPE,
       questionCount: 0,
       curRow: {},
-      subjectiveQuestionList: [],
       curRowQuestions: [],
       MARK_TYPE: {
         0: "单评",
@@ -145,8 +148,7 @@ export default {
       },
       paperList: [],
       cardPages: [],
-      dataReady: false,
-      deleting: false,
+      fillQuestionRanges: [],
     };
   },
   computed: {
@@ -158,7 +160,7 @@ export default {
     ]),
   },
   mounted() {
-    this.initData();
+    this.initFillQuestionRanges();
     this.getPaperList();
     this.getCardPages();
   },
@@ -189,43 +191,90 @@ export default {
       const cardContent = JSON.parse(detData.content);
       this.cardPages = cardContent.pages;
     },
-    initData() {
-      this.questionCount = this.paperStructureInfo.length;
-      this.subjectiveQuestionList = this.paperStructureInfo
-        .filter((item) => !item.objective)
-        .map((item) => {
+    initFillQuestionRanges() {
+      if (!this.openMergeMarker) return;
+
+      const qRangeDict = {};
+      this.fillQuestionRanges = this.subjectiveTaskList.map((item, index) => {
+        if (item.questionType !== 3) return;
+
+        if (qRangeDict[item.mainNumber]) {
+          qRangeDict[item.mainNumber].push(index);
+        } else {
+          qRangeDict[item.mainNumber] = [index];
+        }
+      });
+      this.fillQuestionRanges = Object.values(qRangeDict);
+    },
+    objectSpanMethod({ rowIndex, columnIndex }) {
+      // 第四列为评卷员
+      if (columnIndex === 3) {
+        const pos = this.fillQuestionRanges.findIndex((item) =>
+          item.includes(rowIndex)
+        );
+        if (pos === -1) return;
+        const range = this.fillQuestionRanges[pos];
+        if (range[0] === rowIndex) {
           return {
-            ...item,
-            qno: `${item.mainNumber}-${item.subNumber}`,
+            rowspan: range.length,
+            colspan: 1,
           };
-        });
-      this.subjectiveQuestionCount = this.subjectiveQuestionList.length;
-      this.objectiveQuestionCount =
-        this.questionCount - this.subjectiveQuestionCount;
-
-      this.dataReady = true;
+        } else {
+          return {
+            rowspan: 0,
+            colspan: 0,
+          };
+        }
+      }
     },
     toSetMarker(row) {
       this.curRow = row;
-      this.curRowQuestions = [
-        {
-          mainNumber: row.mainNumber,
-          subNumber: row.subNumber,
-        },
-      ];
+
+      if (this.openMergeMarker && row.questionType === 3) {
+        // 填空题按大题批量处理
+        const pos = this.subjectiveTaskList.findIndex(
+          (item) => item.questionId === row.questionId
+        );
+        if (pos === -1) return;
+        const range = this.fillQuestionRanges.find((item) =>
+          item.includes(pos)
+        );
+        if (!range) return;
+        this.curRowQuestions = range.map((index) => {
+          const item = this.subjectiveTaskList[index];
+          return {
+            questionId: item.questionId,
+            mainNumber: item.mainNumber,
+            subNumber: item.subNumber,
+          };
+        });
+      } else {
+        // 非填空题按单题处理
+        this.curRowQuestions = [
+          {
+            questionId: row.questionId,
+            mainNumber: row.mainNumber,
+            subNumber: row.subNumber,
+          },
+        ];
+      }
+
       this.$refs.ModifyMarkMarker.open();
     },
     async markMarkerModified(row) {
-      const datas = {
-        questionId: row.questionId,
-        markers: row.markers,
-      };
       await markSubjectiveBindMarker({
         examId: this.basicInfo.examId,
         paperNumber: this.basicInfo.paperNumber,
-        ...datas,
+        questionId: this.curRowQuestions.map((item) => item.questionId),
+        markers: row.markers,
+      });
+
+      this.curRowQuestions.forEach((item) => {
+        this.updateSubjectiveTaskItem({
+          questionId: item.questionId,
+          markers: row.markers,
+        });
       });
-      this.updateSubjectiveTaskItem(datas);
     },
     toSetArea(row) {
       this.curRow = row;

+ 12 - 8
src/modules/mark/components/markParam/MarkParamStructure.vue

@@ -285,6 +285,7 @@ export default {
       loading: false,
       editOpen: false,
       tableKey: "",
+      hasMarkerQuestions: [],
     };
   },
   computed: {
@@ -342,6 +343,9 @@ export default {
     initData() {
       this.tableKey = this.$randomCode();
       this.editOpen = this.structureCanEdit;
+      this.hasMarkerQuestions = this.paperStructureInfo
+        .filter((item) => item.markers.length)
+        .map((item) => `${item.mainNumber}-${item.subNumber}`);
 
       let questionTypeDict = {};
       QUESTION_TYPE_LIST.forEach((item) => {
@@ -476,8 +480,8 @@ export default {
         });
     },
     async toDeleteSub(row) {
-      if (!row.objective && this.checkSubQuestionHasGroup(row)) {
-        this.$message.error("当前小题已有分组,不可删除!");
+      if (!row.objective && this.checkSubQuestionHasMarker(row)) {
+        this.$message.error("当前小题已设置评卷员,不可删除!");
         return;
       }
 
@@ -511,13 +515,13 @@ export default {
       if (!val) return;
       this.curRow = { ...row };
     },
-    checkMainQuestionHasGroup(mainId) {
+    checkMainQuestionHasMarker(mainId) {
       return this.tableData
         .filter((item) => item.mainId === mainId)
-        .some((item) => this.checkSubQuestionHasGroup(item));
+        .some((item) => this.checkSubQuestionHasMarker(item));
     },
-    checkSubQuestionHasGroup(item) {
-      return this.groupQuestions.includes(
+    checkSubQuestionHasMarker(item) {
+      return this.hasMarkerQuestions.includes(
         `${item.mainNumber}-${item.subNumber}`
       );
     },
@@ -531,9 +535,9 @@ export default {
           return;
         }
       } else {
-        if (this.checkMainQuestionHasGroup(row.mainId)) {
+        if (this.checkMainQuestionHasMarker(row.mainId)) {
           row.questionType = this.curRow.questionType;
-          this.$message.error("当前大题已有分组,不可更改");
+          this.$message.error("当前大题已设置评卷员,不可更改");
           return;
         }
       }