Explorar o código

阅卷任务数

xiatian %!s(int64=3) %!d(string=hai) anos
pai
achega
66cc4d64c7
Modificáronse 2 ficheiros con 137 adicións e 14 borrados
  1. 114 2
      src/modules/marking/views/MarkerDetail.vue
  2. 23 12
      src/modules/marking/views/Marking.vue

+ 114 - 2
src/modules/marking/views/MarkerDetail.vue

@@ -61,9 +61,14 @@
           >
             <el-table-column label="课程名称" width="200" prop="name" />
             <el-table-column label="课程代码" min-width="100" prop="code" />
+            <el-table-column
+              label="设置任务数"
+              min-width="100"
+              prop="limitCount"
+            />
             <el-table-column
               label="已评数量"
-              min-width="200"
+              min-width="100"
               prop="markedCount"
               sortable
             />
@@ -81,6 +86,19 @@
                 </div>
               </template>
             </el-table-column>
+            <el-table-column :context="_self" width="250" label="操作">
+              <template slot-scope="scope">
+                <div class="pull-left">
+                  <el-button
+                    type="primary"
+                    size="mini"
+                    plain
+                    @click="openStepModel(scope.row)"
+                    >设置任务数</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column>
           </el-table>
           <div class="page pull-right">
             <el-pagination
@@ -95,6 +113,37 @@
             ></el-pagination>
           </div>
         </div>
+        <el-dialog
+          title="设置任务数"
+          width="500px"
+          :visible.sync="stepModel"
+          :close-on-click-modal="false"
+          @close="closeStepModel"
+        >
+          <el-form
+            ref="stepForm"
+            :key="stepModelKey"
+            :inline="true"
+            :model="stepForm"
+            :rules="stepRules"
+          >
+            <el-row>
+              <el-form-item label="设置任务数" prop="limitCount">
+                <el-input v-model="stepForm.limitCount" size="mini"></el-input>
+              </el-form-item>
+            </el-row>
+            <div style="margin-bottom: 20px"></div>
+            <el-row class="pull-center">
+              <el-button
+                type="primary"
+                :loading="stepForm.loading"
+                @click="subStep"
+                >确定</el-button
+              >
+              <el-button @click="closeStepModel">取消</el-button>
+            </el-row>
+          </el-form>
+        </el-dialog>
       </div>
     </section>
   </div>
@@ -104,6 +153,15 @@
 import { MARKING_API } from "@/constants/constants";
 import { mapState } from "vuex";
 import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
+
+let reg = /^[1-9][0-9]*$/;
+let validateLimitCount = (rule, value, callback) => {
+  if (value && !reg.test(value)) {
+    callback(new Error("设置任务数必须是正整数"));
+  } else {
+    callback();
+  }
+};
 export default {
   components: {
     LinkTitlesCustom,
@@ -122,6 +180,23 @@ export default {
       loading: true,
       workId: "",
       courseCode: "",
+      stepModel: false,
+      stepModelKey: Math.random(),
+      stepForm: {
+        workId: null,
+        courseCode: null,
+        limitCount: null,
+        loading: false,
+      },
+      stepRules: {
+        limitCount: [
+          {
+            required: false,
+            validator: validateLimitCount,
+            trigger: "change",
+          },
+        ],
+      },
     };
   },
   computed: {
@@ -129,11 +204,48 @@ export default {
   },
   created() {
     this.workId = this.$route.params.workId;
-    this.userName = this.$route.params.userName;
     this.userId = this.$route.params.markerId;
     this.initSetting();
   },
   methods: {
+    openStepModel(row) {
+      this.stepForm.limitCount = row.limitCount;
+      this.stepForm.workId = row.workId;
+      this.stepForm.courseCode = row.code;
+      this.stepModel = true;
+    },
+    closeStepModel() {
+      this.stepModel = false;
+      this.stepModelKey = Math.random();
+    },
+    async subStep() {
+      let res = await this.$refs.stepForm.validate();
+      if (!res) {
+        return;
+      }
+      this.stepForm.loading = true;
+      var url =
+        MARKING_API +
+        "/markCourses/task-limit?workId=" +
+        this.stepForm.workId +
+        "&courseCode=" +
+        this.stepForm.courseCode +
+        "&userId=" +
+        this.userId +
+        "&limitCount=" +
+        this.stepForm.limitCount;
+      this.$httpWithMsg
+        .put(url)
+        .then(() => {
+          this.$notify({
+            type: "success",
+            message: "设置成功!",
+          });
+          this.closeStepModel();
+          this.initSetting();
+        })
+        .finally(() => (this.stepForm.loading = false));
+    },
     exportIt() {
       var key = this.user.key;
       var token = this.user.token;

+ 23 - 12
src/modules/marking/views/Marking.vue

@@ -344,7 +344,7 @@ export default {
         return 0;
       } else {
         for (let [index, task] of this.tasks.entries()) {
-          if (task.leftCount > 0) {
+          if (task.leftCount > 0 && !task.exceedLimit) {
             return index;
           }
         }
@@ -468,7 +468,10 @@ export default {
           //切换任务提交试卷后,继续维持该任务
           if (self.changeTaskCur != self.taskCur) {
             //切换任务评完后,继续跳转原来的任务
-            if (self.tasks[self.changeTaskCur].leftCount == 0) {
+            if (
+              self.tasks[self.changeTaskCur].leftCount == 0 ||
+              self.tasks[self.changeTaskCur].exceedLimit
+            ) {
               if (self.tasks[self.taskCur]) {
                 self.task = self.tasks[self.taskCur];
               }
@@ -545,20 +548,28 @@ export default {
       await self.$http
         .get(DATA_PROCESS_API + "/studentPapers?markTaskId=" + self.task.id)
         .then((response) => {
-          if (!response.data) {
-            self.$notify({
-              message: "该任务下试卷已评完,如有剩余任务将自动切换任务",
-              type: "warning",
-            });
+          if (response.data.resultCode == "0") {
+            self.studentPaper = response.data.data;
+            self.examType = response.data.examType;
+            self.paperMark = true;
+            console.log("paper", self.studentPaper);
+          } else {
+            if (response.data.resultCode == "1") {
+              self.$notify({
+                message: "该任务下试卷已评完,如有剩余任务将自动切换任务",
+                type: "warning",
+              });
+            } else if (response.data.resultCode == "2") {
+              self.$notify({
+                message: "您设置的阅卷任务数已完成",
+                type: "warning",
+              });
+            }
+
             this.resultItems.splice(0, this.resultItems.length);
             self.studentPaper = { id: "" };
             self.paperMark = false;
             return false;
-          } else {
-            self.studentPaper = response.data;
-            self.examType = response.data.examType;
-            self.paperMark = true;
-            console.log("paper", self.studentPaper);
           }
         });
       return true;