WANG 6 лет назад
Родитель
Сommit
80548684b3
1 измененных файлов с 20 добавлено и 32 удалено
  1. 20 32
      src/modules/examwork/view/examStudent.vue

+ 20 - 32
src/modules/examwork/view/examStudent.vue

@@ -1134,18 +1134,13 @@ export default {
       this.getOrgList(orgName, "insertOrUpdate");
     },
     getOrgList(orgName, where) {
-      if (Object.prototype.toString.call(orgName) != "[object String]") {
-        return;
-      }
-      orgName = orgName.split(" - ")[0];
       if ("search" == where) {
         this.getOrgList4SearchLoading = true;
       } else if ("insertOrUpdate" == where) {
         this.getOrgList4InsertOrUpdateLoading = true;
       }
 
-      var url =
-        CORE_API + "/org/query?" + new URLSearchParams({ name: orgName });
+      let url = CORE_API + "/org/query?name=" + orgName;
       this.$httpWithMsg
         .get(url)
         .then(response => {
@@ -1253,32 +1248,22 @@ export default {
         });
     },
     getCourses4Search(query) {
-      query = query.split(" - ")[0];
-      if (query) {
-        this.courseLoading4Search = true;
-        this.$httpWithMsg
-          .get(CORE_API + "/course/query?name=" + query)
-          .then(response => {
-            this.courseList4Search = response.data;
-            this.courseLoading4Search = false;
-          });
-      } else {
-        this.courseList4Search = [];
-      }
+      this.courseLoading4Search = true;
+      this.$httpWithMsg
+        .get(CORE_API + "/course/query?name=" + query)
+        .then(response => {
+          this.courseList4Search = response.data;
+          this.courseLoading4Search = false;
+        });
     },
     getCourses4InsertOrUpdate(query) {
-      query = query.split(" - ")[0];
-      if (query) {
-        this.courseLoading4InsertOrUpdate = true;
-        this.$httpWithMsg
-          .get(CORE_API + "/course/query?name=" + query)
-          .then(response => {
-            this.courseList4InsertOrUpdate = response.data;
-            this.courseLoading4InsertOrUpdate = false;
-          });
-      } else {
-        this.courseList4InsertOrUpdate = [];
-      }
+      this.courseLoading4InsertOrUpdate = true;
+      this.$httpWithMsg
+        .get(CORE_API + "/course/query?name=" + query)
+        .then(response => {
+          this.courseList4InsertOrUpdate = response.data;
+          this.courseLoading4InsertOrUpdate = false;
+        });
     },
     //新增信息
     addStudent() {
@@ -1437,11 +1422,13 @@ export default {
       } else {
         this.examStudentForm.orgId = null;
         this.orgList4InsertOrUpdate = null;
+        this.getOrgList4InsertOrUpdate("");
       }
       this.examList4InsertOrUpdate = [];
       this.courseList4InsertOrUpdate = [];
 
       this.queryExams4InsertOrUpdate("");
+      this.getCourses4InsertOrUpdate("");
       this.addingStudentDialog = true;
     },
     //修改
@@ -1703,6 +1690,9 @@ export default {
         this.pureLC = false;
       }
 
+      this.getCourses4Search("");
+      this.getOrgList4Search("");
+      this.queryExams4Search("");
       this.formSearch.rootOrgId = this.user.rootOrgId;
       if (this.pureLC) {
         var url = CORE_API + "/user/" + this.user.userId;
@@ -1719,11 +1709,9 @@ export default {
           ];
           this.formSearch.orgId = this.lc_id;
           this.examStudentForm.orgId = this.lc_id;
-          this.queryExams4Search("");
           this.searchForm();
         });
       } else {
-        this.queryExams4Search("");
         this.searchForm();
       }
     }