Bladeren bron

设置评卷员

zhangjie 2 jaren geleden
bovenliggende
commit
5c7244516a

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

@@ -24,6 +24,9 @@ export const updateObjectiveAnswer = datas => {
 export const examBindMarkLeader = datas => {
   return $post("/api/admin/exam/structure/bind_mark_leader", datas);
 };
+export const examBindMarker = datas => {
+  return $post("/api/admin/exam/structure/bind_marker", datas);
+};
 
 // score-archive
 export const scoreListPage = datas => {

+ 44 - 8
src/modules/stmms/components/markParam/MarkPaperMarker.vue

@@ -20,7 +20,9 @@
         >道,主观题<span class="mlr-1">{{ subjectiveQuestionCount }}</span
         >道,主观题已全部设置评卷员!
       </p>
-      <el-button type="primary" @click="toAdd">新增</el-button>
+      <el-button v-if="!onlyMarker" type="primary" @click="toAdd"
+        >新增</el-button
+      >
     </div>
 
     <el-table :data="groupInfo" border>
@@ -37,7 +39,7 @@
           </el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="评卷方式">
+      <el-table-column v-if="!onlyMarker" label="评卷方式">
         <template slot-scope="scope">
           <el-radio-group v-model="scope.row.doubleRate">
             <el-radio
@@ -67,7 +69,12 @@
           {{ scope.row.questions | questionsFilter }}
         </template>
       </el-table-column>
-      <el-table-column label="评卷区" width="80" align="center">
+      <el-table-column
+        v-if="!onlyMarker"
+        label="评卷区"
+        width="80"
+        align="center"
+      >
         <template slot-scope="scope">
           <i
             v-if="scope.row.pictureConfigList.length"
@@ -81,13 +88,18 @@
             >编辑</el-button
           >
           <el-button
+            v-if="!onlyMarker"
             class="btn-primary"
             type="text"
             :disabled="!paperList.length"
             @click="toSetArea(scope.row)"
             >评卷区</el-button
           >
-          <el-button class="btn-danger" type="text" @click="toDelete(scope.row)"
+          <el-button
+            v-if="!onlyMarker"
+            class="btn-danger"
+            type="text"
+            @click="toDelete(scope.row)"
             >删除</el-button
           >
         </template>
@@ -104,6 +116,7 @@
     ></modify-marker-question>
     <!-- ModifyMarkArea -->
     <modify-mark-area
+      v-if="!onlyMarker"
       ref="ModifyMarkArea"
       :base-info="datas.basicPaperInfo"
       :group="curGroupInfo"
@@ -116,7 +129,7 @@
 <script>
 import ModifyMarkerQuestion from "./ModifyMarkerQuestion";
 import ModifyMarkArea from "./ModifyMarkArea.vue";
-import { examStructureFindJpg } from "../../api";
+import { examStructureFindJpg, examBindMarker } from "../../api";
 
 export default {
   name: "mark-paper-marker",
@@ -131,6 +144,10 @@ export default {
           groupInfo: []
         };
       }
+    },
+    onlyMarker: {
+      type: Boolean,
+      default: false
     }
   },
   data() {
@@ -157,7 +174,7 @@ export default {
   },
   mounted() {
     this.initData();
-    this.getPaperList();
+    if (!this.onlyMarker) this.getPaperList();
   },
   methods: {
     async getPaperList() {
@@ -178,8 +195,8 @@ export default {
       });
     },
     initData() {
-      this.groupInfo = this.datas.groupInfo.map(item => {
-        return { ...item };
+      this.groupInfo = this.datas.groupInfo.map((item, index) => {
+        return { ...item, groupNumber: index + 1 };
       });
       this.questionCount = this.datas.paperStructureInfo.length;
       this.updateDisableQuestionIds();
@@ -207,6 +224,11 @@ export default {
       this.disabledQuestionIds = disabledQuestionIds;
       if (!filterId) this.groupQuestionCount = disabledQuestionIds.length;
     },
+    updateGroupNumber() {
+      this.groupInfo.forEach((group, index) => {
+        group.groupNumber = index + 1;
+      });
+    },
     toAdd() {
       this.updateDisableQuestionIds();
       if (this.groupQuestionCount === this.subjectiveQuestionCount) {
@@ -216,6 +238,7 @@ export default {
 
       this.curGroupInfo = {
         id: this.$randomCode(),
+        groupNumber: null,
         markerList: [],
         doubleRate: 0,
         arbitrateThreshold: 1,
@@ -237,6 +260,7 @@ export default {
       const pos = this.groupInfo.findIndex(item => item.id === row.id);
       this.groupInfo.splice(pos, 1);
       this.updateDisableQuestionIds();
+      this.updateGroupNumber();
     },
     groupModified(row) {
       const pos = this.groupInfo.findIndex(item => item.id === row.id);
@@ -246,6 +270,18 @@ export default {
         this.groupInfo.splice(pos, 1, row);
       }
       this.updateDisableQuestionIds();
+      this.updateGroupNumber();
+
+      if (this.onlyMarker) {
+        this.updateGroupMarker(row);
+      }
+    },
+    async updateGroupMarker(group) {
+      console.log(group);
+      await examBindMarker({
+        paperStructureId: this.datas.basicPaperInfo.id,
+        groupInfo: group
+      });
     },
     areaModified(row) {
       const pos = this.groupInfo.findIndex(item => item.id === row.id);

+ 103 - 0
src/modules/stmms/components/markParam/ModifyPaperMarker.vue

@@ -0,0 +1,103 @@
+<template>
+  <el-dialog
+    class="modify-mark-params"
+    :visible.sync="modalIsShow"
+    title="评卷员设置"
+    top="0"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    fullscreen
+    @open="visibleChange"
+    @close="dialogClose"
+  >
+    <div class="mark-body" v-if="dataReady">
+      <mark-paper-marker
+        ref="MarkPaperMarker"
+        :datas="infos"
+        only-marker
+      ></mark-paper-marker>
+    </div>
+
+    <div slot="footer"></div>
+  </el-dialog>
+</template>
+
+<script>
+import MarkPaperMarker from "./MarkPaperMarker.vue";
+// import paramData from "./paramData";
+import { calcSum } from "@/plugins/utils";
+
+export default {
+  name: "modify-mark-params",
+  components: { MarkPaperMarker },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      infos: {
+        basicPaperInfo: {},
+        paperStructureInfo: [],
+        groupInfo: [],
+        paperStat: {}
+      },
+      dataReady: false
+    };
+  },
+  methods: {
+    dialogClose() {
+      this.dataReady = false;
+    },
+    visibleChange() {
+      if (!this.instance.paperInfoJson) return;
+
+      const { paperStructureInfo, groupInfo } = JSON.parse(
+        this.instance.paperInfoJson
+      );
+      this.infos = {
+        paperStructureInfo: [
+          ...paperStructureInfo.objectiveQuestionList,
+          ...paperStructureInfo.subjectiveQuestionList
+        ],
+        groupInfo,
+        basicPaperInfo: { ...this.instance }
+      };
+      this.infos.paperStat = this.statPaperStructure(
+        this.infos.paperStructureInfo
+      );
+
+      this.dataReady = true;
+    },
+    statPaperStructure(paperStructureInfo) {
+      const questionCount = paperStructureInfo.length;
+
+      const subjectiveQuestionCount = paperStructureInfo.filter(
+        item => item.qType === "subjective"
+      ).length;
+
+      return {
+        questionCount,
+        paperTotalScore: calcSum(
+          paperStructureInfo.map(item => item.totalScore || 0)
+        ),
+        subjectiveQuestionCount,
+        objectiveQuestionCount: questionCount - subjectiveQuestionCount,
+        structChanged: false
+      };
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    }
+  }
+};
+</script>

+ 21 - 1
src/modules/stmms/views/UploadStructure.vue

@@ -89,6 +89,15 @@
               @click="toBindMarkLeader(scope.row)"
               >绑定科组长</el-button
             >
+            <el-button
+              class="btn-primary"
+              type="text"
+              :disabled="
+                !scope.row.paperInfoJson || scope.row.taskStatus === 'RUNNING'
+              "
+              @click="toBindMarker(scope.row)"
+              >绑定评卷员</el-button
+            >
             <el-button
               v-if="checkPrivilege('link', 'Upload')"
               class="btn-primary"
@@ -134,6 +143,11 @@
       :instance="curTask"
       @modified="delayUpdateList"
     />
+    <ModifyPaperMarker
+      ref="ModifyPaperMarker"
+      :instance="curTask"
+      @modified="delayUpdateList"
+    />
     <ModifyObjectiveAnswer
       ref="ModifyObjectiveAnswer"
       :instance="curTask"
@@ -154,6 +168,7 @@ import { examStructureListPage, examBindMarkLeader } from "../api";
 import UploadPaperAnswerDialog from "../components/UploadPaperAnswerDialog";
 import ModifyMarkParams from "../components/markParam/ModifyMarkParams";
 import ModifyObjectiveAnswer from "../components/markParam/ModifyObjectiveAnswer.vue";
+import ModifyPaperMarker from "../components/markParam/ModifyPaperMarker.vue";
 import SelectTypeUser from "../components/SelectTypeUser.vue";
 
 export default {
@@ -162,7 +177,8 @@ export default {
     UploadPaperAnswerDialog,
     ModifyMarkParams,
     ModifyObjectiveAnswer,
-    SelectTypeUser
+    SelectTypeUser,
+    ModifyPaperMarker
   },
   data() {
     return {
@@ -235,6 +251,10 @@ export default {
       this.curMarkLeaders = markLeaders.map(item => item.id);
       this.$refs.SelectTypeUser.open();
     },
+    toBindMarker(row) {
+      this.curTask = row;
+      this.$refs.ModifyPaperMarker.open();
+    },
     async headerBind(users) {
       await examBindMarkLeader({
         id: this.curTask.id,