zhangjie 2 anni fa
parent
commit
cc582d253b

+ 2 - 2
src/components/base/CourseSelect.vue

@@ -9,8 +9,8 @@
     @change="select"
   >
     <el-option
-      v-for="item in optionList"
-      :key="item.code"
+      v-for="(item, index) in optionList"
+      :key="index"
       :value="item.code"
       :label="`${item.name}(${item.code})`"
     >

+ 2 - 2
src/modules/exam/api.js

@@ -194,8 +194,8 @@ export const taskPaperListPage = (datas) => {
 export const ableTaskPaper = ({ id, enable }) => {
   return $post("/api/admin/exam/task/paper_enable", { id, enable });
 };
-export const cancelTaskPaper = (id) => {
-  return $postParam("/api/admin/exam/task/cancel", { id });
+export const cancelTaskPaper = ({ id, cancelRemark }) => {
+  return $postParam("/api/admin/exam/task/cancel", { id, cancelRemark });
 };
 export const taskPaperApplyEdit = (datas) => {
   return $post("/api/admin/exam/task/paper_update", datas);

+ 23 - 10
src/modules/exam/views/TaskPaperManage.vue

@@ -137,7 +137,7 @@
             scope.row.unexposedPaperType | defaultFieldFilter
           }}</span>
         </el-table-column>
-        <el-table-column prop="enable" label="启用/禁用" width="80">
+        <el-table-column prop="enable" label="启用/禁用" width="90">
           <template slot-scope="scope">
             {{ scope.row.enable | enableFilter }}
           </template>
@@ -277,6 +277,7 @@ export default {
       IS_EXAM_TEACHER: this.$ls
         .get("user", { roleList: [] })
         .roleList.includes("EXAM_TEACHER"),
+      cancelRemark: "",
       // date-picker
       createTime: [],
       pickerOptions,
@@ -354,16 +355,28 @@ export default {
         .catch(() => {});
     },
     async toCancel(row) {
-      const confirm = await this.$confirm(
-        `确定要作废选中的命题任务吗?`,
-        "提示",
-        {
-          type: "warning",
-        }
-      ).catch(() => {});
-      if (confirm !== "confirm") return;
+      const res = await this.$prompt("确定要作废选中的命题任务吗", "提示", {
+        type: "warning",
+        showInput: true,
+        inputPlaceholder: "请输入作废理由",
+        inputValue: this.cancelRemark,
+        inputValidator: (val) => {
+          if (!val) return "请输入作废理由";
+          if (val.length > 100) return "作废理由不得超过100个字符!";
+          return true;
+        },
+      }).catch(() => {});
+      if (!res || res.action !== "confirm") {
+        return;
+      }
+      this.cancelRemark = res.value;
+      const result = await cancelTaskPaper({
+        id: row.id,
+        cancelRemark: this.cancelRemark,
+      }).catch(() => {});
+      this.cancelRemark = "";
 
-      await cancelTaskPaper(row.id);
+      if (!result) return;
       this.$message.success("操作成功!");
       this.getList();
     },