|
@@ -26,54 +26,6 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</el-card>
|
|
</el-card>
|
|
-
|
|
|
|
- <!-- <el-drawer :visible.sync="drawer" direction="rtl" title="课程安排" @close="toClose">
|
|
|
|
- <data-form :data="form" :fields="resetForm()" :rules="{}" @save="handleSave" :reset="false">
|
|
|
|
- <template #radios="{item, form}">
|
|
|
|
- <template v-if="item.model == 'type'">
|
|
|
|
- <el-radio @change="radioClearForm" v-for="(i, index) in dayType" :key="index" :label="i.label">{{ i.label }}</el-radio>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- <template #options="{item, form}">
|
|
|
|
- <template v-if="item.model == 'subname'">
|
|
|
|
- <el-option v-for="(i, index) in actList" :key="index" :label="i.label" :value="i.label"></el-option>
|
|
|
|
- </template>
|
|
|
|
- <template v-if="item.model == 'subid'">
|
|
|
|
- <el-option v-for="(i, index) in subjectList" :key="index" :label="i.name" :value="i.id"></el-option>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <template #custom="{item, form}">
|
|
|
|
- <template v-if="item.model == 'teaname'">
|
|
|
|
- <el-input v-model="form.teaname" :readonly="true" placeholder="点击选择教师" @click.native="toChooseTeacher"></el-input>
|
|
|
|
- <el-input v-model="form.reason" v-if="needReason()" placeholder="请填写修改教师原因"></el-input>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- </data-form>
|
|
|
|
- </el-drawer>
|
|
|
|
- <el-drawer :visible.sync="drawerTime" direction="rtl" title="课程时间安排" @close="toClose">
|
|
|
|
- <el-form :model="form" size="mini" style="padding:20px">
|
|
|
|
- <el-form-item label="时间">
|
|
|
|
- <el-time-picker
|
|
|
|
- v-model="form.time"
|
|
|
|
- placeholder="请选择时间"
|
|
|
|
- :is-range="true"
|
|
|
|
- value-format="HH:mm"
|
|
|
|
- :picker-options="{ format: 'HH:mm' }"
|
|
|
|
- ></el-time-picker>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-row type="flex" align="middle" justify="center">
|
|
|
|
- <el-col :span="4">
|
|
|
|
- <el-button type="primary" plain @click="hsavetime('save')">保存</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="4">
|
|
|
|
- <el-button type="danger" plain v-if="form && form.index >= 0" @click="hsavetime('delete')">删除</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- </el-drawer> -->
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -144,6 +96,7 @@ export default {
|
|
...teacher({ getTeacher: 'query', lessonteafetch: 'lessonteafetch' }),
|
|
...teacher({ getTeacher: 'query', lessonteafetch: 'lessonteafetch' }),
|
|
...school({ getSchool: 'query' }),
|
|
...school({ getSchool: 'query' }),
|
|
async search() {
|
|
async search() {
|
|
|
|
+ await this.getNoticeList();
|
|
let res = await this.fetch({ model: 'lesson', classid: _.get(this.classInfo, '_id'), status: '1' });
|
|
let res = await this.fetch({ model: 'lesson', classid: _.get(this.classInfo, '_id'), status: '1' });
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
if (!_.get(res.data, 'lessons') || res.data.lessons.length <= 0) {
|
|
if (!_.get(res.data, 'lessons') || res.data.lessons.length <= 0) {
|
|
@@ -159,93 +112,12 @@ export default {
|
|
this.getY(JSON.parse(JSON.stringify(arr)));
|
|
this.getY(JSON.parse(JSON.stringify(arr)));
|
|
this.$set(this, `dateList`, x);
|
|
this.$set(this, `dateList`, x);
|
|
arr = this.aData(arr);
|
|
arr = this.aData(arr);
|
|
- console.log(arr);
|
|
|
|
this.$set(this, `lessonList`, arr);
|
|
this.$set(this, `lessonList`, arr);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async toSave() {
|
|
|
|
- //整理成原数据形式,提交
|
|
|
|
- let data = JSON.parse(JSON.stringify(this.lessonList));
|
|
|
|
- data = this.returnData(data);
|
|
|
|
- let lesson = JSON.parse(JSON.stringify(this.lessonInfo));
|
|
|
|
- lesson.lessons = data;
|
|
|
|
- let res = await this.update(lesson);
|
|
|
|
- if (this.$checkRes(res, null, res.errmsg || '课程表保存失败')) {
|
|
|
|
- this.$emit('saveResult', { from: 'lesson', result: true });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
//点击单元格事件
|
|
//点击单元格事件
|
|
cellClick(row, column) {
|
|
cellClick(row, column) {
|
|
return false;
|
|
return false;
|
|
- // let prop = _.get(column, 'property');
|
|
|
|
- // if (prop != 'time') {
|
|
|
|
- // let date = _.get(column, 'label');
|
|
|
|
- // let time = _.get(row, 'time');
|
|
|
|
- // let num = _.get(column, 'property').match(/\d+(.\d+)?/g)[0];
|
|
|
|
- // let obj = this.getOrderDate(row, num);
|
|
|
|
- // obj.type = obj.subid ? '课程' : '活动';
|
|
|
|
- // this.$set(this, `form`, { date, time, ...obj });
|
|
|
|
- // this.drawer = true;
|
|
|
|
- // } else {
|
|
|
|
- // let obj = _.cloneDeep(row);
|
|
|
|
- // let index = this.lessonList.findIndex(f => f.time == obj.time);
|
|
|
|
- // obj.time = obj.time.split('-');
|
|
|
|
- // obj.index = index;
|
|
|
|
- // this.$set(this, `form`, obj);
|
|
|
|
- // this.drawerTime = true;
|
|
|
|
- // }
|
|
|
|
- },
|
|
|
|
- //抽屉保存
|
|
|
|
- handleSave({ data }) {
|
|
|
|
- let num = _.get(data, 'index');
|
|
|
|
- let type = _.get(data, `type`);
|
|
|
|
- let time = _.get(data, `time`);
|
|
|
|
- let yIndex = this.lessonList.findIndex(f => f.time == time);
|
|
|
|
- let obj = {};
|
|
|
|
- if (type == '课程') {
|
|
|
|
- obj = _.pick(data, ['subid', 'teaid', 'teaname', '_id', 'reason']);
|
|
|
|
- let r = this.subjectList.find(f => f.id == obj.subid);
|
|
|
|
- if (r) obj.subname = r.name;
|
|
|
|
- } else {
|
|
|
|
- obj = _.pick(data, ['subname', '_id']);
|
|
|
|
- }
|
|
|
|
- obj = this.resetData(obj, num);
|
|
|
|
- this.$set(this.lessonList, yIndex, { ...this.lessonList[yIndex], ...obj });
|
|
|
|
- this.setSubTea();
|
|
|
|
- this.drawer = false;
|
|
|
|
- },
|
|
|
|
- //提交整理数据
|
|
|
|
- returnData(data) {
|
|
|
|
- let returnArr = [];
|
|
|
|
- data.map(i => {
|
|
|
|
- let keys = Object.keys(i);
|
|
|
|
- let time = _.get(i, `time`);
|
|
|
|
- let arr = _.compact(_.uniq(_.flatten(keys.map(i => i.match(/\d+(.\d+)?/g)))));
|
|
|
|
- arr.map(index => {
|
|
|
|
- let obj = this.getOrderDate(i, index, true);
|
|
|
|
- obj.time = time;
|
|
|
|
- obj.day = '0';
|
|
|
|
- returnArr.push(obj);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- let r = returnArr.filter(f => f.date == _.last(this.dateList));
|
|
|
|
- let allday = '0';
|
|
|
|
- let res = r.find(f => {
|
|
|
|
- //TODO 根据开始时间不超过12点判断是 整天还是半天
|
|
|
|
- if (f.subname != '--') {
|
|
|
|
- let ts = f.time.split('-');
|
|
|
|
- let time = moment(`${f.date} ${ts[0]}`).format('X');
|
|
|
|
- let twl = moment(`${f.date} 12:00`).format('X');
|
|
|
|
- return twl <= time;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if (res) allday = '1';
|
|
|
|
- returnArr = returnArr.map(i => {
|
|
|
|
- if (i.date == _.last(this.dateList)) i.allday = allday;
|
|
|
|
- else i.allday = '0';
|
|
|
|
- return i;
|
|
|
|
- });
|
|
|
|
- return returnArr;
|
|
|
|
},
|
|
},
|
|
//field的显示
|
|
//field的显示
|
|
fieldDisplay(f, form) {
|
|
fieldDisplay(f, form) {
|
|
@@ -276,22 +148,6 @@ export default {
|
|
r = this.getOrderForTime(r);
|
|
r = this.getOrderForTime(r);
|
|
return r;
|
|
return r;
|
|
},
|
|
},
|
|
- //获取指定数据
|
|
|
|
- getOrderDate(data, index, needDate = false) {
|
|
|
|
- let obj = { index: index };
|
|
|
|
- if (_.get(data, `_id_day${index}`)) obj[`_id`] = _.get(data, `_id_day${index}`);
|
|
|
|
- obj[`subname`] = _.get(data, `subname_day${index}`, `--`);
|
|
|
|
- if (_.get(data, `subid_day${index}`)) obj[`subid`] = _.get(data, `subid_day${index}`);
|
|
|
|
- if (_.get(data, `teaid_day${index}`)) obj[`teaid`] = _.get(data, `teaid_day${index}`);
|
|
|
|
- if (_.get(data, `teaname_day${index}`)) obj[`teaname`] = _.get(data, `teaname_day${index}`);
|
|
|
|
- if (_.get(data, `reason${index}`)) obj[`reason`] = _.get(data, `reason${index}`);
|
|
|
|
- if (needDate) {
|
|
|
|
- //所有的数据都还原了,没必要要index了
|
|
|
|
- delete obj.index;
|
|
|
|
- obj.date = this.dateList[index - 1];
|
|
|
|
- }
|
|
|
|
- return obj;
|
|
|
|
- },
|
|
|
|
//整理,匹配数据是哪天,该显示在哪
|
|
//整理,匹配数据是哪天,该显示在哪
|
|
resetData(data, index) {
|
|
resetData(data, index) {
|
|
let obj = {};
|
|
let obj = {};
|
|
@@ -303,22 +159,6 @@ export default {
|
|
if (_.get(data, 'reason')) obj[`reason${index}`] = _.get(data, 'reason');
|
|
if (_.get(data, 'reason')) obj[`reason${index}`] = _.get(data, 'reason');
|
|
return obj;
|
|
return obj;
|
|
},
|
|
},
|
|
- //修改:选择科目/教师后,将次科目的所有数据统一
|
|
|
|
- setSubTea() {
|
|
|
|
- let duplicate = _.cloneDeep(this.lessonList);
|
|
|
|
- let arr = this.returnData(duplicate);
|
|
|
|
- let teaList = arr.filter(f => f.teaid);
|
|
|
|
- let res = arr.map(i => {
|
|
|
|
- let r = teaList.find(f => f.subid == i.subid);
|
|
|
|
- if (r) {
|
|
|
|
- i.teaid = r.teaid;
|
|
|
|
- i.teaname = r.teaname;
|
|
|
|
- }
|
|
|
|
- return i;
|
|
|
|
- });
|
|
|
|
- res = this.aData(res);
|
|
|
|
- this.$set(this, 'lessonList', res);
|
|
|
|
- },
|
|
|
|
//根据时间排序
|
|
//根据时间排序
|
|
getOrderForTime(data) {
|
|
getOrderForTime(data) {
|
|
let duplicate = JSON.parse(JSON.stringify(data));
|
|
let duplicate = JSON.parse(JSON.stringify(data));
|
|
@@ -355,7 +195,11 @@ export default {
|
|
async getOtherList() {
|
|
async getOtherList() {
|
|
let res = await this.getSubject();
|
|
let res = await this.getSubject();
|
|
if (this.$checkRes(res)) this.$set(this, `subjectList`, res.data);
|
|
if (this.$checkRes(res)) this.$set(this, `subjectList`, res.data);
|
|
- res = await this.fetch({ model: 'notice', classid: this.classInfo.id, type: '4', planid: this.classInfo.planid, termid: this.classInfo.termid });
|
|
|
|
|
|
+ },
|
|
|
|
+ // 消息列表
|
|
|
|
+ async getNoticeList() {
|
|
|
|
+ let { _id: classid, planid, termid } = this.classInfo;
|
|
|
|
+ let 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);
|
|
if (this.$checkRes(res)) this.$set(this, `noticeList`, res.data);
|
|
},
|
|
},
|
|
async seachTeacher() {
|
|
async seachTeacher() {
|
|
@@ -365,32 +209,6 @@ export default {
|
|
let res = await this.lessonteafetch(ids);
|
|
let res = await this.lessonteafetch(ids);
|
|
if (this.$checkRes(res)) this.$set(this, `teacherList`, res.data);
|
|
if (this.$checkRes(res)) this.$set(this, `teacherList`, res.data);
|
|
},
|
|
},
|
|
- //关闭抽屉
|
|
|
|
- toClose() {
|
|
|
|
- this.drawer = false;
|
|
|
|
- this.drawerTime = false;
|
|
|
|
- this.form = {};
|
|
|
|
- },
|
|
|
|
- //修改类型清除数据
|
|
|
|
- radioClearForm(data) {
|
|
|
|
- if (data == '活动') {
|
|
|
|
- delete this.form.subid;
|
|
|
|
- this.form.subname = '--';
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //打开选择教师的dialog
|
|
|
|
- async toChooseTeacher() {
|
|
|
|
- this.dialog = true;
|
|
|
|
- if (this.schoolList.length <= 0) {
|
|
|
|
- let res = await this.getSchool();
|
|
|
|
- if (this.$checkRes(res)) this.$set(this, `schoolList`, res.data);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //选择教师
|
|
|
|
- selTea(data) {
|
|
|
|
- this.dialog = false;
|
|
|
|
- this.$set(this, `form`, { ...this.form, ...data });
|
|
|
|
- },
|
|
|
|
//显示
|
|
//显示
|
|
getProp(data, prop) {
|
|
getProp(data, prop) {
|
|
return _.get(data, prop);
|
|
return _.get(data, prop);
|
|
@@ -400,44 +218,6 @@ export default {
|
|
let teacher = this.teacherList.find(f => f.id == _.get(data, prop));
|
|
let teacher = this.teacherList.find(f => f.id == _.get(data, prop));
|
|
if (teacher) return teacher.phone;
|
|
if (teacher) return teacher.phone;
|
|
},
|
|
},
|
|
- //时间处理
|
|
|
|
- hsavetime(type) {
|
|
|
|
- let { index } = this.form;
|
|
|
|
- if (type == 'delete') this.lessonList.splice(index, 1);
|
|
|
|
- else {
|
|
|
|
- let data = _.cloneDeep(this.form);
|
|
|
|
- data.time = data.time.join('-');
|
|
|
|
- if (index != undefined && index >= 0) this.$set(this.lessonList, index, data);
|
|
|
|
- else this.lessonList.push(data);
|
|
|
|
- }
|
|
|
|
- this.toClose();
|
|
|
|
- //重新排序
|
|
|
|
- this.$set(this, `lessonList`, this.getOrderForTime(this.lessonList));
|
|
|
|
- },
|
|
|
|
- //判断是否修改教师,需要填写修改教师的原因
|
|
|
|
- needReason() {
|
|
|
|
- if (this.form.reason) return true;
|
|
|
|
- else {
|
|
|
|
- let { _id, teaid } = this.form;
|
|
|
|
- let r = this.oLessonList.find(f => f._id == _id);
|
|
|
|
- if (r) {
|
|
|
|
- if (_.get(r, 'teaid')) return _.isEqual(teaid, r.teaid);
|
|
|
|
- else return false;
|
|
|
|
- } else return false;
|
|
|
|
- // teaid
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- resetForm() {
|
|
|
|
- let res = this.needReason();
|
|
|
|
- let fields = _.cloneDeep(this.fields);
|
|
|
|
- if (res) {
|
|
|
|
- fields.push({ label: '修改教师原因', model: 'reason', required: true });
|
|
|
|
- }
|
|
|
|
- return fields;
|
|
|
|
- },
|
|
|
|
- toConfirm() {
|
|
|
|
- this.$emit('toConfirm', _.get(this.lessonInfo, `_id`));
|
|
|
|
- },
|
|
|
|
getNoticeResult(teaid) {
|
|
getNoticeResult(teaid) {
|
|
let word = '';
|
|
let word = '';
|
|
if (teaid) {
|
|
if (teaid) {
|
|
@@ -460,7 +240,7 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(['user']),
|
|
|
|
|
|
+ ...mapState(['user', 'defaultOption']),
|
|
pageTitle() {
|
|
pageTitle() {
|
|
return `${this.$route.meta.title}`;
|
|
return `${this.$route.meta.title}`;
|
|
},
|
|
},
|