Ver Fonte

修改学校查重

zs há 10 meses atrás
pai
commit
f035d598d9

+ 2 - 2
src/views/new-plan/arrange/school-arrange.vue

@@ -143,7 +143,7 @@ export default {
     ...util({ modelFetch: 'fetch' }),
     ...student({ getSchoolStudent: 'schoolStudent' }),
     ...trainPlan({ getTrainPlan: 'fetch', exportPlan: 'exportSchoolPlan' }),
-    ...school(['query']),
+    ...school(['query', 'findSchool']),
     ...schPlan({ schPlanQuery: 'query', createSchPlan: 'create', updateSchPlan: 'update', setSchPlan: 'schArrange' }),
     ...classtype({ getClassType: 'query' }),
     handleClose(done) {
@@ -155,7 +155,7 @@ export default {
     },
     //请求,处理学校列表
     async getSchool() {
-      const res = await this.query();
+      const res = await this.findSchool();
       if (this.$checkRes(res)) {
         let nd = res.data.map(i => (i = _.omit(i, ['meta', 'id', '_id', 'logourl', 'number'])));
         nd = this.setSchoolNumber(nd);

+ 9 - 5
src/views/new-plan/arrange/school-num.vue

@@ -82,7 +82,7 @@ export default {
   },
   methods: {
     ...plan({ getPlan: 'fetch', updatePlan: 'update' }),
-    ...school(['query']),
+    ...school(['query', 'findSchool']),
     ...util({ modelFetch: 'fetch' }),
     ...classtype({ getClassType: 'query' }),
     async trainTemplage() {
@@ -106,7 +106,7 @@ export default {
       this.planAlready = true;
     },
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      let res = await this.query({ ...info });
+      let res = await this.findSchool({ ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.schoolAlready = true;
@@ -172,9 +172,13 @@ export default {
         let name = _.get(this.form, 'name');
         let code = _.get(this.form, 'code');
         if (!name && !code) return true;
-        else if (name && !code) return f.name.includes(name);
-        else if (!name && code) return f.code.includes(code);
-        else return f.name.includes(name) && f.code.includes(code);
+        else if (name && !code) {
+          if (f.name) return f.name.includes(name);
+        } else if (!name && code) {
+          if (f.code) return f.code.includes(code);
+        } else {
+          if (f.name && f.code) return f.name.includes(name) && f.code.includes(code);
+        }
       });
       return res;
     },

+ 1 - 1
src/views/new-plan/arrange/school-time.vue

@@ -84,7 +84,7 @@ export default {
     this.search();
   },
   methods: {
-    ...school({ getSchool: 'query' }),
+    ...school({ getSchool: 'findSchool' }),
     ...trainplan(['query', 'create', 'delete', 'update']),
     ...schPlan({ schPlanQuery: 'query', createSchPlan: 'create', updateSchPlan: 'update' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {

+ 1 - 1
src/views/new-plan/class/lesson/lesson-table.vue

@@ -115,7 +115,7 @@ export default {
     ...lesson(['query', 'create', 'update']),
     ...subject({ getSubject: 'query' }),
     ...teacher({ getTeacher: 'query' }),
-    ...school({ getSchool: 'query' }),
+    ...school({ getSchool: 'findSchool' }),
     async search() {
       let res = await this.fetch({ model: 'lesson', classid: _.get(this.classInfo, '_id') });
       if (this.$checkRes(res)) {

+ 1 - 1
src/views/teacher/detail.vue

@@ -160,7 +160,7 @@ export default {
   methods: {
     ...teacher(['fetch', 'create', 'update']),
     ...subject({ getSubjectList: 'query' }),
-    ...school({ getSchoolList: 'query' }),
+    ...school({ getSchoolList: 'findSchool' }),
     async search() {
       const res = await this.fetch(this.id);
       if (this.$checkRes(res)) this.$set(this, `info`, res.data);

+ 1 - 1
src/views/train-plan/parts/class-table.vue

@@ -150,7 +150,7 @@ export default {
     ...lesson(['query', 'create', 'update']),
     ...subject({ getSubject: 'query' }),
     ...teacher({ getTeacher: 'query', lessonteafetch: 'lessonteafetch' }),
-    ...school({ getSchool: 'query' }),
+    ...school({ getSchool: 'findSchool' }),
     async search() {
       await this.getNoticeList();
       let res = await this.fetch({ model: 'lesson', classid: _.get(this.classInfo, '_id') });

+ 1 - 1
src/views/train-plan/term-lesson.vue

@@ -133,7 +133,7 @@ export default {
     ...ct({ getCt: 'query' }),
     ...subject({ getSubject: 'query' }),
     ...director({ getDirector: 'fetch', getDirectorList: 'query' }),
-    ...school({ getSchool: 'query' }),
+    ...school({ getSchool: 'findSchool' }),
     ...location({ getLocationList: 'query' }),
     ...teacher({ getTeacherList: 'query', getTeacher: 'fetch', getTeachers: 'lessonteafetch' }),
     ...dirPlan({ dirQuery: 'getDirTeacher' }),