|
@@ -7,10 +7,20 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</detail-frame>
|
|
|
- <el-drawer title="课程安排" :visible.sync="lDrawer">
|
|
|
- <lesson-form :data="form"></lesson-form>
|
|
|
+ <el-drawer title="课程安排" :visible.sync="lDrawer" :destroy-on-close="true" @close="toClose">
|
|
|
+ <lesson-form v-if="lDrawer" v-loading="dloading" :data="form" :subjectList="subjectList" :schoolList="schoolList" @save="lessonSave"></lesson-form>
|
|
|
+ </el-drawer>
|
|
|
+ <el-drawer title="其他安排" :visible.sync="oDrawer" :destroy-on-close="true" @close="toClose">
|
|
|
+ <class-form
|
|
|
+ v-if="oDrawer"
|
|
|
+ :data="form"
|
|
|
+ :locationList="locationList"
|
|
|
+ :headTeacherList="headTeacherList"
|
|
|
+ :lyTeacherList="lyTeacherList"
|
|
|
+ v-loading="dloading"
|
|
|
+ @save="lessonSave"
|
|
|
+ ></class-form>
|
|
|
</el-drawer>
|
|
|
- <el-drawer title="其他安排" :visible.sync="oDrawer"></el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -21,6 +31,7 @@ const moment = require('moment');
|
|
|
moment.locale('zh-cn');
|
|
|
import lessonTable from './parts/term-lesson-table';
|
|
|
import lessonForm from './parts/term-lesson-form';
|
|
|
+import classForm from './parts/term-class-from';
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
@@ -33,13 +44,16 @@ const { mapActions: dirPlan } = createNamespacedHelpers('dirPlan'); //班主任
|
|
|
const { mapActions: teaplan } = createNamespacedHelpers('teaPlan');
|
|
|
const { mapActions: mapDept } = createNamespacedHelpers('dept');
|
|
|
const { mapActions: director } = createNamespacedHelpers('director');
|
|
|
+const { mapActions: school } = createNamespacedHelpers('school'); //给选老师组件使用.这个页面请求完就不销毁了
|
|
|
+const { mapActions: subject } = createNamespacedHelpers('subject');
|
|
|
export default {
|
|
|
name: 'term-lesson',
|
|
|
props: {},
|
|
|
- components: { detailFrame, lessonTable, lessonForm },
|
|
|
+ components: { detailFrame, lessonTable, lessonForm, classForm },
|
|
|
data: function() {
|
|
|
return {
|
|
|
loading: true,
|
|
|
+ dloading: false,
|
|
|
lDrawer: false,
|
|
|
oDrawer: false,
|
|
|
form: {},
|
|
@@ -52,6 +66,8 @@ export default {
|
|
|
lyTeacherList: [],
|
|
|
deptList: [],
|
|
|
headTeacherList: [],
|
|
|
+ schoolList: [],
|
|
|
+ subjectList: [],
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -61,7 +77,9 @@ export default {
|
|
|
...lesson({ getLesson: 'query' }),
|
|
|
...classes({ getClass: 'query' }),
|
|
|
|
|
|
+ ...subject({ getSubject: 'query' }),
|
|
|
...director({ getDirector: 'fetch' }),
|
|
|
+ ...school({ getSchool: 'query' }),
|
|
|
...location({ getLocationList: 'query' }),
|
|
|
...teacher({ getTeacherList: 'query', getTeacher: 'fetch' }),
|
|
|
...dirPlan({ dirQuery: 'getDirTeacher' }),
|
|
@@ -244,38 +262,24 @@ export default {
|
|
|
if (this.lyTeacherList.length <= 0) {
|
|
|
arr.push(this.getTeacherList({ islyteacher: '1', status: '4' }));
|
|
|
}
|
|
|
+ if (this.schoolList.length <= 0) {
|
|
|
+ arr.push(this.getSchool());
|
|
|
+ }
|
|
|
if (this.deptList.length <= 0) {
|
|
|
arr.push(this.getDept());
|
|
|
}
|
|
|
+ if (this.subjectList.length <= 0) {
|
|
|
+ arr.push(this.getSubject());
|
|
|
+ }
|
|
|
axios.all(arr).then(
|
|
|
- axios.spread((r1, r2, r3) => {
|
|
|
+ axios.spread((r1, r2, r3, r4, r5) => {
|
|
|
if (r1) this.$set(this, `locationList`, r1.data);
|
|
|
if (r2) this.$set(this, `lyTeacherList`, r2.data);
|
|
|
- if (r3) this.$set(this, `deptList`, r3.data);
|
|
|
+ if (r3) this.$set(this, `schoolList`, r3.data);
|
|
|
+ if (r4) this.$set(this, `deptList`, r4.data);
|
|
|
+ if (r5) this.$set(this, `subjectList`, r5.data);
|
|
|
})
|
|
|
);
|
|
|
- // if (this.headTeacherList.length <= 0) {
|
|
|
- // res = await this.findTeacher({ planid: data.planid, termid: data.termid, batchid: data.batchid });
|
|
|
- // let duplicate = _.cloneDeep(res.data);
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- // //班主任按部门分组
|
|
|
- // let group = _.groupBy(res.data, 'department');
|
|
|
- // let keys = Object.keys(group);
|
|
|
- // let arr = keys.map(key => {
|
|
|
- // let r = this.deptList.find(f => f.id == key);
|
|
|
- // let obj = {};
|
|
|
- // if (r) {
|
|
|
- // obj.name = r.name;
|
|
|
- // obj.list = group[key];
|
|
|
- // }
|
|
|
- // return obj;
|
|
|
- // });
|
|
|
- // this.$set(this, `headTeacherList`, arr);
|
|
|
- // //班主任筛选可以当礼仪老师列表,和 礼仪教师列表合并
|
|
|
- // duplicate = duplicate.filter(f => f.islyteacher == '1');
|
|
|
- // this.$set(this, `lyTeacherList`, [...this.lyTeacherList, ...duplicate]);
|
|
|
- // }
|
|
|
- // }
|
|
|
},
|
|
|
//初始化,将每个班级的班主任,礼仪课老师,教室id=>名称
|
|
|
async searchClassPerson(obj) {
|
|
@@ -302,15 +306,67 @@ export default {
|
|
|
// }
|
|
|
},
|
|
|
toLesson(data) {
|
|
|
- console.log(`in lesson`);
|
|
|
+ let { is_last, batch } = data;
|
|
|
+ if (is_last) {
|
|
|
+ let last = _.last(this.list[batch - 1]);
|
|
|
+ let { date } = last;
|
|
|
+ data.allday = date;
|
|
|
+ }
|
|
|
this.$set(this, `form`, data);
|
|
|
this.lDrawer = true;
|
|
|
},
|
|
|
- toOther(data) {
|
|
|
- console.log(`in other`);
|
|
|
- console.log(data);
|
|
|
- this.$set(this, `form`, data);
|
|
|
+ async toOther(data) {
|
|
|
this.oDrawer = true;
|
|
|
+ this.dloading = true;
|
|
|
+ let { type } = data;
|
|
|
+ if (type != 'jslocation') await this.getHeadTeacher(data);
|
|
|
+ this.$set(this, `form`, data);
|
|
|
+ this.dloading = false;
|
|
|
+ },
|
|
|
+ lessonSave(data) {
|
|
|
+ let { index, batch, is_last, allday, ...info } = data;
|
|
|
+ if (is_last) {
|
|
|
+ //TODO 改变半天/全天
|
|
|
+ this.$set(this.list[batch - 1], this.list[batch - 1].length - 1, { date: allday, type: 'allday' });
|
|
|
+ }
|
|
|
+ this.$set(this.list[batch - 1], index, { batch, ...info });
|
|
|
+ this.toClose();
|
|
|
+ },
|
|
|
+ toClose() {
|
|
|
+ this.lDrawer = false;
|
|
|
+ this.oDrawer = false;
|
|
|
+ this.form = {};
|
|
|
+ },
|
|
|
+ async getHeadTeacher(data) {
|
|
|
+ let batchid;
|
|
|
+ let { type } = data;
|
|
|
+ let { planid, termid } = this.options;
|
|
|
+ let keys = Object.keys(data).filter(f => f.includes('classid'));
|
|
|
+ if (keys.length <= 0) return;
|
|
|
+ let cla = this.classList.find(f => f._id == data[keys[0]]);
|
|
|
+ if (!cla) return;
|
|
|
+ batchid = cla.batchid;
|
|
|
+ let res = await this.findTeacher({ planid, termid, batchid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let duplicate = _.cloneDeep(res.data);
|
|
|
+ if (type == 'headteacher') {
|
|
|
+ let group = _.groupBy(res.data, 'department');
|
|
|
+ let keys = Object.keys(group);
|
|
|
+ let arr = keys.map(key => {
|
|
|
+ let r = this.deptList.find(f => f.id == key);
|
|
|
+ let obj = {};
|
|
|
+ if (r) {
|
|
|
+ obj.name = r.name;
|
|
|
+ obj.list = group[key];
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
+ });
|
|
|
+ this.$set(this, `headTeacherList`, arr);
|
|
|
+ } else if (type == 'lyteacher') {
|
|
|
+ duplicate = duplicate.filter(f => f.islyteacher == '1');
|
|
|
+ this.$set(this, `lyTeacherList`, _.uniqBy([...this.lyTeacherList, ...duplicate], '_id'));
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
watch: {
|