Jelajahi Sumber

feat: 命题任务答题卡删除

zhangjie 11 bulan lalu
induk
melakukan
3ad07dc369

+ 31 - 14
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -223,19 +223,30 @@
                   :label="item.title"
                   :disabled="item.disabled"
                 >
-                  <span
-                    :class="[
-                      item.type === 'GENERIC'
-                        ? 'color-success'
-                        : 'color-primary',
-                      'mr-1',
-                      {
-                        'color-danger': item.used,
-                      },
-                    ]"
-                    >[{{ item.type === "GENERIC" ? "通" : "专" }}]</span
-                  >
-                  {{ item.title }}
+                  <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
@@ -811,11 +822,17 @@ export default {
 
       await deleteCard(card.id);
       this.$message.success("删除成功!");
-      attachment.cards = attachment.cards.filter((item) => item.id !== card.id);
       if (attachment.cardId === card.id) {
         attachment.cardId = null;
         attachment.cardTitle = "";
       }
+      if (this.IS_TIKU_TAB) {
+        attachment.cards = attachment.cards.filter(
+          (item) => item.id !== card.id
+        );
+      } else {
+        await this.getCardList();
+      }
     },
     async checkData() {
       const valid = await this.$refs.examTaskComp.validate().catch(() => {});

+ 32 - 14
src/modules/exam/components/taskApply/TaskPaper.vue

@@ -198,19 +198,30 @@
                   :label="item.title"
                   :disabled="item.disabled"
                 >
-                  <span
-                    :class="[
-                      item.type === 'GENERIC'
-                        ? 'color-success'
-                        : 'color-primary',
-                      'mr-1',
-                      {
-                        'color-danger': item.used,
-                      },
-                    ]"
-                    >[{{ item.type === "GENERIC" ? "通" : "专" }}]</span
-                  >
-                  {{ item.title }}
+                  <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
@@ -729,11 +740,18 @@ export default {
 
       await deleteCard(card.id);
       this.$message.success("删除成功!");
-      attachment.cards = attachment.cards.filter((item) => item.id !== card.id);
       if (attachment.cardId === card.id) {
         attachment.cardId = null;
         attachment.cardTitle = "";
       }
+
+      if (this.IS_TIKU_TAB) {
+        attachment.cards = attachment.cards.filter(
+          (item) => item.id !== card.id
+        );
+      } else {
+        await this.getCardList();
+      }
     },
     async toCreateCard(attachment) {
       if (!this.examTask.cardRuleId) {