|
@@ -77,6 +77,24 @@ export default {
|
|
|
},
|
|
|
async created() {
|
|
|
await this.getSettingLists();
|
|
|
+ await this.search();
|
|
|
+ this.$watch(
|
|
|
+ 'defaultOption',
|
|
|
+ val => {
|
|
|
+ if (!_.get(this, 'options')) {
|
|
|
+ this.$set(this, `options`, _.cloneDeep(val));
|
|
|
+ this.search();
|
|
|
+ } else {
|
|
|
+ let ntermid = _.get(val, 'termid');
|
|
|
+ let otermid = _.get(this.options, 'termid');
|
|
|
+ if (ntermid && !_.isEqual(ntermid, otermid)) {
|
|
|
+ this.$set(this, `options`, _.cloneDeep(val));
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { deep: true }
|
|
|
+ );
|
|
|
},
|
|
|
methods: {
|
|
|
...lesson({ getLesson: 'query', plupdate: 'pluralUpdate' }),
|
|
@@ -336,6 +354,7 @@ export default {
|
|
|
this.$set(this, `form`, data);
|
|
|
this.dloading = false;
|
|
|
},
|
|
|
+ toDeleteDate() {},
|
|
|
lessonSave(data) {
|
|
|
let { index, batch, is_last, allday, ...info } = data;
|
|
|
if (is_last) {
|
|
@@ -387,7 +406,6 @@ export default {
|
|
|
let duplicate = _.cloneDeep(this.list);
|
|
|
let dClass = _.cloneDeep(this.classList);
|
|
|
let dLesson = _.cloneDeep(this.lessonList);
|
|
|
- let data = duplicate[0];
|
|
|
duplicate.map(data => {
|
|
|
// console.log(data);
|
|
|
let day = _.get(_.last(data), 'date', '全天');
|
|
@@ -507,9 +525,39 @@ export default {
|
|
|
dLesson[lesi].lessons = dres;
|
|
|
});
|
|
|
});
|
|
|
- dClass = dClass.map(i => _.omit(i, ['lessons']));
|
|
|
- dLesson = dLesson.map(i => _.omit(i, ['meta']));
|
|
|
- //最后数据 dClass,班级列表; dLesson 课程列表
|
|
|
+ let ndClass = dClass.map(i => _.omit(i, ['lessons']));
|
|
|
+ let ndLesson = dLesson.map(i => _.omit(i, ['meta']));
|
|
|
+ let res = this.checkClassConfig(dClass);
|
|
|
+ if (!res.length > 0) {
|
|
|
+ this.toSubmit(ndLesson, ndClass);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const h = this.$createElement;
|
|
|
+ //[h('p', null, '您没有选择1班的礼仪课教师'), h('p', null, '您没有选择2班的礼仪课教师')]
|
|
|
+ let arrs = [];
|
|
|
+ for (const item of res) {
|
|
|
+ let r;
|
|
|
+ r = h(
|
|
|
+ 'p',
|
|
|
+ null,
|
|
|
+ `${item.name}班:${item.headteacher ? '未选择班主任' : ''} ${item.lyteacher ? '未选择礼仪教师' : ''} ${item.jslocation ? '未选择教室' : ''}`
|
|
|
+ );
|
|
|
+ arrs.push(r);
|
|
|
+ }
|
|
|
+ this.$confirm(h('div', null, arrs), '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.toSubmit(ndLesson, ndClass);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ // console.log(dLesson);
|
|
|
+ },
|
|
|
+ //提交接口请求
|
|
|
+ async toSubmit(dLesson, dClass) {
|
|
|
+ // 最后数据 dClass,班级列表; dLesson 课程列表
|
|
|
let axiosArr = [];
|
|
|
axiosArr.push(this.plupdate(dLesson));
|
|
|
axiosArr.push(this.pcupdate(dClass));
|
|
@@ -545,24 +593,19 @@ export default {
|
|
|
classes = classes.map(i => _.omit(i, ['meta']));
|
|
|
return classes;
|
|
|
},
|
|
|
- },
|
|
|
- watch: {
|
|
|
- defaultOption: {
|
|
|
- immediate: true,
|
|
|
- deep: true,
|
|
|
- handler(val) {
|
|
|
- if (!_.get(this, 'options')) {
|
|
|
- this.$set(this, `options`, _.cloneDeep(val));
|
|
|
- this.search();
|
|
|
- } else {
|
|
|
- let ntermid = _.get(val, 'termid');
|
|
|
- let otermid = _.get(this.options, 'termid');
|
|
|
- if (ntermid && !_.isEqual(ntermid, otermid)) {
|
|
|
- this.$set(this, `options`, _.cloneDeep(val));
|
|
|
- this.search();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ //检查班主任/教室/礼仪课教师
|
|
|
+ checkClassConfig(dClass) {
|
|
|
+ let res = [];
|
|
|
+ for (const cla of dClass) {
|
|
|
+ let { headteacherid, jslocationid, lyteacherid, name } = cla;
|
|
|
+ let obj = { name };
|
|
|
+ // true:表示这个位置没有id
|
|
|
+ if (!headteacherid) obj.headteacher = true;
|
|
|
+ if (!jslocationid) obj.jslocation = true;
|
|
|
+ if (!lyteacherid) obj.lyteacher = true;
|
|
|
+ if (Object.keys(obj).length > 1) res.push(obj);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
},
|
|
|
},
|
|
|
computed: {
|