Forráskód Böngészése

新增清除阅卷数据功能

zhangjie 4 éve
szülő
commit
d7f9e18fb7

+ 4 - 0
src/api.js

@@ -244,6 +244,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 });

+ 3 - 0
src/assets/styles/base.less

@@ -394,6 +394,9 @@ h3.account-title {
 .color-error {
   color: @error-color;
 }
+.color-white {
+  color: #fff;
+}
 .color-default-hover {
   &:hover {
     color: fade(@primary-color, 80%);

+ 3 - 4
src/assets/styles/common-component.less

@@ -93,9 +93,9 @@
   }
   &-footer {
     position: absolute;
-    height: 60px;
+    width: 60px;
     bottom: 0;
-    right: 20px;
+    right: 0;
     padding: 10px;
     font-size: 30px;
     color: #333;
@@ -106,14 +106,13 @@
       height: 40px;
       width: 40px;
       line-height: 40px;
-      margin: 0 5px;
       text-align: center;
       cursor: pointer;
       transition: transform 0.2s linear;
     }
     li:hover {
       // color: #000;
-      transform: scale(1.1, 1.1);
+      transform: scale(1.2, 1.2);
     }
     li.li-disabled {
       cursor: not-allowed;

+ 23 - 3
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"
@@ -96,6 +104,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"
@@ -116,6 +130,7 @@
 import ProgressLine from "./components/ProgressLine";
 import ModifyUnformalGradingTask from "./components/ModifyUnformalGradingTask";
 import ModifyFormalGradingTask from "./components/ModifyFormalGradingTask";
+import CleanGradingDataDialog from "./components/CleanGradingDataDialog";
 import {
   gradingProgressDetail,
   subjectDetail,
@@ -129,7 +144,8 @@ export default {
   components: {
     ProgressLine,
     ModifyUnformalGradingTask,
-    ModifyFormalGradingTask
+    ModifyFormalGradingTask,
+    CleanGradingDataDialog
   },
   data() {
     return {
@@ -142,7 +158,8 @@ export default {
       totalProgress: {},
       areaProgress: [],
       markerProgress: [],
-      curUserRoleType: ""
+      curUserRoleType: "",
+      password: ""
     };
   },
   computed: {
@@ -250,6 +267,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>