Quellcode durchsuchen

feat: 相关校验

zhangjie vor 3 Monaten
Ursprung
Commit
cb79301d2b

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

@@ -92,20 +92,20 @@
           >
         </el-form-item>
         <el-form-item class="form-item-info">
-          <el-checkbox v-model="modalForm.openDoubleMarking"
+          <el-checkbox v-model="modalForm.doubleMarke"
             >是否开启双评</el-checkbox
           >
         </el-form-item>
         <el-form-item class="form-item-info">
-          <el-checkbox v-model="modalForm.openMergeMarker"
+          <el-checkbox v-model="modalForm.mergeMarker"
             >填空题作为一个整体设置评卷员及评卷方式</el-checkbox
           >
         </el-form-item>
-        <el-form-item class="form-item-info">
+        <!-- <el-form-item class="form-item-info">
           <el-checkbox v-model="modalForm.allowCloseBeforeFinish"
             >允许不评卷结束阅卷</el-checkbox
           >
-        </el-form-item>
+        </el-form-item> -->
       </el-form>
       <div slot="footer">
         <el-button type="primary" :disabled="isSubmit" @click="submit"
@@ -145,10 +145,10 @@ const initModalForm = {
   markEndTime: "",
   showObjectScore: false,
   allowMarkByQuestion: false,
-  openDoubleMarking: false,
+  doubleMarke: false,
   autoScroll: false,
-  openMergeMarker: true,
-  allowCloseBeforeFinish: false,
+  mergeMarker: true,
+  // allowCloseBeforeFinish: false,
   passScore: 60,
   excellentScore: 80,
   sheetConfig: [],

+ 30 - 19
src/modules/mark/components/markParam/MarkParamClass.vue

@@ -2,16 +2,13 @@
   <div class="mark-param-class">
     <div class="part-box part-box-pad box-justify">
       <el-form inline>
-        <el-form-item
-          v-if="checkPrivilege('button', 'OpenClassReading', 'MarkSetting')"
-          label="是否开启分班阅卷:"
-        >
+        <el-form-item label="是否开启分班阅卷:">
           <el-radio-group v-model="markClassIsOpen" @change="markClassChange">
             <el-radio-button :label="true">开启</el-radio-button>
             <el-radio-button :label="false">关闭</el-radio-button>
           </el-radio-group>
 
-          <el-breadcrumb class="el-space" separator="|">
+          <el-breadcrumb v-if="markClassIsOpen" class="el-space" separator="|">
             <el-breadcrumb-item
               >班级数:{{ stat.classCount }}个</el-breadcrumb-item
             >
@@ -31,7 +28,7 @@
         <el-button type="primary" @click="toNext">下一步</el-button>
       </div>
     </div>
-    <div class="part-box part-box-pad">
+    <div v-if="markClassIsOpen" class="part-box part-box-pad">
       <el-table :data="dataList" border>
         <el-table-column type="index" width="50"> </el-table-column>
 
@@ -75,11 +72,11 @@
         </template>
       </div>
     </div>
-    <div class="mark-footer">
-      <el-button type="primary" :disabled="loading" @click="submit"
-        >提交</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
+    <div v-else class="part-box part-box-pad">
+      <p class="tips-info">1.分班阅卷即评卷老师评指定班级的卷子;</p>
+      <p class="tips-info">
+        2.如果需要进行分班阅卷,请在点击开启,不需要可以直接点击下一步,进行主观题评卷设置;
+      </p>
     </div>
 
     <!-- SelectClassByCourse -->
@@ -155,6 +152,13 @@ export default {
       this.updateUnsignData();
       this.updateCacheDataMd5();
     },
+    resetData() {
+      this.dataList = [];
+      this.classList = [];
+      this.selectedClassIds = [];
+      this.unsignData = [];
+      this.cacheDataMd5 = "";
+    },
     updateCacheDataMd5() {
       this.cacheDataMd5 = MD5(JSON.stringify(this.dataList));
     },
@@ -177,7 +181,11 @@ export default {
       });
       if (!res) return;
       this.setOpenMarkClass(this.markClassIsOpen);
-      this.initData();
+      if (this.markClassIsOpen) {
+        this.initData();
+      } else {
+        this.resetData();
+      }
     },
     toSelectClass(row) {
       this.curRow = row;
@@ -249,9 +257,12 @@ export default {
       this.updateCacheDataMd5();
       return true;
     },
-    async toPrev() {
-      if (this.cacheDataMd5 === MD5(JSON.stringify(this.dataList))) {
-        this.$emit("prev");
+    async toPrev(step = 1) {
+      if (
+        !this.markClassIsOpen ||
+        this.cacheDataMd5 === MD5(JSON.stringify(this.dataList))
+      ) {
+        this.$emit("prev", step);
         return;
       }
 
@@ -263,18 +274,18 @@ export default {
         }
       ).catch(() => {});
       if (confirm !== "confirm") {
-        this.$emit("prev");
+        this.$emit("prev", step);
         return;
       }
 
       const res = await this.submit();
       if (!res) return;
-      this.$emit("prev");
+      this.$emit("prev", step);
     },
-    async toNext() {
+    async toNext(step = 1) {
       const res = await this.submit();
       if (!res) return;
-      this.$emit("next");
+      this.$emit("next", step);
     },
   },
 };

+ 29 - 6
src/modules/mark/components/markParam/MarkParamGroup.vue

@@ -273,7 +273,7 @@ export default {
       await markSubjectiveBindMarker({
         examId: this.basicInfo.examId,
         paperNumber: this.basicInfo.paperNumber,
-        questionId: this.curRowQuestions.map((item) => item.questionId),
+        questionIds: this.curRowQuestions.map((item) => item.questionId),
         markers: row.markers,
       });
 
@@ -328,7 +328,7 @@ export default {
       );
       if (pos === -1) return;
       const datas = {
-        questionId: row.questionId,
+        id: row.questionId,
         doubleEnable: row.doubleEnable,
         doubleRate: row.doubleRate,
         arbitrateThreshold: row.arbitrateThreshold,
@@ -410,11 +410,34 @@ export default {
       // console.log(combinePictureConfigList);
       return combinePictureConfigList;
     },
-    toPrev() {
-      this.$emit("prev");
+    checkData() {
+      const errorList = [];
+      this.subjectiveTaskList.forEach((item) => {
+        const errors = [];
+        if (item.markers.length) {
+          errors.push("评卷员未设置");
+        }
+        if (!item.pictureConfigs.length) {
+          errors.push("评卷区未设置");
+        }
+        if (errors.length) {
+          errorList.push(
+            `${item.mainNumber}-${item.subNumber}:${errors.join("、")}。`
+          );
+        }
+      });
+      if (errorList.length) {
+        this.$message.error(errorList.join("\n"));
+        return false;
+      }
+      return true;
+    },
+    toPrev(step = 1) {
+      this.$emit("prev", step);
     },
-    toNext() {
-      this.$emit("next");
+    toNext(step = 1) {
+      if (!this.checkData()) return;
+      this.$emit("next", step);
     },
   },
 };

+ 4 - 4
src/modules/mark/components/markParam/MarkParamObjectiveAnswer.vue

@@ -465,9 +465,9 @@ export default {
       this.initData(this.curPaperType);
     },
     // step change
-    async toPrev() {
+    async toPrev(step = 1) {
       if (MD5(JSON.stringify(this.tableDict)) === this.cacheDataMd5) {
-        this.$emit("prev");
+        this.$emit("prev", step);
         return;
       }
 
@@ -479,13 +479,13 @@ export default {
         }
       ).catch(() => {});
       if (confirm !== "confirm") {
-        this.$emit("prev");
+        this.$emit("prev", step);
         return;
       }
 
       const res = await this.submit();
       if (!res) return;
-      this.$emit("prev");
+      this.$emit("prev", step);
     },
   },
 };

+ 7 - 2
src/modules/mark/components/markParam/MarkParamStructure.vue

@@ -20,7 +20,7 @@
       </el-breadcrumb>
 
       <div>
-        <el-button type="primary" @click="submit">下一步</el-button>
+        <el-button type="primary" @click="toNext">下一步</el-button>
       </div>
     </div>
 
@@ -673,7 +673,12 @@ export default {
       if (!res) return;
       this.$message.success("保存成功!");
       this.setPaperStructureInfo(questions);
-      this.$emit("confirm");
+      return true;
+    },
+    async toNext(step = 1) {
+      const res = await this.submit();
+      if (!res) return;
+      this.$emit("next", step);
     },
   },
 };

+ 20 - 11
src/modules/mark/components/markParam/ModifyMarkParams.vue

@@ -40,6 +40,7 @@
 
     <div v-if="dataReady">
       <component
+        ref="paramComponentRef"
         :is="currentComponent"
         @next="nextHandler"
         @prev="prevHandler"
@@ -195,31 +196,39 @@ export default {
     },
     changeStep(ind) {
       if (ind === this.curStepIndex) return;
-      this.curStepIndex = ind;
+      const step = ind - this.curStepIndex;
+      const absStep = Math.abs(step);
+      if (step > 0) {
+        this.$refs.paramComponentRef.toNext(absStep);
+      } else {
+        this.$refs.paramComponentRef.toPrev(absStep);
+      }
     },
-    nextHandler() {
+    nextHandler(step = 1) {
+      // 最后一步如何继续下一步就关闭窗口
       if (this.isLastStep && this.curStep.status === "process") {
         this.close();
         return;
       }
 
+      const nextStepIndex = this.curStepIndex + step;
+      if (nextStepIndex > this.lastStep) return;
+
       this.steps[this.curStepIndex].status = "success";
-      if (
-        this.curStepIndex !== this.steps.length - 1 &&
-        this.steps[this.curStepIndex + 1].status === "wait"
-      ) {
-        this.curStepIndex += 1;
+      if (this.steps[nextStepIndex].status === "wait") {
         this.steps[this.curStepIndex].status = "process";
       }
-
+      this.curStepIndex = nextStepIndex;
       this.steps.forEach((item) => {
         item.disabled = item.status === "wait";
       });
     },
-    prevHandler() {
+    prevHandler(step = 1) {
       if (this.isFirstStep) return;
-      this.curStepIndex -= 1;
-      this.steps[this.curStepIndex].status = "process";
+      const prevStepIndex = this.curStepIndex - step;
+      if (prevStepIndex < 0) return;
+
+      this.curStepIndex = prevStepIndex;
     },
     async cancel() {
       const res = await this.$confirm("确定要退出阅卷参数编辑吗?", "提示", {