Browse Source

命题模式2创建新增

zhangjie 3 years ago
parent
commit
165ce30b1c

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

@@ -67,14 +67,14 @@ export default {
     this.cardCreateMethod = this.prepareTcPCard.createMethod || "STANDARD";
     this.cardId = this.cardId || this.prepareTcPCard.id;
     this.cardType = this.prepareTcPCard.type || "CUSTOM";
-    if (
-      !this.prepareTcPCard.examTaskId &&
-      !this.isEdit &&
-      this.cardType === "CUSTOM"
-    ) {
-      this.$message.error("找不到命题任务,请退出题卡制作!");
-      return;
-    }
+    // if (
+    //   !this.prepareTcPCard.examTaskId &&
+    //   !this.isEdit &&
+    //   this.cardType === "CUSTOM"
+    // ) {
+    //   this.$message.error("找不到命题任务,请退出题卡制作!");
+    //   return;
+    // }
     this.initCard();
     this.registWindowSubmit();
   },

+ 5 - 1
src/modules/exam/components/ApplyContent.vue

@@ -577,7 +577,11 @@ export default {
         this.examTask.id,
         this.examTask.source
       );
-      this.$emit("info-update", { semesterName: data.semesterName });
+      this.$emit("info-update", {
+        semesterName: data.semesterName,
+        examName: data.examName,
+        examModel: data.examModel
+      });
       this.curTaskApply = this.$objAssign(initTaskApply, data || {});
       this.curTaskApply.examId =
         this.curTaskApply.examId || this.examTask.examId;

+ 32 - 8
src/modules/exam/components/ModifyTaskApply.vue

@@ -33,12 +33,8 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="考试时间:">
-              <span v-if="modalForm.examDate && modalForm.examTime">
-                {{ modalForm.examDate }} <i class="mr-1"></i>
-                {{ modalForm.examTime }}
-              </span>
-              <span v-else>--</span>
+            <el-form-item label="考试:">
+              <span>{{ modalForm.examName || "--" }}</span>
             </el-form-item>
           </el-col>
         </el-row>
@@ -55,15 +51,39 @@
           </el-col>
         </el-row>
         <el-row>
+          <el-col :span="12">
+            <el-form-item label="考试时间:">
+              <span v-if="modalForm.examDate && modalForm.examTime">
+                {{ modalForm.examDate }} <i class="mr-1"></i>
+                {{ modalForm.examTime }}
+              </span>
+              <span v-else>--</span>
+            </el-form-item>
+          </el-col>
           <el-col :span="12">
             <el-form-item label="审核状态:">
               <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row v-if="examRoomInfoList.length && IS_MODEL2">
+          <el-col :span="12">
+            <el-form-item label="总人数:">
+              <span>{{ examRoomInfoList[0].studentCount }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="总印份数:">
+              <span>{{ examRoomInfoList[0].printCount }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
 
-      <table class="table task-exam-room" v-if="examRoomInfoList.length">
+      <table
+        class="table task-exam-room"
+        v-if="examRoomInfoList.length && !IS_MODEL2"
+      >
         <colgroup>
           <col width="400" />
           <col width="100" />
@@ -106,6 +126,7 @@ const initModalForm = {
   id: null,
   examId: "",
   examName: "",
+  examModel: "",
   semesterId: "",
   semesterName: "",
   courseCode: "",
@@ -166,6 +187,9 @@ export default {
       } else {
         return "审核入库申请";
       }
+    },
+    IS_MODEL2() {
+      return this.modalForm.examModel === "MODEL2";
     }
   },
   data() {
@@ -187,6 +211,7 @@ export default {
     },
     modalInfoUpdate(data) {
       this.modalForm = this.$objAssign(this.modalForm, data);
+      this.getExamRoomInfo();
     },
     initData(val) {
       this.modalForm = this.$objAssign(initModalForm, val);
@@ -196,7 +221,6 @@ export default {
     },
     visibleChange() {
       this.initData(this.instance);
-      this.getExamRoomInfo();
     },
     async getExamRoomInfo() {
       const data = await taskApplyExamObject(this.instance.paperNumber);

+ 4 - 0
src/modules/exam/components/createExamAndPrintTask/CreateExamAndPrintTask.vue

@@ -60,6 +60,7 @@ import InfoPrintTask from "./InfoPrintTask";
 const initExamTask = {
   semesterId: "",
   examId: "",
+  examModel: "",
   courseCode: "",
   courseName: "",
   paperNumber: "",
@@ -73,6 +74,7 @@ const initExamTaskDetail = {
   operateType: "STAGE",
   paperType: "A",
   cardId: "",
+  cardType: "",
   paperAttachmentIds: "[]",
   paperConfirmAttachmentIds: "[]",
   drawCount: 2,
@@ -124,6 +126,8 @@ const initPrintTask = {
   paperNumber: "",
   courseName: "",
   courseCode: "",
+  printCount: 1, // MODEL2专用
+  printHouseId: "", // MODEL2专用
   list: []
 };
 

+ 48 - 23
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -24,6 +24,7 @@
                 :semester-id="examTask.semesterId"
                 :clearable="false"
                 class="width-full"
+                @change="examChange"
               ></exam-select>
             </el-form-item>
           </el-col>
@@ -134,6 +135,8 @@
                 class="mr-2"
                 v-model="examTaskDetail.cardId"
                 placeholder="请选择"
+                style="width: 200px"
+                @change="cardChange"
               >
                 <el-option
                   v-for="item in cards"
@@ -147,6 +150,17 @@
                 class="btn-primary"
                 type="text"
                 :disabled="!examTaskDetail.cardId"
+                @click="toViewCard"
+                >预览</el-button
+              >
+              <el-button
+                class="btn-primary"
+                type="text"
+                :disabled="
+                  !examTaskDetail.cardId ||
+                    examTaskDetail.cardType === 'GENERIC'
+                "
+                @click="toEditCard"
                 >编辑</el-button
               >
               <el-button
@@ -266,14 +280,6 @@ import { mapState, mapMutations } from "vuex";
 export default {
   name: "info-exam-task",
   components: { UploadPaperDialog, SimpleImagePreview, ModifyCard },
-  props: {
-    datas: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
   data() {
     return {
       task: {},
@@ -401,6 +407,11 @@ export default {
     semesterChange(val) {
       this.examTask.paperName = val.name;
     },
+    examChange(val) {
+      console.log(val);
+      this.examTask.examModel = val.examModel;
+      this.updateTaskInfo({ infoExamTask: this.examTask });
+    },
     teachingRoomChange() {
       this.examTask.courseCode = "";
       this.examTask.courseName = "";
@@ -423,9 +434,9 @@ export default {
       this.updateTaskInfo({ infoExamTask: this.examTask });
     },
     async examAndRoomChange() {
-      const { examId, teachingRoomId } = this.examTask;
       this.updateTaskInfo({ infoExamTask: this.examTask });
 
+      const { examId, teachingRoomId } = this.examTask;
       if (examId && teachingRoomId) {
         const examPrintPlan = await examConfigByExamIdOrgId({
           examId,
@@ -442,6 +453,14 @@ export default {
         });
       }
     },
+    cardChange() {
+      const card = this.cards.find(
+        item => item.id === this.examTaskDetail.cardId
+      );
+      if (card) {
+        this.examTaskDetail.cardType = card.type;
+      }
+    },
     toCreateCard() {
       this.$ls.set("prepareTcPCard", {
         courseCode: this.examTask.courseCode,
@@ -454,6 +473,23 @@ export default {
       });
       this.$refs.ModifyCard.open();
     },
+    toEditCard() {
+      this.$ls.set("prepareTcPCard", {
+        id: this.examTaskDetail.cardId
+      });
+      this.$refs.ModifyCard.open();
+    },
+    toViewCard() {
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: this.examTaskDetail.cardId,
+            viewType: "view"
+          }
+        })
+      );
+    },
     async cardModified(cardId) {
       if (!cardId) return;
       let card = this.cards.find(item => item.id === cardId);
@@ -555,20 +591,9 @@ export default {
     deletePaperConfirmAttachment(index) {
       this.paperConfirmAttachments.splice(index, 1);
     },
-    toViewCard() {
-      window.open(
-        this.getRouterPath({
-          name: "CardPreview",
-          params: {
-            cardId: this.examTaskDetail.cardId,
-            viewType: "view"
-          }
-        })
-      );
-    },
-    cardConfirm(data) {
-      this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
-    },
+    // cardConfirm(data) {
+    //   this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
+    // },
     getTaskDetailData() {
       let data = { ...this.examTaskDetail };
       data.paperType = this.paperAttachments.map(item => item.name).join(",");

+ 69 - 15
src/modules/exam/components/createExamAndPrintTask/InfoPrintTask.vue

@@ -1,6 +1,9 @@
 <template>
   <div class="info-print-task">
-    <p class="tips-info mb-2">
+    <p v-if="IS_MODEL2" class="tips-info mb-2">
+      考试需要命题老师提交具体印刷份数
+    </p>
+    <p v-else class="tips-info mb-2">
       考试需要命题老师提交完整的考务数据,每个卷袋表示一个考场,人数字段为应考人数,备份数量为该考场试卷题卡备用数量
     </p>
     <el-form ref="modalFormComp" label-position="top">
@@ -28,8 +31,48 @@
       </el-form-item>
       <el-form-item label="考试对象:" required></el-form-item>
     </el-form>
-
-    <div class="part-box">
+    <div v-if="IS_MODEL2" class="part-box">
+      <table class="table">
+        <colgroup>
+          <col width="50" />
+          <col width="50" />
+          <col width="50" />
+          <col width="100" />
+        </colgroup>
+        <tr>
+          <th>卷袋序号</th>
+          <th>印刷份数</th>
+          <th>备份数量</th>
+          <th>印刷室</th>
+        </tr>
+        <tr>
+          <td>1</td>
+          <td>
+            <el-input-number
+              v-model="modalForm.printCount"
+              style="width:80px"
+              :min="1"
+              :max="999999"
+              :step="1"
+              step-strictly
+              :controls="false"
+            ></el-input-number>
+          </td>
+          <td>{{ infoExamPrintPlan.backupCount }}</td>
+          <td>
+            <el-select v-model="modalForm.printHouseId" placeholder="请选择">
+              <el-option
+                v-for="room in printHouses"
+                :key="room.houseId"
+                :value="room.houseId"
+                :label="room.houseName"
+              ></el-option>
+            </el-select>
+          </td>
+        </tr>
+      </table>
+    </div>
+    <div v-else class="part-box">
       <div class="box-justify mb-2">
         <p>
           共{{ packageInfos.packageCount }}个卷袋,{{
@@ -136,14 +179,6 @@ import { mapState, mapMutations } from "vuex";
 export default {
   name: "info-print-task",
   components: { ModifyPrintTask },
-  props: {
-    datas: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
   data() {
     return {
       modalForm: {
@@ -151,7 +186,9 @@ export default {
         examEndTime: "",
         paperNumber: "",
         courseName: "",
-        courseCode: ""
+        courseCode: "",
+        printCount: 1,
+        printHouseId: ""
       },
       tableData: [],
       curRow: {},
@@ -182,6 +219,9 @@ export default {
     ]),
     cannotAdd() {
       return !this.unusedClassList.length;
+    },
+    IS_MODEL2() {
+      return this.infoExamTask.examModel === "MODEL2";
     }
   },
   watch: {
@@ -204,10 +244,12 @@ export default {
   methods: {
     ...mapMutations("exam", ["updateTaskInfo"]),
     async initData() {
+      if (this.IS_MODEL2) return;
+
       this.modalForm = Object.assign(this.modalForm, {
-        paperNumber: this.datas.examTask.paperNumber,
-        courseName: this.datas.examTask.courseName,
-        courseCode: this.datas.examTask.courseCode
+        paperNumber: this.infoExamTask.paperNumber,
+        courseName: this.infoExamTask.courseName,
+        courseCode: this.infoExamTask.courseCode
       });
 
       await this.getClassList();
@@ -238,6 +280,18 @@ export default {
         return Promise.reject();
       }
 
+      if (this.IS_MODEL2) {
+        if (!this.modalForm.printCount) {
+          this.$message.error("请输入印刷分数!");
+          return Promise.reject();
+        }
+        if (!this.modalForm.printHouseId) {
+          this.$message.error("请选择印刷室!");
+          return Promise.reject();
+        }
+        return Promise.resolve(true);
+      }
+
       if (!this.tableData.length) {
         this.$message.error("请添加考试对象!");
         return Promise.reject();

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

@@ -30,7 +30,7 @@ const mutations = {
   // createExamAndPrintTask
   updateTaskInfo(state, data) {
     Object.entries(data).forEach(([key, val]) => {
-      state[key] = Object.assign(state[key], val);
+      state[key] = Object.assign({}, state[key], val);
     });
   },
   resetTaskInfo(state) {