浏览代码

fix:题卡选择问题

zhangjie 2 年之前
父节点
当前提交
8a57195770

+ 14 - 0
src/modules/exam/components/ApplyContent.vue

@@ -63,6 +63,9 @@
                 placeholder="请选择"
                 placeholder="请选择"
                 style="width: 200px"
                 style="width: 200px"
                 filterable
                 filterable
+                @visible-change="
+                  visible => cardOptionOpened(visible, attachment)
+                "
                 @change="cardChange(attachment)"
                 @change="cardChange(attachment)"
               >
               >
                 <el-option
                 <el-option
@@ -70,6 +73,7 @@
                   :key="item.id"
                   :key="item.id"
                   :value="item.id"
                   :value="item.id"
                   :label="item.title"
                   :label="item.title"
+                  :disabled="item.disabled"
                 >
                 >
                 </el-option>
                 </el-option>
               </el-select>
               </el-select>
@@ -937,6 +941,16 @@ export default {
         attachment.cardTitle = card.title;
         attachment.cardTitle = card.title;
       }
       }
     },
     },
+    cardOptionOpened(visible, attachment) {
+      if (!visible) return;
+
+      const selectedCardIds = this.paperAttachments.map(item => item.cardId);
+      this.cards = this.cards.map(card => {
+        card.disabled =
+          card.id !== attachment.cardId && selectedCardIds.includes(card.id);
+        return card;
+      });
+    },
     toCreateCard(attachment) {
     toCreateCard(attachment) {
       if (!this.examTask.cardRuleId) {
       if (!this.examTask.cardRuleId) {
         this.$message.error("题卡规则缺失!");
         this.$message.error("题卡规则缺失!");

+ 13 - 0
src/modules/exam/components/ModifyTaskPaper.vue

@@ -121,6 +121,9 @@
                   placeholder="请选择"
                   placeholder="请选择"
                   style="width: 200px"
                   style="width: 200px"
                   filterable
                   filterable
+                  @visible-change="
+                    visible => cardOptionOpened(visible, attachment)
+                  "
                   @change="cardChange(attachment)"
                   @change="cardChange(attachment)"
                 >
                 >
                   <el-option
                   <el-option
@@ -496,6 +499,16 @@ export default {
         attachment.cardTitle = card.title;
         attachment.cardTitle = card.title;
       }
       }
     },
     },
+    cardOptionOpened(visible, attachment) {
+      if (!visible) return;
+
+      const selectedCardIds = this.paperAttachments.map(item => item.cardId);
+      this.cards = this.cards.map(card => {
+        card.disabled =
+          card.id !== attachment.cardId && selectedCardIds.includes(card.id);
+        return card;
+      });
+    },
     checkDataValid() {
     checkDataValid() {
       const attachmentValid = !this.paperAttachments.some(
       const attachmentValid = !this.paperAttachments.some(
         item => !item.attachmentId
         item => !item.attachmentId

+ 15 - 2
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -133,6 +133,9 @@
                 placeholder="请选择"
                 placeholder="请选择"
                 style="width: 200px"
                 style="width: 200px"
                 filterable
                 filterable
+                @visible-change="
+                  visible => cardOptionOpened(visible, attachment)
+                "
                 @change="cardChange(attachment)"
                 @change="cardChange(attachment)"
               >
               >
                 <el-option
                 <el-option
@@ -496,6 +499,16 @@ export default {
         attachment.cardTitle = card.title;
         attachment.cardTitle = card.title;
       }
       }
     },
     },
+    cardOptionOpened(visible, attachment) {
+      if (!visible) return;
+
+      const selectedCardIds = this.paperAttachments.map(item => item.cardId);
+      this.cards = this.cards.map(card => {
+        card.disabled =
+          card.id !== attachment.cardId && selectedCardIds.includes(card.id);
+        return card;
+      });
+    },
     toCreateCard(attachment) {
     toCreateCard(attachment) {
       if (!this.examTask.cardRuleId) {
       if (!this.examTask.cardRuleId) {
         this.$message.error("题卡规则缺失!");
         this.$message.error("题卡规则缺失!");
@@ -508,8 +521,8 @@ export default {
         schoolName: this.$ls.get("schoolName"),
         schoolName: this.$ls.get("schoolName"),
         makeMethod: "SELF",
         makeMethod: "SELF",
         cardRuleId: this.examTask.cardRuleId,
         cardRuleId: this.examTask.cardRuleId,
-        type: attachment.cardType,
-        createMethod: attachment.createMethod
+        type: "CUSTOM",
+        createMethod: "STANDARD"
       });
       });
       this.$refs.ModifyCard.open();
       this.$refs.ModifyCard.open();
     },
     },