浏览代码

feat: 命题任务申请

zhangjie 8 月之前
父节点
当前提交
5c3349027a

+ 6 - 6
card/assets/styles/card-preview.scss

@@ -833,10 +833,6 @@
         .dynamic-aorb-item {
           display: table-cell;
           vertical-align: middle;
-          text-align: center;
-          &:not(:last-child) {
-            border-right: 1px solid #000;
-          }
         }
         &-fill {
           .dynamic-aorb-item:first-child {
@@ -845,13 +841,15 @@
         }
 
         .dynamic-aorb-title {
-          width: 83px;
+          width: 40%;
+          padding: 10px;
         }
         .dynamic-aorb-info {
-          width: 50px;
+          width: 60%;
           font-size: 16px;
           position: relative;
           overflow: hidden;
+          text-align: center;
           .dynamic-aorb-content {
             position: absolute;
             top: 50%;
@@ -873,7 +871,9 @@
           }
         }
         .dynamic-aorb-rects {
+          width: 60%;
           padding: 16px 10px;
+          text-align: center;
         }
       }
     }

+ 5 - 0
card/components/PagePropEdit.vue

@@ -36,6 +36,11 @@
           ></i>
         </el-button>
       </el-form-item>
+      <el-form-item label-width="0px">
+        <el-checkbox v-model="form.aOrB" @change="configChange"
+          >启用A/B卷</el-checkbox
+        >
+      </el-form-item>
       <el-form-item label="大题顺序">
         <ul class="topicno-list" v-if="topicNoSeries.length">
           <li v-for="item in topicNoSeries" :key="item.id">

+ 5 - 4
card/elements/card-head/cardHeadSpin/HeadDynamic.vue

@@ -77,15 +77,16 @@
           <span class="head-dynamic-rect"><i>B</i></span>
         </div>
       </div>
-      <!-- <div
+      <div
         class="dynamic-aorb-item dynamic-aorb-info"
         v-if="data.paperType === 'PRINT'"
       >
         <div class="dynamic-aorb-content">
           <i>{{ aorbBarcodeName }}</i>
         </div>
-      </div> -->
-      <div
+      </div>
+
+      <!-- <div
         class="dynamic-aorb-item dynamic-aorb-barcode"
         id="dynamic-aorb-barcode"
         v-if="data.paperType === 'PRINT'"
@@ -94,7 +95,7 @@
           <img :src="aorbBarcodeSrc" v-if="aorbBarcodeSrc" />
           <img src="../../../assets/images/barcode-sample-notext.png" v-else />
         </div>
-      </div>
+      </div> -->
     </div>
   </div>
 </template>

+ 11 - 9
card/mixins/exchange.js

@@ -273,15 +273,17 @@ export default {
       }
       // A/B卷类型
       if (element.aOrB && !element.isSimple) {
-        if (element.paperType === "PRINT") {
-          // barcode
-          barcode.push({
-            field: "paperType",
-            area: this.getOffsetInfo(
-              dom.querySelector(".dynamic-aorb-barcode")
-            ),
-          });
-        } else {
+        // if (element.paperType === "PRINT") {
+        //   // barcode
+        //   barcode.push({
+        //     field: "paperType",
+        //     area: this.getOffsetInfo(
+        //       dom.querySelector(".dynamic-aorb-barcode")
+        //     ),
+        //   });
+        // }
+
+        if (element.paperType === "FILL") {
           // fill_area
           let options = [];
           dom

+ 1 - 1
src/constants/enumerate.js

@@ -178,7 +178,7 @@ export const CARD_SIZE_TYPE = ["A3", "8K"];
 // 试卷类型方式
 export const PAPER_TYPE = {
   PRINT: "印刷",
-  // FILL: "填涂"
+  FILL: "填涂",
 };
 
 // 命题任务状态

+ 15 - 15
src/modules/base/components/ModifyCardRule.vue

@@ -76,21 +76,21 @@
             disabled
           ></el-input-number>
         </el-form-item>
-        <!-- <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
-        <el-select
-          v-model="modalForm.paperType"
-          style="width: 142px"
-          placeholder="请选择"
-          :disabled="!editable"
-        >
-          <el-option
-            v-for="(val, key) in PAPER_TYPE"
-            :key="key"
-            :value="key"
-            :label="val"
-          ></el-option>
-        </el-select>
-      </el-form-item> -->
+        <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
+          <el-select
+            v-model="modalForm.paperType"
+            style="width: 142px"
+            placeholder="请选择"
+            :disabled="!editable"
+          >
+            <el-option
+              v-for="(val, key) in PAPER_TYPE"
+              :key="key"
+              :value="key"
+              :label="val"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-checkbox v-model="modalForm.examAbsent" :disabled="!editable"
             >启用“缺考填涂”</el-checkbox

+ 1 - 1
src/modules/card/views/CardEdit.vue

@@ -182,7 +182,7 @@ export default {
           },
         };
         config.fillNumber = data.examNumberDigit;
-        config.aOrB = false; // 默认关闭A/B卷型,2023-01-31改
+        config.aOrB = this.prepareTcPCard.openAb;
         config.requiredFields = JSON.parse(config.requiredFields);
         config.extendFields = JSON.parse(config.extendFields);
         config.relationList = JSON.parse(config.relationList || "[]");

+ 10 - 10
src/modules/exam/components/createExamAndPrintTask/CreateExamAndPrintTask.vue

@@ -24,7 +24,7 @@
           <h3 class="apply-part-title">考务信息</h3>
           <info-print-task ref="InfoPrintTask"></info-print-task>
         </div>
-        <div v-if="infoExamTaskDetail.review" class="apply-part flow-timeline">
+        <div v-if="infoExamTask.review" class="apply-part flow-timeline">
           <h3 class="apply-part-title">流程</h3>
           <el-timeline>
             <el-timeline-item
@@ -133,7 +133,7 @@ const initExamTask = {
 //   paperAttachmentIds: "[]",
 // };
 
-const initExamTaskDetail = []; // examTaskDetailItem[]
+// const initExamTaskDetail = []; // examTaskDetailItem[]
 
 const initPrintPlan = {
   printContent: [],
@@ -252,14 +252,14 @@ export default {
       this.userLimitCount = 1;
       this.userFilterRoles = [];
 
-      const infoExamTaskDetail = Object.assign({}, initExamTaskDetail, {
-        review: this.examRule.review,
-        customCard: this.examRule.customCard,
-      });
-
       const infos = {
-        infoExamTask: { ...initExamTask, uuid: randomCode(32) },
-        infoExamTaskDetail,
+        infoExamTask: {
+          ...initExamTask,
+          uuid: randomCode(32),
+          review: this.examRule.review,
+          customCard: this.examRule.customCard,
+        },
+        infoExamTaskDetail: [],
         infoPrintTask: { ...initPrintTask },
         infoExamPrintPlan: { ...initPrintPlan },
       };
@@ -327,7 +327,7 @@ export default {
 
       let examTaskContent = {
         examTask: this.infoExamTask,
-        examTaskDetail: this.infoExamTaskDetail,
+        examTaskDetailList: this.infoExamTaskDetail,
       };
       if (!this.IS_MODEL3) {
         examTaskContent.examDetail = this.infoPrintTask;

+ 6 - 1
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -642,6 +642,9 @@ export default {
         const paperAttachmentIds = item.paperAttachmentIds
           ? JSON.parse(item.paperAttachmentIds)
           : [];
+        paperAttachmentIds.forEach((aitem) => {
+          aitem.serialNumber = item.serialNumber;
+        });
         return {
           ...item,
           paperAttachmentIds,
@@ -799,7 +802,7 @@ export default {
           });
           paperAttachment.paperType = paperAttachment.paperAttachmentIds
             .map((item) => item.name)
-            .join("");
+            .join();
         });
       }
       this.examTaskDetail = this.paperAttachments.map((item) => {
@@ -882,6 +885,7 @@ export default {
       this.$ls.set("prepareTcPCard", {
         courseId: this.examTask.courseId,
         courseName: this.examTask.courseName,
+        openAb: this.examTask.openAb,
         schoolName: this.$ls.get("schoolName"),
         makeMethod: "SELF",
         cardName: res.value,
@@ -898,6 +902,7 @@ export default {
         id: attachment.cardId,
         courseId: this.examTask.courseId,
         courseName: this.examTask.courseName,
+        openAb: this.examTask.openAb,
         schoolName: this.$ls.get("schoolName"),
         makeMethod: "SELF",
         cardRuleId: this.examTask.cardRuleId,

+ 6 - 1
src/modules/exam/components/taskApply/ModifyTaskApply.vue

@@ -96,6 +96,7 @@ const initExamTask = {
   teachingRoomName: "",
   teacherName: "",
   lecturerName: "",
+  openAb: false,
 };
 
 const initTaskApply = {
@@ -116,6 +117,8 @@ const initTaskApply = {
   drawCount: 1,
   exposedPaperType: "",
   auditContent: [],
+  examTaskDetailList: [],
+  openAb: false,
   // 入库申请中新建的命题任务提交信息
   examTaskContent: "",
 
@@ -218,7 +221,6 @@ export default {
         examName: data.examName,
         examModel: data.examModel,
       });
-      this.setExamTask(examTask);
 
       // curTaskApply
       const curTaskApply = this.$objAssign(initTaskApply, {
@@ -233,6 +235,9 @@ export default {
         includePaper: data.printContent.indexOf("PAPER") !== -1,
       });
 
+      examTask.openAb = data.openAb;
+      this.setExamTask(examTask);
+
       this.setCurTaskApply(curTaskApply);
       this.updateStatus();
       this.dataReady = true;

+ 51 - 40
src/modules/exam/components/taskApply/TaskPaper.vue

@@ -1,10 +1,14 @@
 <template>
   <div>
-    <!-- <el-form>
+    <el-form>
       <el-form-item label="启用AB卷:">
-        <el-switch v-model="examTask.openAb" @change="openAbChange"></el-switch>
+        <el-switch
+          v-model="openAb"
+          :disabled="!this.taskStatus.IS_APPLY"
+          @change="openAbChange"
+        ></el-switch>
       </el-form-item>
-    </el-form> -->
+    </el-form>
     <!-- menu -->
     <div
       v-if="checkPrivilege('button', 'SelectTikuPaper', 'TaskApplyManage')"
@@ -22,9 +26,9 @@
     <!-- table -->
     <table class="table mb-2">
       <colgroup>
-        <col width="90" />
+        <col width="80" />
         <col width="60" />
-        <col width="240" />
+        <col width="200" />
         <col />
         <col v-if="taskStatus.IS_APPLY && !taskStatus.IS_REBUILD" width="80" />
       </colgroup>
@@ -50,9 +54,9 @@
             :rowspan="paperAttachment.paperAttachmentIds.length"
           >
             卷{{ paperAttachment.serialNumber }}
-            <!-- <span class="color-gray-2" v-if="paperAttachment.isExposed"
+            <span class="color-gray-2" v-if="paperAttachment.exposed"
               >(已曝光)</span
-            > -->
+            >
           </td>
           <td>
             <span>{{ attachment.name }}</span>
@@ -60,7 +64,7 @@
           <template v-if="IS_TIKU_TAB">
             <!-- 试卷文件 -->
             <td>
-              <template v-if="!attachment.isExposed && taskStatus.IS_APPLY">
+              <template v-if="!paperAttachment.exposed && taskStatus.IS_APPLY">
                 <div class="box-justify">
                   <el-button
                     type="text"
@@ -169,7 +173,7 @@
             <!-- 试卷文件 -->
             <td>
               <el-button
-                v-if="!attachment.isExposed && taskStatus.IS_APPLY"
+                v-if="!paperAttachment.exposed && taskStatus.IS_APPLY"
                 type="text"
                 class="btn-primary"
                 @click="toUpload(attachment)"
@@ -335,7 +339,7 @@
               @click="addAtachment"
             ></el-button>
             <el-button
-              v-if="attachment.canDelete"
+              v-if="!paperAttachment.exposed"
               class="btn-danger btn-icon"
               type="text"
               icon="el-icon-remove"
@@ -504,6 +508,7 @@ export default {
       curTab: "upload",
       uuid: "",
       user: {},
+      openAb: false,
       paperConfirmAttachmentId: {
         attachmentId: "",
         filename: "",
@@ -557,34 +562,39 @@ export default {
     ...mapActions("exam", ["addPreviewLog"]),
     initData() {
       this.user = this.$ls.get("user", {});
-      this.paperAttachments = this.curTaskApply.paperAttachmentIds
-        ? JSON.parse(this.curTaskApply.paperAttachmentIds)
-        : [];
+      this.paperAttachments = (this.curTaskApply.examTaskDetailList || []).map(
+        (item) => {
+          const paperAttachmentIds = item.paperAttachmentIds
+            ? JSON.parse(item.paperAttachmentIds)
+            : [];
+          paperAttachmentIds.forEach((aitem) => {
+            aitem.serialNumber = item.serialNumber;
+          });
+          return {
+            ...item,
+            paperAttachmentIds,
+          };
+        }
+      );
+      this.openAb = this.examTask.openAb;
 
       if (!this.paperAttachments.length) {
         this.addAtachment();
       }
 
-      const pAttachment = this.paperAttachments.some((item) => !!item.paperId);
+      const pAttachment = this.paperAttachments.some((item) =>
+        item.paperAttachmentIds.some((p) => !!p.paperId)
+      );
       if (pAttachment) {
         this.curTab = "tiku";
-        this.uuid = pAttachment.uuid || this.$randomCode(32);
+        this.uuid =
+          this.paperAttachments[0]?.paperAttachments[0]?.uuid ||
+          this.$randomCode(32);
       } else {
         this.curTab = "upload";
         this.uuid = this.$randomCode(32);
       }
 
-      const exposedPaperType = this.curTaskApply.exposedPaperType || "";
-      let exposedPaperTypes = exposedPaperType.split(",");
-      exposedPaperTypes.sort((a, b) => (a > b ? -1 : 1));
-      const maxExposedPaperType = exposedPaperTypes[0];
-      this.paperAttachments.forEach((paper) => {
-        paper.canDelete = maxExposedPaperType
-          ? paper.name > maxExposedPaperType
-          : true;
-        paper.isExposed = exposedPaperTypes.includes(paper.name);
-      });
-
       this.paperConfirmAttachments = this.curTaskApply.paperConfirmAttachmentIds
         ? JSON.parse(this.curTaskApply.paperConfirmAttachmentIds)
         : [];
@@ -594,7 +604,7 @@ export default {
     openAbChange() {
       if (!this.taskStatus.IS_APPLY) return;
 
-      if (this.examTask.openAb) {
+      if (this.openAb) {
         this.paperAttachments.forEach((paperAttachment) => {
           const attachment = paperAttachment.paperAttachmentIds[0];
           paperAttachment.paperAttachmentIds.push(
@@ -614,6 +624,9 @@ export default {
             paperAttachment.paperAttachmentIds.slice(0, 1);
         });
       }
+
+      this.setExamTask({ ...this.examTask, openAb: this.openAb });
+      this.setCurTaskApply({ ...this.curTaskApply, openAb: this.openAb });
     },
     async selectMenu(tab) {
       if (!this.taskStatus.IS_APPLY) return;
@@ -788,6 +801,7 @@ export default {
         courseName: this.curTaskApply.courseName,
         makeMethod: this.curTaskApply.makeMethod,
         cardRuleId: this.curTaskApply.cardRuleId,
+        openAb: this.examTask.openAb,
         type: attachment.cardType,
         createMethod: attachment.createMethod,
       });
@@ -884,6 +898,7 @@ export default {
       this.$ls.set("prepareTcPCard", {
         courseId: this.examTask.courseId,
         courseName: this.examTask.courseName,
+        openAb: this.examTask.openAb,
         schoolName: this.$ls.get("schoolName"),
         makeMethod: "SELF",
         cardName: res.value,
@@ -1007,12 +1022,14 @@ export default {
     },
     // action
     getData() {
-      // TODO:
-      let data = { ...this.curTaskApply };
-      data.paperType = this.paperAttachments.map((item) => item.name).join(",");
-      data.paperAttachmentIds = JSON.stringify(this.paperAttachments, (k, v) =>
-        k === "url" ? undefined : v
-      );
+      this.updateExamTaskDetail();
+      const data = { ...this.curTaskApply };
+      data.examTaskDetailList = this.paperAttachments.map((item) => {
+        return {
+          ...item,
+          paperAttachmentIds: JSON.stringify(item.paperAttachmentIds),
+        };
+      });
       data.paperConfirmAttachmentIds = JSON.stringify(
         this.paperConfirmAttachments
       );
@@ -1032,15 +1049,9 @@ export default {
           });
           paperAttachment.paperType = paperAttachment.paperAttachmentIds
             .map((item) => item.name)
-            .join("");
+            .join();
         });
       }
-      // this.examTaskDetail = this.paperAttachments.map((item) => {
-      //   return {
-      //     ...item,
-      //     paperAttachmentIds: JSON.stringify(item.paperAttachmentIds),
-      //   };
-      // });
     },
     checkData() {
       this.updateExamTaskDetail();

+ 4 - 4
src/modules/exam/components/taskApply/TaskPrint.vue

@@ -286,7 +286,7 @@ export default {
       defaultTime: "",
       // exam task content
       infoExamTask: {},
-      infoExamTaskDetail: {},
+      infoExamTaskDetail: [],
       infoExamPrintPlan: {},
       infoPrintTask: {},
     };
@@ -329,11 +329,11 @@ export default {
 
       if (!this.curTaskApply.examTaskContent) return;
 
-      const { examTask, examTaskDetail, examDetail } = JSON.parse(
+      const { examTask, examTaskDetailList, examDetail } = JSON.parse(
         this.curTaskApply.examTaskContent
       );
       this.infoExamTask = examTask;
-      this.infoExamTaskDetail = examTaskDetail;
+      this.infoExamTaskDetail = examTaskDetailList;
       this.infoPrintTask = examDetail;
 
       this.modalForm = this.$objAssign(initModalForm, this.infoPrintTask);
@@ -581,7 +581,7 @@ export default {
         list: tableData,
       };
 
-      this.$objAssign(this.infoExamTaskDetail, examTaskData);
+      this.infoExamTaskDetail = examTaskData.examTaskDetailList;
       const examTaskContent = {
         examTask: this.infoExamTask,
         examTaskDetail: this.infoExamTaskDetail,

+ 6 - 1
src/modules/exam/store.js

@@ -1,3 +1,4 @@
+import { objTypeOf } from "@/plugins/utils";
 import {
   waitExamTaskCount,
   stmmsWaitTaskCount,
@@ -37,7 +38,11 @@ const mutations = {
   // createExamAndPrintTask
   updateTaskInfo(state, data) {
     Object.entries(data).forEach(([key, val]) => {
-      state[key] = Object.assign({}, state[key], val);
+      if (objTypeOf(val) === "array") {
+        state[key] = [...val];
+      } else {
+        state[key] = Object.assign({}, state[key], val);
+      }
     });
   },
   resetTaskInfo(state) {