Bläddra i källkod

feat: 命题任务修改

zhangjie 8 månader sedan
förälder
incheckning
a9e9f9dbeb

+ 5 - 5
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -469,7 +469,7 @@
 <script>
 import { mapState, mapMutations } from "vuex";
 import UploadPaperDialog from "../UploadPaperDialog.vue";
-import SimpleImagePreview from "@/components/SimpleImagePreview";
+import SimpleImagePreview from "@/components/SimpleImagePreview.vue";
 import ModifyCard from "../../../card/components/ModifyCard.vue";
 import SelectTikuPaperDialog from "./SelectTikuPaperDialog.vue";
 import { COMMON_CARD_RULE_ID } from "../../../../constants/enumerate";
@@ -797,6 +797,9 @@ export default {
             used: aAttachment.used,
             createId: aAttachment.createId,
           });
+          paperAttachment.paperType = paperAttachment.paperAttachmentIds
+            .map((item) => item.name)
+            .join("");
         });
       }
       this.examTaskDetail = this.paperAttachments.map((item) => {
@@ -910,7 +913,7 @@ export default {
     async toCopyCard(attachment) {
       this.curAttachment = { ...attachment };
       const newCardId = await copyCard(
-        attachment.toCopyCardId,
+        attachment.cardId,
         this.examTask.courseId
       );
       this.cardModified({ id: newCardId });
@@ -1050,9 +1053,6 @@ export default {
       };
       this.updateTaskInfo(data);
     },
-    emitRelateInfo(type) {
-      this.$emit("relate-info-change", this.getData(), type);
-    },
     // select-paper
     getAttachmentPos(attachment) {
       const pindex = this.paperAttachments.findIndex(

+ 466 - 338
src/modules/exam/components/taskApply/TaskPaper.vue

@@ -1,5 +1,10 @@
 <template>
   <div>
+    <!-- <el-form>
+      <el-form-item label="启用AB卷:">
+        <el-switch v-model="examTask.openAb" @change="openAbChange"></el-switch>
+      </el-form-item>
+    </el-form> -->
     <!-- menu -->
     <div
       v-if="checkPrivilege('button', 'SelectTikuPaper', 'TaskApplyManage')"
@@ -17,13 +22,15 @@
     <!-- table -->
     <table class="table mb-2">
       <colgroup>
-        <col width="100" />
+        <col width="90" />
+        <col width="60" />
         <col width="240" />
         <col />
         <col v-if="taskStatus.IS_APPLY && !taskStatus.IS_REBUILD" width="80" />
       </colgroup>
       <tr>
-        <th>试卷类型</th>
+        <th>备用卷</th>
+        <th>卷型</th>
         <th>试卷文件</th>
         <th>
           答题卡
@@ -33,286 +40,310 @@
         </th>
         <th v-if="taskStatus.IS_APPLY && !taskStatus.IS_REBUILD">操作</th>
       </tr>
-      <tr v-for="(attachment, index) in paperAttachments" :key="index">
-        <td>
-          <span>{{ attachment.name }}卷</span>
-          <span class="color-gray-2" v-if="attachment.isExposed">(已曝光)</span>
-        </td>
-        <template v-if="IS_TIKU_TAB">
-          <!-- 试卷文件 -->
+      <template v-for="(paperAttachment, pindex) in paperAttachments">
+        <tr
+          v-for="(attachment, index) in paperAttachment.paperAttachmentIds"
+          :key="`${pindex}-${index}`"
+        >
+          <td
+            v-if="index === 0"
+            :rowspan="paperAttachment.paperAttachmentIds.length"
+          >
+            卷{{ paperAttachment.serialNumber }}
+            <!-- <span class="color-gray-2" v-if="paperAttachment.isExposed"
+              >(已曝光)</span
+            > -->
+          </td>
           <td>
-            <template v-if="!attachment.isExposed && taskStatus.IS_APPLY">
-              <div class="box-justify">
-                <el-button
-                  type="text"
-                  class="btn-primary box-grow"
-                  @click="toSelect(attachment)"
+            <span>{{ attachment.name }}</span>
+          </td>
+          <template v-if="IS_TIKU_TAB">
+            <!-- 试卷文件 -->
+            <td>
+              <template v-if="!attachment.isExposed && taskStatus.IS_APPLY">
+                <div class="box-justify">
+                  <el-button
+                    type="text"
+                    class="btn-primary box-grow"
+                    @click="toSelect(attachment)"
+                  >
+                    <i
+                      :class="[
+                        'icon',
+                        attachment.attachmentId
+                          ? 'icon-files-act'
+                          : 'icon-files',
+                      ]"
+                    ></i
+                    >{{ attachment.filename || "选择试卷" }}
+                  </el-button>
+                  <el-button
+                    type="text"
+                    class="btn-primary box-static"
+                    :disabled="!attachment.paperUrl"
+                    @click="toViewPaper(attachment)"
+                    >预览</el-button
+                  >
+                </div>
+              </template>
+              <el-button
+                v-else
+                type="text"
+                class="btn-primary"
+                @click="downloadPaper(attachment)"
+              >
+                <div
+                  :class="{
+                    'color-primary':
+                      auditLogCache.paper[attachment.attachmentId],
+                  }"
                 >
                   <i
-                    :class="[
-                      'icon',
-                      attachment.attachmentId ? 'icon-files-act' : 'icon-files',
-                    ]"
-                  ></i
-                  >{{ attachment.filename || "选择试卷" }}
-                </el-button>
+                    class="icon icon-download mr-1"
+                    v-if="attachment.attachmentId"
+                  ></i>
+                  {{ attachment.filename }}
+                </div>
+              </el-button>
+            </td>
+            <!-- 答题卡 -->
+            <td
+              v-if="index === 0"
+              :rowspan="paperAttachment.paperAttachmentIds.length"
+            >
+              <template v-if="taskStatus.IS_APPLY">
+                <el-select
+                  v-model="attachment.cardId"
+                  placeholder="请选择"
+                  style="width: 260px; margin-right: 10px"
+                  @change="(val) => tkCardChange(val, attachment)"
+                >
+                  <el-option
+                    v-for="item in attachment.cards"
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.title"
+                  >
+                    <div class="box-justify">
+                      <div class="box-grow">{{ item.title }}</div>
+                      <el-button
+                        class="btn-danger btn-icon box-static"
+                        type="text"
+                        icon="el-icon-remove"
+                        @click="toDeleteCard(item, attachment)"
+                      ></el-button>
+                    </div>
+                  </el-option>
+                </el-select>
                 <el-button
+                  class="btn-primary"
                   type="text"
-                  class="btn-primary box-static"
-                  :disabled="!attachment.paperUrl"
-                  @click="toViewPaper(attachment)"
+                  :disabled="!attachment.cardId"
+                  @click="toViewCard(attachment)"
                   >预览</el-button
                 >
-              </div>
-            </template>
-            <el-button
-              v-else
-              type="text"
-              class="btn-primary"
-              @click="downloadPaper(attachment)"
-            >
-              <div
-                :class="{
-                  'color-primary': auditLogCache.paper[attachment.attachmentId],
-                }"
-              >
-                <i
-                  class="icon icon-download mr-1"
-                  v-if="attachment.attachmentId"
-                ></i>
-                {{ attachment.filename }}
-              </div>
-            </el-button>
-          </td>
-          <!-- 答题卡 -->
-          <td>
-            <template v-if="taskStatus.IS_APPLY">
-              <el-select
-                v-model="attachment.cardId"
-                placeholder="请选择"
-                style="width: 260px; margin-right: 10px"
-                @change="(val) => tkCardChange(val, attachment)"
-              >
-                <el-option
-                  v-for="item in attachment.cards"
-                  :key="item.id"
-                  :value="item.id"
-                  :label="item.title"
+                <el-button
+                  v-if="!taskStatus.IS_REBUILD"
+                  class="btn-primary"
+                  type="text"
+                  :disabled="!attachment.cardId"
+                  @click="toEditCard(attachment)"
+                  >编辑</el-button
                 >
-                  <div class="box-justify">
-                    <div class="box-grow">{{ item.title }}</div>
-                    <el-button
-                      class="btn-danger btn-icon box-static"
-                      type="text"
-                      icon="el-icon-remove"
-                      @click="toDeleteCard(item, attachment)"
-                    ></el-button>
-                  </div>
-                </el-option>
-              </el-select>
+              </template>
               <el-button
-                class="btn-primary"
+                v-else
                 type="text"
-                :disabled="!attachment.cardId"
+                class="btn-primary"
                 @click="toViewCard(attachment)"
-                >预览</el-button
+                ><i
+                  :class="{
+                    'color-primary': auditLogCache.card[attachment.cardId],
+                  }"
+                  >{{ attachment.cardTitle || "预览" }}</i
+                ></el-button
               >
+            </td>
+          </template>
+          <template v-else>
+            <!-- 试卷文件 -->
+            <td>
               <el-button
-                v-if="!taskStatus.IS_REBUILD"
-                class="btn-primary"
+                v-if="!attachment.isExposed && taskStatus.IS_APPLY"
                 type="text"
-                :disabled="!attachment.cardId"
-                @click="toEditCard(attachment)"
-                >编辑</el-button
-              >
-            </template>
-            <el-button
-              v-else
-              type="text"
-              class="btn-primary"
-              @click="toViewCard(attachment)"
-              ><i
-                :class="{
-                  'color-primary': auditLogCache.card[attachment.cardId],
-                }"
-                >{{ attachment.cardTitle || "预览" }}</i
-              ></el-button
-            >
-          </td>
-        </template>
-        <template v-else>
-          <!-- 试卷文件 -->
-          <td>
-            <el-button
-              v-if="!attachment.isExposed && taskStatus.IS_APPLY"
-              type="text"
-              class="btn-primary"
-              @click="toUpload(attachment)"
-            >
-              <i
-                :class="[
-                  'icon',
-                  attachment.attachmentId ? 'icon-files-act' : 'icon-files',
-                ]"
-              ></i
-              >{{
-                attachment.attachmentId
-                  ? attachment.filename
-                  : "点击上传试卷文件"
-              }}
-            </el-button>
-            <el-button
-              v-else
-              type="text"
-              class="btn-primary"
-              @click="downloadPaper(attachment)"
-            >
-              <div
-                :class="{
-                  'color-primary': auditLogCache.paper[attachment.attachmentId],
-                }"
+                class="btn-primary"
+                @click="toUpload(attachment)"
               >
                 <i
-                  class="icon icon-download mr-1"
-                  v-if="attachment.attachmentId"
-                ></i>
-                {{ attachment.filename }}
-              </div>
-            </el-button>
-          </td>
-          <!-- 答题卡 -->
-          <td>
-            <template v-if="taskStatus.IS_APPLY">
-              <el-select
-                class="mr-2"
-                v-model="attachment.cardId"
-                placeholder="请选择"
-                style="width: 200px"
-                filterable
-                @change="cardChange(attachment)"
-              >
-                <el-option
-                  v-for="item in cards"
-                  :key="item.id"
-                  :value="item.id"
-                  :label="item.title"
-                  :disabled="item.disabled"
-                >
-                  <div class="box-justify">
-                    <div class="box-grow">
-                      <span
-                        :class="[
-                          item.type === 'GENERIC'
-                            ? 'color-success'
-                            : 'color-primary',
-                          'mr-1',
-                          {
-                            'color-danger': item.used,
-                          },
-                        ]"
-                        >[{{ item.type === "GENERIC" ? "通" : "专" }}]</span
-                      >
-                      {{ item.title }}
-                    </div>
-                    <el-button
-                      v-if="item.type !== 'GENERIC'"
-                      class="btn-danger btn-icon box-static"
-                      type="text"
-                      icon="el-icon-remove"
-                      @click="toDeleteCard(item, attachment)"
-                    ></el-button>
-                  </div>
-                </el-option>
-              </el-select>
-              <span
-                v-if="attachment.cardId"
-                :class="[
-                  attachment.cardType === 'GENERIC'
-                    ? 'color-success'
-                    : 'color-primary',
-                  'mr-1',
-                  {
-                    'color-danger': attachment.used,
-                  },
-                ]"
-                >[{{ attachment.cardType === "GENERIC" ? "通" : "专" }}]</span
-              >
+                  :class="[
+                    'icon',
+                    attachment.attachmentId ? 'icon-files-act' : 'icon-files',
+                  ]"
+                ></i
+                >{{
+                  attachment.attachmentId
+                    ? attachment.filename
+                    : "点击上传试卷文件"
+                }}
+              </el-button>
               <el-button
-                class="btn-primary"
+                v-else
                 type="text"
-                :disabled="!attachment.cardId"
-                @click="toViewCard(attachment)"
-                >预览</el-button
+                class="btn-primary"
+                @click="downloadPaper(attachment)"
               >
-              <template v-if="!taskStatus.IS_REBUILD">
-                <el-button
-                  class="btn-primary"
-                  type="text"
-                  :disabled="
-                    !attachment.cardId ||
-                    (attachment.cardType === 'GENERIC' &&
-                      attachment.createMethod !== 'STANDARD')
-                  "
-                  @click="toCopyCard(attachment)"
-                  >复制</el-button
+                <div
+                  :class="{
+                    'color-primary':
+                      auditLogCache.paper[attachment.attachmentId],
+                  }"
                 >
-                <el-button
-                  class="btn-primary"
-                  type="text"
-                  :disabled="
-                    !attachment.cardId ||
-                    attachment.cardType === 'GENERIC' ||
-                    !(!attachment.used && attachment.createId === user.id)
-                  "
-                  @click="toEditCard(attachment)"
-                  >编辑</el-button
+                  <i
+                    class="icon icon-download mr-1"
+                    v-if="attachment.attachmentId"
+                  ></i>
+                  {{ attachment.filename }}
+                </div>
+              </el-button>
+            </td>
+            <!-- 答题卡 -->
+            <td
+              v-if="index === 0"
+              :rowspan="paperAttachment.paperAttachmentIds.length"
+            >
+              <template v-if="taskStatus.IS_APPLY">
+                <el-select
+                  class="mr-2"
+                  v-model="attachment.cardId"
+                  placeholder="请选择"
+                  style="width: 200px"
+                  filterable
+                  @change="cardChange(attachment)"
+                >
+                  <el-option
+                    v-for="item in cards"
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.title"
+                    :disabled="item.disabled"
+                  >
+                    <div class="box-justify">
+                      <div class="box-grow">
+                        <span
+                          :class="[
+                            item.type === 'GENERIC'
+                              ? 'color-success'
+                              : 'color-primary',
+                            'mr-1',
+                            {
+                              'color-danger': item.used,
+                            },
+                          ]"
+                          >[{{ item.type === "GENERIC" ? "通" : "专" }}]</span
+                        >
+                        {{ item.title }}
+                      </div>
+                      <el-button
+                        v-if="item.type !== 'GENERIC'"
+                        class="btn-danger btn-icon box-static"
+                        type="text"
+                        icon="el-icon-remove"
+                        @click="toDeleteCard(item, attachment)"
+                      ></el-button>
+                    </div>
+                  </el-option>
+                </el-select>
+                <span
+                  v-if="attachment.cardId"
+                  :class="[
+                    attachment.cardType === 'GENERIC'
+                      ? 'color-success'
+                      : 'color-primary',
+                    'mr-1',
+                    {
+                      'color-danger': attachment.used,
+                    },
+                  ]"
+                  >[{{ attachment.cardType === "GENERIC" ? "通" : "专" }}]</span
                 >
                 <el-button
                   class="btn-primary"
                   type="text"
-                  :disabled="!taskStatus.CAN_CREATE_CARD"
-                  @click="toCreateCard(attachment)"
-                  >新建</el-button
+                  :disabled="!attachment.cardId"
+                  @click="toViewCard(attachment)"
+                  >预览</el-button
                 >
+                <template v-if="!taskStatus.IS_REBUILD">
+                  <el-button
+                    class="btn-primary"
+                    type="text"
+                    :disabled="
+                      !attachment.cardId ||
+                      (attachment.cardType === 'GENERIC' &&
+                        attachment.createMethod !== 'STANDARD')
+                    "
+                    @click="toCopyCard(attachment)"
+                    >复制</el-button
+                  >
+                  <el-button
+                    class="btn-primary"
+                    type="text"
+                    :disabled="
+                      !attachment.cardId ||
+                      attachment.cardType === 'GENERIC' ||
+                      !(!attachment.used && attachment.createId === user.id)
+                    "
+                    @click="toEditCard(attachment)"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    class="btn-primary"
+                    type="text"
+                    :disabled="!taskStatus.CAN_CREATE_CARD"
+                    @click="toCreateCard(attachment)"
+                    >新建</el-button
+                  >
+                </template>
               </template>
-            </template>
+              <el-button
+                v-else
+                type="text"
+                class="btn-primary"
+                @click="toViewCard(attachment)"
+              >
+                <i
+                  :class="{
+                    'color-primary': auditLogCache.card[attachment.cardId],
+                  }"
+                >
+                  {{ attachment.cardTitle || "预览" }}
+                </i>
+              </el-button>
+            </td>
+          </template>
+          <!-- 操作 -->
+          <td
+            v-if="taskStatus.IS_APPLY && !taskStatus.IS_REBUILD && index === 0"
+            :rowspan="paperAttachment.paperAttachmentIds.length"
+            class="text-right"
+          >
             <el-button
-              v-else
+              v-if="index === paperAttachments.length - 1"
+              class="btn-primary btn-icon"
               type="text"
-              class="btn-primary"
-              @click="toViewCard(attachment)"
-            >
-              <i
-                :class="{
-                  'color-primary': auditLogCache.card[attachment.cardId],
-                }"
-              >
-                {{ attachment.cardTitle || "预览" }}
-              </i>
-            </el-button>
+              icon="el-icon-circle-plus"
+              @click="addAtachment"
+            ></el-button>
+            <el-button
+              v-if="attachment.canDelete"
+              class="btn-danger btn-icon"
+              type="text"
+              icon="el-icon-remove"
+              @click="deleteAttachment(index)"
+            ></el-button>
           </td>
-        </template>
-        <!-- 操作 -->
-        <td
-          v-if="taskStatus.IS_APPLY && !taskStatus.IS_REBUILD"
-          class="text-right"
-        >
-          <el-button
-            v-if="index === paperAttachments.length - 1"
-            class="btn-primary btn-icon"
-            type="text"
-            icon="el-icon-circle-plus"
-            @click="addAtachment"
-          ></el-button>
-          <el-button
-            v-if="attachment.canDelete"
-            class="btn-danger btn-icon"
-            type="text"
-            icon="el-icon-remove"
-            @click="deleteAttachment(index)"
-          ></el-button>
-        </td>
-      </tr>
+        </tr>
+      </template>
       <tr v-if="!paperAttachments.length">
         <td colspan="5">
           <p class="tips-info text-center">暂无数据</p>
@@ -320,21 +351,6 @@
       </tr>
     </table>
 
-    <el-form v-if="!taskStatus.IS_REBUILD">
-      <el-form-item label="单次抽卷卷型数量:" label-width="150">
-        <el-input-number
-          v-model="curTaskApply.drawCount"
-          :min="1"
-          :max="maxFetchCount"
-          :step="1"
-          :controls="false"
-          step-strictly
-          :disabled="!taskStatus.IS_APPLY || taskStatus.IS_EXPOSED_MODE"
-        ></el-input-number>
-        <!-- :disabled="!taskStatus.IS_APPLY || taskStatus.IS_EXPOSED_MODE" -->
-      </el-form-item>
-    </el-form>
-
     <!-- 附件 -->
     <h4 class="mb-2">
       附件<span v-if="taskStatus.IS_APPLY"
@@ -454,6 +470,7 @@ import { mapState, mapMutations, mapActions } from "vuex";
 import { cardForSelectList } from "../../api";
 import { deleteCard } from "../../../base/api";
 import { copyCard } from "../../../card/api";
+import { deepCopy } from "@/plugins/utils";
 
 import UploadPaperDialog from "../UploadPaperDialog.vue";
 import SelectTikuPaperDialog from "../createExamAndPrintTask/SelectTikuPaperDialog.vue";
@@ -521,11 +538,6 @@ export default {
     IS_TIKU_TAB() {
       return this.curTab === "tiku";
     },
-    maxFetchCount() {
-      return this.paperAttachments.length < 1
-        ? 1
-        : this.paperAttachments.length;
-    },
     imageAttachments() {
       return this.paperConfirmAttachments.filter(
         (item) => item.fileType === "image"
@@ -579,6 +591,30 @@ export default {
 
       if (this.taskStatus.IS_APPLY) this.getCardList();
     },
+    openAbChange() {
+      if (!this.taskStatus.IS_APPLY) return;
+
+      if (this.examTask.openAb) {
+        this.paperAttachments.forEach((paperAttachment) => {
+          const attachment = paperAttachment.paperAttachmentIds[0];
+          paperAttachment.paperAttachmentIds.push(
+            Object.assign(deepCopy(attachment), {
+              name: "B",
+              attachmentId: "",
+              filename: "",
+              paperId: null,
+              paperUrl: null,
+              pages: 0,
+            })
+          );
+        });
+      } else {
+        this.paperAttachments.forEach((paperAttachment) => {
+          paperAttachment.paperAttachmentIds =
+            paperAttachment.paperAttachmentIds.slice(0, 1);
+        });
+      }
+    },
     async selectMenu(tab) {
       if (!this.taskStatus.IS_APPLY) return;
 
@@ -623,31 +659,62 @@ export default {
         examId: this.curTaskApply.examId,
         paperId: attachment.paperId,
       });
-      attachment.cards = data || [];
+      attachment.cards = (data || []).map((item) => {
+        return {
+          id: item.id,
+          title: item.title,
+          type: item.type,
+          createId: item.createId,
+          makeMethod: item.makeMethod,
+          used: item.used,
+        };
+      });
     },
-    addAtachment() {
-      if (this.paperAttachments.length >= this.attachmentLimitCount) return;
+    getAttachmentPos(attachment) {
+      const pindex = this.paperAttachments.findIndex(
+        (item) => item.serialNumber === attachment.serialNumber
+      );
+      if (pindex === -1) return;
+
+      const index = this.paperAttachments[pindex].paperAttachmentIds.findIndex(
+        (item) => item.name === attachment.name
+      );
+      if (index === -1) return;
 
-      const name = this.abc[this.paperAttachments.length];
+      return { pindex, index };
+    },
+    addAtachment() {
+      const serialNumber = this.paperAttachments.length + 1;
       const newAttachment = {
-        name,
+        name: "A",
+        serialNumber,
         attachmentId: "",
         filename: "",
         paperId: null,
         paperUrl: null,
-        uuid: null,
+        uuid: this.examTask.uuid,
         cardId: "",
         cardType: "",
         createMethod: "",
         cardTitle: "",
         pages: 0,
-        canDelete: true,
-        isExposed: false,
         used: false,
         createId: null,
         cards: [],
       };
-      this.paperAttachments.push(newAttachment);
+      const paperAttachment = {
+        serialNumber,
+        paperType: "",
+        paperAttachmentIds: [],
+      };
+      paperAttachment.paperAttachmentIds.push(newAttachment);
+
+      if (this.examTask.openAb) {
+        paperAttachment.paperAttachmentIds.push(
+          Object.assign(deepCopy(newAttachment), { name: "B" })
+        );
+      }
+      this.paperAttachments.push(paperAttachment);
     },
     deleteAttachment(index) {
       if (this.paperAttachments.length <= 1) {
@@ -656,15 +723,11 @@ export default {
       }
       this.paperAttachments.splice(index, 1);
       this.paperAttachments.forEach((item, itemIndex) => {
-        item.name = this.abc[itemIndex];
+        item.serialNumber = itemIndex + 1;
+        item.paperAttachmentIds.forEach((attachment) => {
+          attachment.serialNumber = item.serialNumber;
+        });
       });
-
-      if (
-        this.curTaskApply.drawCount &&
-        this.curTaskApply.drawCount > this.paperAttachments.length
-      ) {
-        this.curTaskApply.drawCount = this.paperAttachments.length;
-      }
     },
     toUpload(attachment) {
       this.curUploadType = "paper";
@@ -683,10 +746,16 @@ export default {
     },
     uploadConfirm(attachment, uploadType) {
       if (uploadType === "paper") {
-        const index = this.paperAttachments.findIndex(
-          (item) => item.name === attachment.name
+        const pos = this.getAttachmentPos(attachment);
+        if (!pos) return;
+
+        this.paperAttachments[pos.pindex].paperAttachmentIds.splice(
+          pos.index,
+          1,
+          {
+            ...attachment,
+          }
         );
-        this.paperAttachments.splice(index, 1, { ...attachment });
       } else {
         this.paperConfirmAttachments.push(attachment);
       }
@@ -728,40 +797,42 @@ export default {
       // data: {id,title}
       if (!data.id) return;
 
+      const pos = this.getAttachmentPos(this.curAttachment);
+      if (!pos) return;
+
       if (this.IS_TIKU_TAB) {
-        const aind = this.paperAttachments.findIndex(
-          (item) => item.name === this.curAttachment.name
-        );
-        this.paperAttachments[aind].cardTitle = data.title;
+        this.paperAttachments[pos.pindex].paperAttachmentIds[
+          pos.index
+        ].cardTitle = data.title;
         await this.getTkCardList(this.curAttachment);
-
         return;
       }
 
       await this.getCardList();
       let card = this.cards.find((item) => item.id === data.id);
+      if (!card) return;
 
-      const aind = this.paperAttachments.findIndex(
-        (item) => item.name === this.curAttachment.name
+      Object.assign(
+        this.paperAttachments[pos.pindex].paperAttachmentIds[pos.index],
+        {
+          cardId: card.id,
+          cardType: card.type,
+          createMethod: card.createMethod,
+          cardTitle: card.title,
+          used: card.used,
+          createId: card.createId,
+        }
       );
-      if (aind !== -1 && card) {
-        this.paperAttachments[aind].cardId = card.id;
-        this.paperAttachments[aind].cardType = card.type;
-        this.paperAttachments[aind].createMethod = card.createMethod;
-        this.paperAttachments[aind].cardTitle = card.title;
-        this.paperAttachments[aind].used = card.used;
-        this.paperAttachments[aind].createId = card.createId;
-      }
     },
     cardChange(attachment) {
       const card = this.cards.find((item) => item.id === attachment.cardId);
-      if (card) {
-        attachment.cardType = card.type;
-        attachment.createMethod = card.createMethod;
-        attachment.cardTitle = card.title;
-        attachment.used = card.used;
-        attachment.createId = card.createId;
-      }
+      if (!card) return;
+
+      attachment.cardType = card.type;
+      attachment.createMethod = card.createMethod;
+      attachment.cardTitle = card.title;
+      attachment.used = card.used;
+      attachment.createId = card.createId;
     },
     tkCardChange(card, attachment) {
       attachment.cardTitle = card.title;
@@ -829,9 +900,28 @@ export default {
     },
     // select-paper
     toSelect(attachment) {
+      if (!this.examTask.courseId) {
+        this.$message.error("请先选择课程!");
+        return;
+      }
+
+      let comparePaperId = null;
+      if (this.examTask.openAb) {
+        const pos = this.getAttachmentPos(attachment);
+        if (!pos) return;
+        const paperAttachment = this.paperAttachments[pos.pindex];
+        const otherAttachment = paperAttachment.paperAttachmentIds.find(
+          (item) => item.name !== attachment.name
+        );
+        if (otherAttachment) comparePaperId = otherAttachment.paperId;
+      }
+
       this.curAttachment = {
         ...attachment,
+        comparePaperId,
         courseId: this.examTask.courseId,
+        examId: this.examTask.examId,
+        uuid: this.examTask.uuid,
       };
       this.$refs.SelectTikuPaperDialog.open();
     },
@@ -857,25 +947,32 @@ export default {
         this.$message.error(data.message);
         return;
       }
-      const ind = this.paperAttachments.findIndex(
-        (item) => item.name === this.curAttachment.name
-      );
-      if (ind === -1) return;
+
+      const pos = this.getAttachmentPos(this.curAttachment);
+      if (!pos) return;
 
       const info = data.data;
-      this.curAttachment = { ...this.paperAttachments[ind] };
-      this.paperAttachments[ind] = Object.assign(this.paperAttachments[ind], {
-        paperId: this.cardBuildPresetData.paperId,
-        cardType: this.cardBuildPresetData.type,
-        createMethod: this.cardBuildPresetData.createMethod,
-        filename: this.cardBuildPresetData.paperName,
-        cardId: info.id,
-        cardTitle: info.title,
-        uuid: info.uuid,
-        attachmentId: info.attachmentId,
-        paperUrl: info.paperUrl,
-      });
-      this.getTkCardList(this.paperAttachments[ind]);
+      this.curAttachment = {
+        ...this.paperAttachments[pos.pindex].paperAttachmentIds[pos.index],
+      };
+
+      Object.assign(
+        this.paperAttachments[pos.pindex].paperAttachmentIds[pos.index],
+        {
+          paperId: this.cardBuildPresetData.paperId,
+          cardType: this.cardBuildPresetData.type,
+          createMethod: this.cardBuildPresetData.createMethod,
+          filename: this.cardBuildPresetData.paperName,
+          cardId: info.id,
+          cardTitle: info.title,
+          uuid: info.uuid,
+          attachmentId: info.attachmentId,
+          paperUrl: info.paperUrl,
+        }
+      );
+      this.getTkCardList(
+        this.paperAttachments[pos.pindex].paperAttachmentIds[pos.index]
+      );
     },
     toViewPaper(attachment) {
       if (!attachment.paperUrl) return;
@@ -910,6 +1007,7 @@ 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) =>
@@ -920,15 +1018,45 @@ export default {
       );
       return data;
     },
+    updateExamTaskDetail() {
+      if (this.examTask.openAb) {
+        this.paperAttachments.forEach((paperAttachment) => {
+          const aAttachment = paperAttachment.paperAttachmentIds[0];
+          Object.assign(paperAttachment.paperAttachmentIds[1], {
+            cardId: aAttachment.cardId,
+            cardType: aAttachment.cardType,
+            createMethod: aAttachment.createMethod,
+            cardTitle: aAttachment.cardTitle,
+            used: aAttachment.used,
+            createId: aAttachment.createId,
+          });
+          paperAttachment.paperType = paperAttachment.paperAttachmentIds
+            .map((item) => item.name)
+            .join("");
+        });
+      }
+      // this.examTaskDetail = this.paperAttachments.map((item) => {
+      //   return {
+      //     ...item,
+      //     paperAttachmentIds: JSON.stringify(item.paperAttachmentIds),
+      //   };
+      // });
+    },
     checkData() {
+      this.updateExamTaskDetail();
+
+      const paperAttachments = this.paperAttachments
+        .map((item) => item.paperAttachmentIds)
+        .flat();
+
       if (this.IS_TIKU_TAB) {
-        const paperValid = !this.paperAttachments.some((item) => !item.paperId);
+        const paperValid = !paperAttachments.some((item) => !item.paperId);
         if (!paperValid) {
           this.$message.error("请完成试卷选择!");
           return;
         }
 
-        const cardValid = !this.paperAttachments.some((item) => !item.cardId);
+        const cardValid = !paperAttachments.some((item) => !item.cardId);
         if (!cardValid) {
           this.$message.error("有试卷类型未选择题卡!");
           return;
@@ -937,7 +1065,7 @@ export default {
         // 设置了入库强制包含试卷时,校验试卷是否上传。
         // 未设置入库强制包含试卷时,若有试卷上传,则需要上传全部。若无试卷上传,则通过。
         if (this.curTaskApply.includePaper) {
-          const attachmentValid = !this.paperAttachments.some(
+          const attachmentValid = !paperAttachments.some(
             (item) => !item.attachmentId
           );
           if (!attachmentValid) {
@@ -945,19 +1073,19 @@ export default {
             return;
           }
         } else {
-          const hasUploadPaperAttachments = this.paperAttachments.filter(
+          const hasUploadPaperAttachments = paperAttachments.filter(
             (item) => item.attachmentId
           );
           if (
             hasUploadPaperAttachments.length > 0 &&
-            hasUploadPaperAttachments.length !== this.paperAttachments.length
+            hasUploadPaperAttachments.length !== paperAttachments.length
           ) {
             this.$message.error("有试卷文件未完成上传!");
             return;
           }
         }
 
-        const cardValid = !this.paperAttachments.some((item) => !item.cardId);
+        const cardValid = !paperAttachments.some((item) => !item.cardId);
         if (!cardValid) {
           this.$message.error("有试卷类型未选择题卡!");
           return;