zhangjie 4 лет назад
Родитель
Сommit
a71f0244f8

+ 4 - 0
src/api.js

@@ -221,6 +221,10 @@ export const finishTryGradingTask = datas => {
   // workId, subject
   return $get(`/api/trial/finishTrial`, datas);
 };
+export const cleanGradingData = datas => {
+  // workId, subject,stage,,loginName,password
+  return $post(`/api/markers/subject/reset`, datas);
+};
 // grade-task
 export const checkMissionStatus = ({ workId, subject }) => {
   return $get("/api/trial/checkMissionStatus", { workId, subject });

+ 1 - 4
src/modules/grading-set/GradingRuleSet.vue

@@ -43,10 +43,7 @@
           style="width: 160px;"
         ></InputNumber>
       </FormItem>
-      <FormItem
-        v-if="modalForm.autoCallback"
-        label="自动打回是否显示偏差方向:"
-      >
+      <FormItem v-if="modalForm.autoCallback" label="打回是否显示偏差方向:">
         <Select
           v-model="modalForm.autoCallbackShowDeviation"
           :disabled="!modalFormCanEdit"

+ 1 - 1
src/modules/grading/GradingDetail.vue

@@ -542,7 +542,7 @@ export default {
       this.$refs.ModifyLeaderGrading.open();
     },
     async leaderGradingSuccess(datas, paper) {
-      if (datas.action === "sampling") {
+      if (datas.action === "sampling" && this.$refs.GradeStandardPaper) {
         this.$refs.GradeStandardPaper.updateLevelPapers(datas.level);
       }
       this.getStepLevels();

+ 21 - 2
src/modules/grading/GradingProgress.vue

@@ -1,7 +1,15 @@
 <template>
   <div class="grading-progress">
-    <div class="part-box-head" v-if="IS_ADMIN && !IS_SCORE">
+    <div class="part-box-head" v-if="IS_ADMIN">
       <div class="part-box-head-right">
+        <Button
+          type="error"
+          shape="circle"
+          icon="area icon"
+          @click="toCleanData"
+          v-if="IS_LEVEL || IS_SCORE"
+          >清除当前阅卷数据</Button
+        >
         <Button
           type="success"
           shape="circle"
@@ -93,6 +101,12 @@
       </Col>
     </Row>
 
+    <!-- clean-grading-data-dialog -->
+    <clean-grading-data-dialog
+      :cur-subject="curSubject"
+      @modified="initData"
+      ref="CleanGradingDataDialog"
+    ></clean-grading-data-dialog>
     <!-- modify-unformal-grading-task -->
     <modify-unformal-grading-task
       :cur-subject="curSubject"
@@ -113,6 +127,7 @@
 import ProgressLine from "./components/ProgressLine";
 import ModifyUnformalGradingTask from "./components/ModifyUnformalGradingTask";
 import ModifyFormalGradingTask from "./components/ModifyFormalGradingTask";
+import CleanGradingDataDialog from "./components/CleanGradingDataDialog";
 import {
   gradingProgressDetail,
   subjectDetail,
@@ -126,7 +141,8 @@ export default {
   components: {
     ProgressLine,
     ModifyUnformalGradingTask,
-    ModifyFormalGradingTask
+    ModifyFormalGradingTask,
+    CleanGradingDataDialog
   },
   data() {
     return {
@@ -240,6 +256,9 @@ export default {
     async getSubjectDetail() {
       this.curSubject = await subjectDetail(this.subjectId);
     },
+    toCleanData() {
+      this.$refs.CleanGradingDataDialog.open();
+    },
     toGrading() {
       this.$refs.ModifyFormalGradingTask.open();
     },

+ 97 - 0
src/modules/grading/components/CleanGradingDataDialog.vue

@@ -0,0 +1,97 @@
+<template>
+  <Modal
+    class="clean-grading-data-dialog"
+    v-model="modalIsShow"
+    title="警告:即将清除本科目当前阅卷数据"
+    :mask-closable="false"
+    @on-visible-change="visibleChange"
+  >
+    <Form
+      ref="modalFormComp"
+      class="modal-form"
+      :model="modalForm"
+      :rules="rules"
+      :label-width="80"
+    >
+      <FormItem prop="password" label="密码">
+        <Input
+          size="large"
+          type="password"
+          v-model.trim="modalForm.password"
+          clearable
+        ></Input>
+      </FormItem>
+    </Form>
+    <div slot="footer">
+      <Button shape="circle" type="primary" :disabled="isSubmit" @click="submit"
+        >确定</Button
+      >
+      <Button shape="circle" @click="cancel">取消</Button>
+    </div>
+  </Modal>
+</template>
+
+<script>
+import { cleanGradingData } from "@/api";
+import { password } from "@/plugins/formRules";
+
+export default {
+  name: "clean-grading-data-dialog",
+  props: {
+    curSubject: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: { password: "" },
+      rules: {
+        password
+      }
+    };
+  },
+  methods: {
+    visibleChange(visible) {
+      if (visible) {
+        this.$refs.modalFormComp.resetFields();
+      }
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate();
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+
+      this.isSubmit = true;
+      let result = true;
+      await cleanGradingData({
+        workId: this.curSubject.workId,
+        subject: this.curSubject.subject,
+        stage: this.curSubject.stage,
+        loginName: this.$ls.get("user", { loginName: "" }).loginName,
+        password: this.modalForm.password
+      }).catch(() => {
+        result = false;
+      });
+
+      this.isSubmit = false;
+      if (!result) return;
+
+      this.$Modal.success({ content: "操作成功!" });
+      this.$emit("modified");
+      this.cancel();
+    }
+  }
+};
+</script>

+ 2 - 1
src/modules/grading/components/GradeAction.vue

@@ -65,7 +65,8 @@
       <span
         v-if="
           paramsSet.autoCallbackShowDeviation &&
-            curPaperOrTask.deviationDirection
+            curPaperOrTask.deviationDirection &&
+            curPaperOrTask.deviationDirection !== '0'
         "
         :class="[
           'grade-info-deviation',

+ 1 - 1
src/modules/grading/components/ModifyFormalGradingTask.vue

@@ -15,7 +15,7 @@
       :model="modalForm"
       :rules="rules"
       :key="modalForm.id"
-      :label-width="120"
+      :label-width="130"
     >
       <FormItem prop="questionId" label="考区">
         <Select