guhongwei 4 سال پیش
والد
کامیت
40697b7d8b
1فایلهای تغییر یافته به همراه42 افزوده شده و 7 حذف شده
  1. 42 7
      src/views/new-plan/arrange/director-arrange.vue

+ 42 - 7
src/views/new-plan/arrange/director-arrange.vue

@@ -43,6 +43,7 @@ import dataTable from '@frame/components/data-table';
 import dataForm from '@frame/components/form';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('teaPlan');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: mapDept } = createNamespacedHelpers('dept');
 const { mapActions: director } = createNamespacedHelpers('director');
@@ -71,8 +72,9 @@ export default {
   methods: {
     ...director({ getDirList: 'query' }),
     ...mapDept({ getDept: 'query', getDeptFetch: 'fetch' }),
-    ...mapActions(['divide', 'findTeacher']),
+    ...mapActions(['divide', 'findTeacher', 'fetch']),
     ...classes(['query', 'upHeadTea']),
+    ...trainplan({ trainplanFetch: 'fetch' }),
     // 查询部门加班主任
     async getOtherList() {
       let res = await this.getDept();
@@ -82,9 +84,27 @@ export default {
     },
     async search() {
       let planid = _.get(this.defaultOption, 'planid');
-      if (!planid) return;
-      let res = await this.query({ planid });
-      if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      const res = await this.trainplanFetch(planid);
+      let data = res.data.termnum;
+      let newData = [];
+      for (const termnum of data) {
+        for (const batchnum of termnum.batchnum) {
+          for (const classes of batchnum.class) {
+            const termdata = {
+              term: termnum.term,
+              startdate: batchnum.startdate,
+              enddate: batchnum.enddate,
+              classid: classes._id,
+              name: classes.name,
+              rightHeader: classes.rightHeader,
+            };
+            newData.push(termdata);
+          }
+        }
+      }
+      // let newOder = _.orderBy(newData, ['startdate'], ['asc']);
+      // this.$set(this, `list`, newOder);
+      this.$set(this, `list`, newData);
     },
     // 筛选教师
     dirData(id, row) {
@@ -107,11 +127,26 @@ export default {
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       // console.log(row, column, rowIndex, columnIndex);
       let prop = _.get(column, 'property');
-      if (prop === 'term' || prop === 'term7') {
+      if (prop === 'term') {
+        let data = _.flatten(_.toPairs(_.groupBy(this.list, 'term'))).filter(_.isArray);
+        let num = data.find(i => i.every(e => e.term === row.term));
+        let rowi = num.findIndex(i => i.startdate == row.startdate);
+        // if (rowi === 0) {
+        //   return {
+        //     rowspan: num.length,
+        //     colspan: 1,
+        //   };
+        // } else {
+        //   return {
+        //     rowspan: 0,
+        //     colspan: 0,
+        //   };
+        // }
+      } else if (prop === 'term7') {
         let data = _.flatten(_.toPairs(_.groupBy(this.list, 'term'))).filter(_.isArray);
         let num = data.find(i => i.every(e => e.term === row.term));
-        let newOder = _.orderBy(num, ['startdate'], ['asc']);
-        let rowi = newOder.findIndex(i => i.startdate == row.startdate);
+        // let newOder = _.orderBy(num, ['startdate'], ['asc']);
+        let rowi = num.findIndex(i => i.startdate == row.startdate);
         if (rowi === 0) {
           return {
             rowspan: num.length,