فهرست منبع

feat: 评卷管理重置等操作

zhangjie 11 ماه پیش
والد
کامیت
75859d0ab3

+ 25 - 0
src/assets/styles/pages.scss

@@ -1585,3 +1585,28 @@
     }
   }
 }
+
+// danger-tips-dialog
+.danger-tips-dialog {
+  .el-dialog__header {
+    display: none;
+  }
+  .el-dialog__body {
+    &::before {
+      content: "";
+      display: block;
+      margin: 0 auto 20px;
+      width: 48px;
+      height: 48px;
+      background-image: url(../images/icon-doubt.png);
+      background-repeat: no-repeat;
+      background-size: 100% 100%;
+    }
+  }
+  .el-dialog__footer {
+    text-align: center;
+    .el-button {
+      float: none;
+    }
+  }
+}

+ 164 - 0
src/modules/mark/components/markDetail/DangerTipsDialog.vue

@@ -0,0 +1,164 @@
+<template>
+  <el-dialog
+    class="danger-tips-dialog"
+    :visible.sync="modalIsShow"
+    width="400px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :show-close="false"
+    append-to-body
+    destroy-on-close
+    @open="visibleChange"
+  >
+    <p class="tips-info tips-error mb-2">
+      {{ curInfo.name }}操作会{{ curInfo.tips }},请谨慎操作!!!
+    </p>
+    <el-form ref="modalFormComp" :model="modalForm" :rules="rules" inline>
+      <el-form-item :label="`如要${curInfo.name}请输入工号`"></el-form-item>
+      <el-form-item prop="content">
+        <el-input
+          v-model.trim="modalForm.content"
+          placeholder="请输入"
+          clearable
+          style="width: 160px"
+        ></el-input>
+      </el-form-item>
+    </el-form>
+
+    <template slot="footer">
+      <template v-if="confirmTime % 2">
+        <el-button type="primary" :disabled="isSubmit" @click="submit"
+          >确认</el-button
+        >
+        <el-button @click="cancel">取消</el-button>
+      </template>
+      <template v-else>
+        <el-button @click="cancel">取消</el-button>
+        <el-button type="primary" :disabled="isSubmit" @click="submit"
+          >确认</el-button
+        >
+      </template>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+import {
+  markMarkerReset,
+  markMarkerUnbind,
+  markMarkerRecycle,
+} from "../../api";
+
+export default {
+  name: "danger-tips-dialog",
+  props: {
+    rowData: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+    type: {
+      type: String,
+      default: "reset",
+    },
+    groupIds: {
+      type: Array,
+      default() {
+        return [];
+      },
+    },
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      infos: {
+        reset: {
+          name: "重置",
+          tips: "将评卷员已评任务删除",
+        },
+        unbind: {
+          name: "解绑",
+          tips: "将该评卷员与这个分组关系解除绑定,他不能评这个分组",
+        },
+        recycle: {
+          name: "回收",
+          tips: "将评卷员已领未评的任务,放到未评池中",
+        },
+      },
+      loginName: this.$ls.get("user", { loginName: "" }).loginName,
+      curInfo: {},
+      confirmTime: 0,
+      maxConfirmTime: 3,
+      modalForm: { content: "" },
+      rules: {
+        content: [
+          {
+            validator: (rule, value, callback) => {
+              if (value !== this.loginName) {
+                return callback(new Error(`请输入工号`));
+              }
+              callback();
+            },
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  methods: {
+    visibleChange() {
+      this.curInfo = this.infos[this.type];
+      this.modalForm.content = "";
+      this.confirmTime = 0;
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      this.confirmTime += 1;
+      if (this.confirmTime < this.maxConfirmTime) {
+        this.modalForm.content = "";
+        return;
+      }
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+
+      let err = null;
+      if (this.type === "reset") {
+        await markMarkerReset({
+          markUserGroupId: this.rowData.markUserGroupId,
+        }).catch(() => {
+          err = true;
+        });
+      } else if (this.type === "unbind") {
+        await markMarkerUnbind({
+          markUserGroupId: this.rowData.markUserGroupId,
+        }).catch(() => {
+          err = true;
+        });
+      } else {
+        await markMarkerRecycle({
+          markUserGroupIds: this.groupIds,
+        }).catch(() => {
+          err = true;
+        });
+      }
+      this.isSubmit = false;
+      if (err) return;
+
+      this.$message.success("操作成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+  },
+};
+</script>

+ 31 - 9
src/modules/mark/components/markDetail/MarkDetailMarker.vue

@@ -33,7 +33,7 @@
         <el-button
           type="primary"
           :disabled="!multipleSelection.length"
-          @click="toBatchRecycle"
+          @click="toDangerAction('recycle', {}, multipleSelection)"
         >
           回收
         </el-button>
@@ -94,22 +94,26 @@
         >
           <template slot-scope="scope">
             <el-button
-              class="btn-primary"
+              class="btn-danger"
               type="text"
               :disabled="scope.row.resetting"
-              @click="toReset(scope.row)"
+              @click="toDangerAction('reset', scope.row)"
               >{{ scope.row.resetting ? "重置中" : "重置" }}</el-button
             >
             <el-button
-              class="btn-primary"
+              class="btn-danger"
               type="text"
-              @click="toUnbind(scope.row)"
+              @click="toDangerAction('unbind', scope.row)"
               >解绑</el-button
             >
             <el-button
-              class="btn-primary"
+              class="btn-danger"
               type="text"
-              @click="toSimpleRecycle(scope.row)"
+              @click="
+                toDangerAction('recycle', scope.row, [
+                  scope.row.markUserGroupId,
+                ])
+              "
               >回收</el-button
             >
             <el-button
@@ -134,7 +138,7 @@
         >
         </el-pagination>
       </div>
-      <p class="tips-info">
+      <p class="tips-info tips-error" style="font-weight: bold">
         说明:<br />
         1.评卷过程发现某些试题评卷工作任务重需要增加评卷员,可以选择对应评阅题目后绑定评卷员;<br />
         2.重置 - 将评卷员已评任务删除; <br />
@@ -157,6 +161,13 @@
       :data="curData"
       @modified="markerSelected"
     ></modify-marker-bind>
+    <!-- DangerTipsDialog -->
+    <danger-tips-dialog
+      ref="DangerTipsDialog"
+      :row-data="curRow"
+      :group-ids="curGroupIds"
+      :type="curActionType"
+    ></danger-tips-dialog>
   </div>
 </template>
 
@@ -171,6 +182,7 @@ import {
 } from "../../api";
 import ModifyMarkerTaskCount from "./ModifyMarkerTaskCount.vue";
 import ModifyMarkerBind from "./ModifyMarkerBind.vue";
+import DangerTipsDialog from "./DangerTipsDialog.vue";
 
 export default {
   name: "mark-detail-marker",
@@ -182,7 +194,7 @@ export default {
       },
     },
   },
-  components: { ModifyMarkerTaskCount, ModifyMarkerBind },
+  components: { ModifyMarkerTaskCount, ModifyMarkerBind, DangerTipsDialog },
   data() {
     return {
       filter: {
@@ -200,6 +212,9 @@ export default {
       multipleSelection: [],
       downloading: false,
       userParams: {},
+      // danger action
+      curActionType: "",
+      curGroupIds: [],
     };
   },
   mounted() {
@@ -261,6 +276,13 @@ export default {
       this.$message.success("绑定成功!");
       this.getList();
     },
+    // to danger action
+    toDangerAction(type, curRow, groupIds = []) {
+      this.curRow = curRow;
+      this.curGroupIds = groupIds;
+      this.curActionType = type;
+      this.$refs.DangerTipsDialog.open();
+    },
     // reset marker
     async toReset(row) {
       const confirm = await this.$confirm("确定要重置当前评卷员?", "提示", {