lrf402788946 4 лет назад
Родитель
Сommit
4c323a2d9e
2 измененных файлов с 28 добавлено и 1 удалено
  1. 2 0
      src/store/index.js
  2. 26 1
      src/views/plan/index.vue

+ 2 - 0
src/store/index.js

@@ -26,6 +26,7 @@ import group from '@frame/store/group';
 import gensign from '@frame/store/gensign';
 import personalscore from '@frame/store/personalscore';
 import groupscore from '@frame/store/groupscore';
+import classtype from '@frame/store/classtype';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 import * as dostate from '@frame/store/setting/state';
@@ -65,5 +66,6 @@ export default new Vuex.Store({
     groupscore,
     gensign,
     nation,
+    classtype,
   },
 });

+ 26 - 1
src/views/plan/index.vue

@@ -64,6 +64,7 @@ const { mapActions } = createNamespacedHelpers('trainplan');
 const { mapActions: teaplan } = createNamespacedHelpers('teaplan');
 const { mapActions: teacher } = createNamespacedHelpers('teacher');
 const { mapActions: subject } = createNamespacedHelpers('subject');
+const { mapActions: classtype } = createNamespacedHelpers('classtype');
 
 export default {
   metaInfo: { title: '计划一览' },
@@ -92,6 +93,7 @@ export default {
       ],
       fields: [
         { label: '期', prop: 'term' },
+        { label: '班级类型', prop: 'classtype' },
         { label: '科目', prop: 'subname' },
         { label: '日期', prop: 'day' },
         { label: '时间', prop: 'time', custom: true },
@@ -100,14 +102,17 @@ export default {
       subjectList: [],
       applyList: [],
       needConfirm: true,
+      classTypeList: [],
     };
   },
   async created() {
     this.getSubject();
+    this.getCTList();
     await this.getTeacherInfo();
     this.search();
   },
   methods: {
+    ...classtype({ getClassTypeList: 'query' }),
     ...subject({ getSubjectList: 'query' }),
     ...teacher({ getTeacher: 'fetch' }),
     ...mapActions(['query', 'delete', 'fetch']),
@@ -127,7 +132,19 @@ export default {
           .map(t => {
             let { term, _id: termid } = t;
             let obj = { term, termid };
-            let lessons = t.batchnum.map(b => b.lessons.map(l => ({ ...l, ...obj })));
+            let lessons = t.batchnum.map(b => {
+              let classtype = '';
+              if (b.class && b.class.length > 0) {
+                const head = _.head(b.class);
+                // 该批次班级类型,也就是这些课程对应的班级类型
+                const { type } = head;
+                const ctres = this.classTypeList.find(f => f.code == type);
+                if (ctres) classtype = ctres.name;
+              }
+              b.lessons = b.lessons.map(l => ({ ...l, ...obj, classtype }));
+
+              return b.lessons;
+            });
             return lessons.flat();
           })
           .flat();
@@ -206,6 +223,14 @@ export default {
       });
       return list;
     },
+
+    //查找班级类型
+    async getCTList() {
+      const res = await this.getClassTypeList();
+      if (this.$checkRes(res)) {
+        this.$set(this, `classTypeList`, res.data);
+      }
+    },
   },
   computed: {
     ...mapState(['user', 'defaultOption']),