瀏覽代碼

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-center

guhongwei 4 年之前
父節點
當前提交
a7ea4d85a7

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

@@ -363,6 +363,8 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `subjectList`, res.data);
       // res = await this.getTeacher({ status: '4' });
       // if (this.$checkRes(res)) this.$set(this, `teacherList`, res.data);
+      res = await this.fetch({ model: 'notice', classid: this.classInfo.id, type: '4', planid: this.classInfo.planid, termid: this.classInfo.termid });
+      if (this.$checkRes(res)) this.$set(this, `noticeList`, res.data);
     },
     // 教师列表
     async seachTeacher() {
@@ -371,8 +373,6 @@ export default {
       var ids = NewArr.map(item => item.teaid);
       let res = await this.lessonteafetch(ids);
       if (this.$checkRes(res)) this.$set(this, `teacherList`, res.data);
-      res = await this.fetch({ model: 'notice', classid: this.classInfo.id, type: '4', planid: this.classInfo.planid, termid: this.classInfo.termid });
-      if (this.$checkRes(res)) this.$set(this, `noticeList`, res.data);
     },
     //关闭抽屉
     toClose() {
@@ -453,7 +453,7 @@ export default {
         const { notified } = this.noticeList;
         if (notified) {
           const r = notified.find(f => f.notifiedid == teaid);
-          if (!r) word = '未绑定微信';
+          if (!r) word = '未收到通知';
           else {
             word = r.status == '0' ? '未确认' : '已确认';
           }

+ 37 - 0
src/views/train-plan/parts/term-lesson-table.vue

@@ -26,6 +26,14 @@
             <el-col :span="24">
               {{ getProp(row, `name_${index + 1}`) }}
             </el-col>
+            <el-col :span="24" v-if="row.type != 'jslocation'">
+              {{ getTeacher(getProp(row, `id_${index + 1}`)) }}
+            </el-col>
+            <el-col :span="24" v-if="row.type != 'jslocation'">
+              <el-link :type="wordColor(getNoticeResult(getProp(row, `id_${index + 1}`), getProp(row, `classid_${index + 1}`)))">
+                {{ getNoticeResult(getProp(row, `id_${index + 1}`), getProp(row, `classid_${index + 1}`)) }}
+              </el-link>
+            </el-col>
           </el-row>
         </template>
       </el-table-column>
@@ -39,12 +47,15 @@ import _ from 'lodash';
 const moment = require('moment');
 // moment.locale('zh-cn');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
 export default {
   name: 'term-lesson-table',
   props: {
     type: { type: String },
     data: { type: Array, default: () => [] },
     batch: { type: [String, Array] },
+    noticeList: { type: Array, default: () => [] },
+    teacherList: { type: Array, default: () => [] },
   },
   components: {},
   data: function() {
@@ -52,6 +63,7 @@ export default {
   },
   created() {},
   methods: {
+    ...teacher(['fetch']),
     spanTable({ row, column, rowIndex, columnIndex }) {
       let { type } = row;
       let res = { rowspan: 1, colspan: 1 };
@@ -94,6 +106,31 @@ export default {
     getProp(data, prop) {
       return _.get(data, prop);
     },
+    getNoticeResult(data, classid) {
+      let word = '';
+      if (data) {
+        const res = this.noticeList.find(f => f.classid == classid);
+        if (!res) return;
+        const { notified } = res;
+        if (!notified) return;
+        const r = notified.find(f => f.notifiedid == data);
+        if (!r) word = '未收到通知';
+        else {
+          word = r.status == '0' ? '未确认' : '已确认';
+        }
+      }
+      return word;
+    },
+    wordColor(word) {
+      let type = 'danger';
+      if (word == '未确认') type = 'warning';
+      if (word == '已确认') type = 'success';
+      return type;
+    },
+    getTeacher(id) {
+      const res = this.teacherList.find(f => f._id == id);
+      if (res) return _.get(res, 'phone', _.get(res, 'mobile'));
+    },
   },
   filters: {
     getWeekDay(date) {

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

@@ -19,6 +19,7 @@
             :data="i"
             :batch="`${index + 1}`"
             :noticeList="noticeList"
+            :teacherList="inteaList"
             @lesson="toLesson"
             @other="toOther"
             @toOneClass="toOneClass"
@@ -32,6 +33,7 @@
             :data="i"
             :batch="`${index + 1}`"
             :noticeList="noticeList"
+            :teacherList="inteaList"
             @lesson="toLesson"
             @other="toOther"
             @toOneClass="toOneClass"
@@ -104,6 +106,8 @@ export default {
       subjectList: [],
       //该期通知列表
       noticeList: [],
+      //已经选择的教师列表
+      inteaList: [],
     };
   },
   async created() {
@@ -137,7 +141,7 @@ export default {
     ...director({ getDirector: 'fetch' }),
     ...school({ getSchool: 'query' }),
     ...location({ getLocationList: 'query' }),
-    ...teacher({ getTeacherList: 'query', getTeacher: 'fetch' }),
+    ...teacher({ getTeacherList: 'query', getTeacher: 'fetch', getTeachers: 'lessonteafetch' }),
     ...dirPlan({ dirQuery: 'getDirTeacher' }),
     ...mapDept({ getDept: 'query' }),
     ...teaplan(['findTeacher']),
@@ -176,6 +180,7 @@ export default {
       this.$set(this, `list`, usualRes);
       this.$set(this, `unusualList`, unusualRes);
       this.toGetNoticeList();
+      this.toGetTeachers();
       this.loading = false;
     },
     dealList(classList, lessonList) {
@@ -413,6 +418,7 @@ export default {
       if (this.formType == 'usual') this.$set(this.list[batch - 1], index, { batch, ...info });
       else this.$set(this.unusualList[batch - 1], index, { batch, ...info });
       this.toClose();
+      this.toGetTeachers();
     },
     toClose() {
       this.lDrawer = false;
@@ -707,6 +713,23 @@ export default {
       const res = await this.getNoticeList({ planid, termid, type: '4' });
       if (this.$checkRes(res)) this.$set(this, `noticeList`, res.data);
     },
+    async toGetTeachers() {
+      let list = this.list
+        .flat()
+        .filter(f => f.type === 'lesson')
+        .filter(f => {
+          let keys = Object.keys(f);
+          return keys.find(f => f.startsWith('id_'));
+        });
+      let arr = [];
+      list.map(i => {
+        let keys = Object.keys(i).filter(f => f.startsWith('id_'));
+        keys.map(k => arr.push(i[k]));
+      });
+      arr = _.compact(_.uniq(arr));
+      const res = await this.getTeachers(arr);
+      if (this.$checkRes(arr)) this.$set(this, `inteaList`, res.data);
+    },
   },
   computed: {
     ...mapState(['user', 'defaultOption']),