lrf402788946 5 gadi atpakaļ
vecāks
revīzija
574ca41bda
2 mainītis faili ar 18 papildinājumiem un 6 dzēšanām
  1. 1 3
      src/views/plan/classes.vue
  2. 17 3
      src/views/plan/lesson.vue

+ 1 - 3
src/views/plan/classes.vue

@@ -176,13 +176,11 @@ export default {
     async toSetClass() {
       // 整理数据生成班级;将学生列表重新查询=>为了将已经有班级的学生剔除,以便继续分班(重新查询)
       let info = JSON.parse(JSON.stringify(_.omit(this.selectInfo, ['male', 'female', 'personReq'])));
-      console.log(info);
       let stuList = JSON.parse(JSON.stringify(this.selected));
-      console.log(stuList);
       // if (this.isOutRange(stuList)) return;
       info.students = stuList;
       let res = await this.createClass(info);
-      this.$checkRes(res, '分班成功', '分班失败');
+      if (this.$checkRes(res, '分班成功', '分班失败')) this.$router.push({ path: '/plan/index' });
       //重置信息
       // this.selectInfo = {
       //   male: 0,

+ 17 - 3
src/views/plan/lesson.vue

@@ -16,7 +16,7 @@
             <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
           </template>
         </template>
-        <data-table ref="table" :fields="fields" :data="list" :opera="opera" @date="toDate" @msg="toMsg"></data-table>
+        <data-table ref="table" :fields="fields" :data="list" :opera="opera" @date="toDate" @msg="toMsg" @bedroom="toBedroom"></data-table>
       </list-frame>
       <detail-frame v-else title="返回批次列表" :returns="returnList">
         <lesson-plan
@@ -42,6 +42,7 @@ import { createNamespacedHelpers } from 'vuex';
 const { mapActions: trainPlan } = createNamespacedHelpers('trainplan');
 const { mapActions: mapClasses } = createNamespacedHelpers('classes');
 const { mapActions: lesson } = createNamespacedHelpers('lesson'); //教师申请
+const { mapActions: bedroom } = createNamespacedHelpers('bedroom'); //分寝
 
 //教师表,地点表,课程表
 export default {
@@ -59,6 +60,11 @@ export default {
         icon: 'el-icon-date',
         method: 'date',
       },
+      {
+        label: '一键分寝',
+        icon: 'el-icon-s-home',
+        method: 'bedroom',
+      },
       {
         label: '发送确认通知',
         icon: 'el-icon-message-solid',
@@ -83,6 +89,7 @@ export default {
     ...trainPlan({ getTrainPlan: 'fetch', sendNotice: 'notice' }),
     ...mapClasses({ getClass: 'query', updateClass: 'update' }),
     ...lesson({ getLessonList: 'query', lessonCreate: 'create', lessonUpdate: 'update' }),
+    ...bedroom({ bedroomApart: 'apart' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.getTrainPlan(this.id);
       if (this.$checkRes(res)) {
@@ -106,7 +113,8 @@ export default {
       if (this.$checkRes(res)) {
         let cArr = [];
         for (const tClass of res.data) {
-          let lesson = await this.getLessonList({ class: tClass.id });
+          let lesson = await this.getLessonList({ classid: tClass.id });
+          console.log(lesson);
           if (this.$checkRes(lesson)) {
             //根据classid查出的课表一定是唯一的,但是需要用query方法查出,所以如果有值只取出第一条,之后修改这条数据
             let { name, lyteacherid, yclocationid, kzjhlocationid, kbyslocationid, headteacherid, jslocationid } = tClass;
@@ -136,7 +144,7 @@ export default {
       //此处需要3个接口:1,课表添加;2,课表修改;3,班级修改
       //根据data中是否有id,判断是课表的添加还是修改
       //解构出data中class字段,是班级id,将各种地点,礼仪课老师,班主任修改好
-      let classid = data.class;
+      let classid = data.classid;
       let { lessons, termid, batchid, headteacherid, jslocationid, yclocationid, kzjhlocationid, kbyslocationid, lyteacherid } = data;
       let newLessons = { lessons, termid, batchid, classid };
       let newClass = { id: classid, headteacherid, jslocationid, yclocationid, kzjhlocationid, kbyslocationid, lyteacherid };
@@ -158,6 +166,7 @@ export default {
         }
       };
       if (check(res, null, `课表${lid ? '修改' : '添加'}失败`)) {
+        newClass.lessonid = res.data._id;
         res = await this.updateClass(newClass);
         check(res, '班级信息修改成功', '班级信息修改失败');
       }
@@ -172,6 +181,11 @@ export default {
         } else this.$message.warning(`该批次下未分班`);
       }
     },
+    async toBedroom({ data }) {
+      let object = { termid: this.term, trainplanid: this.id, batchid: data._id };
+      let res = await this.bedroomApart(object);
+      this.$checkRes(res, '分寝成功', res.errmsg);
+    },
   },
   computed: {
     mainTitle() {