Selaa lähdekoodia

复制考试按钮放在外面

xiatian 5 vuotta sitten
vanhempi
commit
76e73898fd
1 muutettua tiedostoa jossa 27 lisäystä ja 8 poistoa
  1. 27 8
      src/modules/examwork/view/examInfo.vue

+ 27 - 8
src/modules/examwork/view/examInfo.vue

@@ -49,6 +49,13 @@
               @click="addExamInfoDialog"
               >新增
             </el-button>
+            <el-button
+              size="mini"
+              type="primary"
+              icon="el-icon-document"
+              @click="toCopyExam()"
+              >复制</el-button
+            >
           </el-form-item>
         </el-form>
 
@@ -198,14 +205,7 @@
                       >
                         学习中心设置
                       </el-button>
-                      <el-button
-                        size="mini"
-                        type="primary"
-                        icon="el-icon-edit"
-                        @click="showCopyExam(scope.row)"
-                        >复制</el-button
-                      ></el-dropdown-item
-                    >
+                    </el-dropdown-item>
                   </el-dropdown-menu></el-dropdown
                 >
               </div>
@@ -350,6 +350,25 @@ export default {
   },
 
   methods: {
+    toCopyExam() {
+      if (this.selectedExamIds.length == 0) {
+        this.$notify({
+          type: "warning",
+          message: "请勾选一个考试"
+        });
+        return;
+      }
+      if (this.selectedExamIds.length > 1) {
+        this.$notify({
+          type: "warning",
+          message: "只能勾选一个考试"
+        });
+        return;
+      }
+      this.showCopyExam(
+        this.tableData.filter(v => v.id === this.selectedExamIds[0])[0]
+      );
+    },
     showCopyExam(row) {
       this.examCopyTitle = "复制考试:" + row.name;
       this.examCopyForm.srcExamId = row.id;