xiatian 2 vuotta sitten
vanhempi
commit
e28e520cc2

+ 13 - 0
src/modules/card/views/CardManage.vue

@@ -11,6 +11,9 @@
         <el-form-item label="课程">
           <el-select
             v-model="searchForm.courseId"
+            :remote-method="getCourses4Search"
+            :loading="courseLoading4Search"
+            remote
             filterable
             clearable
             placeholder="请选择"
@@ -241,6 +244,7 @@ export default {
   components: { ImportFileDialog, ModifyCard, ProgressDialog },
   data() {
     return {
+      courseLoading4Search: false,
       loading: false,
       courseList: [],
       searchForm: {
@@ -290,6 +294,15 @@ export default {
     delete window.emitResult;
   },
   methods: {
+    getCourses4Search(query) {
+      this.courseLoading4Search = true;
+      this.$httpWithMsg
+        .get(QUESTION_API + "/course/query?name=" + query)
+        .then((response) => {
+          this.courseList = response.data;
+          this.courseLoading4Search = false;
+        });
+    },
     async getCoursesList() {
       const res = await courseQueryApi();
       this.courseList = res.data || [];

+ 10 - 4
src/modules/questions/views/CourseProperty.vue

@@ -13,6 +13,9 @@
         <el-form-item label="课程名称">
           <el-select
             v-model="formSearch.courseId"
+            :remote-method="getCourses"
+            :loading="courseLoading4Search"
+            remote
             filterable
             clearable
             placeholder="请选择"
@@ -299,6 +302,7 @@ import { mapState } from "vuex";
 export default {
   data() {
     return {
+      courseLoading4Search: false,
       formSearch: {
         name: "",
         courseId: "",
@@ -374,7 +378,7 @@ export default {
       key: this.user.key,
       token: this.user.token,
     };
-    this.getCourses();
+    this.getCourses("");
   },
 
   methods: {
@@ -667,11 +671,13 @@ export default {
       });
     },
     //查询所有课程
-    getCourses() {
-      this.$http
-        .get(QUESTION_API + "/course/query?name=&enable=true")
+    getCourses(query) {
+      this.courseLoading4Search = true;
+      this.$httpWithMsg
+        .get(QUESTION_API + "/course/query?name=" + query)
         .then((response) => {
           this.courseList = response.data;
+          this.courseLoading4Search = false;
         });
     },
     removeItem() {