浏览代码

题卡bug修改

zhangjie 4 年之前
父节点
当前提交
7d09ae0917

+ 2 - 2
card/components/CardConfigPropEdit.vue

@@ -51,7 +51,7 @@
             >
           </el-form-item>
           <el-form-item>
-            <el-checkbox v-model="form.missAndFill" @change="editChange"
+            <el-checkbox v-model="form.examAbsent" @change="editChange"
               >启用缺考和涂填提示</el-checkbox
             >
           </el-form-item>
@@ -109,7 +109,7 @@ export default {
         examNumberStyle: "fill",
         aOrBType: "auto",
         aOrB: true,
-        missAndFill: true,
+        examAbsent: true,
         writeSign: true,
         showForbidArea: true
       }

+ 5 - 5
card/elements/card-head/CardHead.vue

@@ -145,17 +145,17 @@ export default {
         "card-head",
         {
           "card-head-narrow": this.data.columnNumber > 2,
-          "card-head-handle": this.data.examNumberStyle === "fill",
+          "card-head-handle": this.data.examNumberStyle === "FILL",
           "card-head-normal":
-            this.data.examNumberStyle !== "fill" && this.data.columnNumber <= 2
+            this.data.examNumberStyle !== "FILL" && this.data.columnNumber <= 2
         }
       ];
     },
     hasDynamicArea() {
       const noDynamic =
-        this.data.examNumberStyle === "fill"
-          ? !this.data.missAndFill && !this.data.aOrB
-          : !this.data.missAndFill && !this.data.writeSign && !this.data.aOrB;
+        this.data.examNumberStyle === "FILL"
+          ? !this.data.examAbsent && !this.data.aOrB
+          : !this.data.examAbsent && !this.data.writeSign && !this.data.aOrB;
 
       return !noDynamic;
     },

+ 9 - 7
card/elements/card-head/model.js

@@ -6,15 +6,17 @@ const MODEL = {
   y: 0,
   w: 0,
   h: 0,
-  schoolName: "",
-  cardName: "",
-  aOrB: true,
-  aOrBType: "fill", // fill:手动填涂,auto:自动条码
-  missAndFill: true,
+  cardTitle: "",
+  cardDesc: "",
+  aOrB: false,
+  paperType: "PRINT", // PRINT: "印刷",FILL: "填涂"
+  examAbsent: true,
   writeSign: true,
-  examNumberStyle: "auto", // auto:自动条码, empty:手动条码, fill:手动填涂
+  examNumberStyle: "PRINT", // PRINT:印刷条码, PASTE:粘贴条码, FILL:考号填涂
   businessParams: [],
-  noticeHead: [],
+  attention: [],
+  objectiveAttention: [],
+  subjectiveAttention: [],
   columnNumber: 2,
   isSimple: false, // 是否是简化形式
   sign: "head"

+ 3 - 3
card/mixins/exchange.js

@@ -123,7 +123,7 @@ export default {
       let fill_area = [];
       let barcode = [];
       // 学生考号
-      if (element.examNumberStyle === "fill") {
+      if (element.examNumberStyle === "FILL") {
         // fill_area
         let listInfos = [];
         dom
@@ -159,7 +159,7 @@ export default {
         });
       }
       // 缺考涂填
-      if (element.missAndFill && !element.isSimple) {
+      if (element.examAbsent && !element.isSimple) {
         fill_area.push({
           field: "absent",
           index: this.getFillAreaIndex("absent"),
@@ -178,7 +178,7 @@ export default {
       }
       // A/B卷类型
       if (element.aOrB && !element.isSimple) {
-        if (element.aOrBType === "auto") {
+        if (element.paperType === "PRINT") {
           // barcode
           barcode.push({
             field: "paperType",

+ 79 - 5
src/modules/exam/components/PreviewTaskPaper.vue → src/modules/exam/components/ModifyTaskPaper.vue

@@ -1,8 +1,8 @@
 <template>
   <el-dialog
-    class="preview-task-paper task-detail"
+    class="modify-task-paper task-detail"
     :visible.sync="modalIsShow"
-    title="卷库预览"
+    :title="title"
     top="10vh"
     width="900px"
     :close-on-click-modal="false"
@@ -11,6 +11,14 @@
     @open="visibleChange"
   >
     <div class="part-box part-box-pad part-box-border">
+      <div v-if="IS_EDIT" class="mb-2 text-right">
+        <el-button
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="addAtachment"
+          >增加卷型</el-button
+        >
+      </div>
       <table class="table">
         <tr>
           <th>试卷类型</th>
@@ -55,6 +63,29 @@ export default {
       default() {
         return {};
       }
+    },
+    editType: {
+      type: String,
+      default: "PREVIEW",
+      validator: val => ["EDIT", "PREVIEW"].includes(val)
+    }
+  },
+  computed: {
+    title() {
+      const names = {
+        EDIT: "编辑卷库",
+        PREVIEW: "卷库详情"
+      };
+      return names[this.editType];
+    },
+    IS_PREVIEW() {
+      return this.editType === "PREVIEW";
+    },
+    IS_EDIT() {
+      return this.editType === "EDIT";
+    },
+    CAN_EDIT_CARD() {
+      return this.editType === "EDIT" && !this.instance.exposedPaperType;
     }
   },
   data() {
@@ -78,9 +109,52 @@ export default {
     open() {
       this.modalIsShow = true;
     },
-    // downloadPaper(attachment) {
-    //   window.open(attachment.url);
-    // },
+    addAtachment() {
+      if (this.paperAttachments.length >= this.attachmentLimitCount) return;
+
+      const newAttachment = {
+        name: this.abc[this.paperAttachments.length],
+        attachmentId: "",
+        filename: "",
+        pages: 0
+      };
+      this.paperAttachments.push(newAttachment);
+    },
+    deleteAttachment(index) {
+      if (this.paperAttachments.length <= 1) {
+        this.$message.error("试卷类型数量不得少于1");
+        return;
+      }
+      this.paperAttachments.splice(index, 1);
+      this.paperAttachments.forEach((item, itemIndex) => {
+        item.name = this.abc[itemIndex];
+      });
+    },
+    toUpload(attachment) {
+      this.curUploadType = "paper";
+      this.curAttachment = {
+        ...attachment
+      };
+      this.$refs.UploadPaperDialog.open();
+    },
+    toUploadPaperConfirm() {
+      if (this.paperConfirmAttachments.length >= 4) return;
+      this.curUploadType = "paperConfirm";
+      this.curAttachment = {
+        ...this.paperConfirmAttachmentId
+      };
+      this.$refs.UploadPaperDialog.open();
+    },
+    uploadConfirm(attachment, uploadType) {
+      if (uploadType === "paper") {
+        const index = this.paperAttachments.findIndex(
+          item => item.name === attachment.name
+        );
+        this.paperAttachments.splice(index, 1, { ...attachment });
+      } else {
+        this.paperConfirmAttachments.push(attachment);
+      }
+    },
     async downloadPaper(attachment) {
       const data = await attachmentPreview(attachment.attachmentId);
       window.open(data.url);

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

@@ -103,6 +103,14 @@
               @click="toPreview(scope.row)"
               title="查看"
             ></el-button>
+            <el-button
+              v-if="!scope.row.auditStatus && !scope.row.reviewStatus"
+              class="btn-table-icon"
+              type="text"
+              icon="icon icon-edit"
+              @click="toEdit(scope.row)"
+              title="修改"
+            ></el-button>
             <el-button
               v-if="!IS_QUESTION_TEACHER"
               class="btn-table-icon"
@@ -140,11 +148,12 @@
       </div>
     </div>
 
-    <!-- PreviewTaskPaper -->
-    <preview-task-paper
+    <!-- ModifyTaskPaper -->
+    <modify-task-paper
       :instance="curPaper"
-      ref="PreviewTaskPaper"
-    ></preview-task-paper>
+      :edit-type="editType"
+      ref="ModifyTaskPaper"
+    ></modify-task-paper>
   </div>
 </template>
 
@@ -152,11 +161,11 @@
 import { taskPaperListPage, ableTaskPaper, downloadPaper } from "../api";
 import pickerOptions from "@/constants/datePickerOptions";
 import { downloadBlob } from "@/plugins/utils";
-import PreviewTaskPaper from "../components/PreviewTaskPaper";
+import ModifyTaskPaper from "../components/ModifyTaskPaper";
 
 export default {
   name: "task-paper-manage",
-  components: { PreviewTaskPaper },
+  components: { ModifyTaskPaper },
   data() {
     return {
       filter: {
@@ -171,6 +180,7 @@ export default {
       papers: [],
       curPaper: {},
       loading: false,
+      editType: "EDIT",
       IS_QUESTION_TEACHER: this.$ls
         .get("user", { roleList: [] })
         .roleList.includes("QUESTION_TEACHER"),
@@ -239,9 +249,15 @@ export default {
         })
         .catch(() => {});
     },
+    toEdit(row) {
+      this.curPaper = row;
+      this.editType = "EDIT";
+      this.$refs.ModifyTaskPaper.open();
+    },
     toPreview(row) {
       this.curPaper = row;
-      this.$refs.PreviewTaskPaper.open();
+      this.editType = "PREVIEW";
+      this.$refs.ModifyTaskPaper.open();
     },
     async toDownload(row) {
       if (this.loading) return;