|
@@ -51,7 +51,9 @@ export default {
|
|
{ label: '班级', prop: 'name' },
|
|
{ label: '班级', prop: 'name' },
|
|
],
|
|
],
|
|
dialogSend: false,
|
|
dialogSend: false,
|
|
- form: {},
|
|
|
|
|
|
+ form: {
|
|
|
|
+ type: '0',
|
|
|
|
+ },
|
|
classid: '',
|
|
classid: '',
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -82,45 +84,20 @@ export default {
|
|
// 通知确定
|
|
// 通知确定
|
|
async submitForm({ data }) {
|
|
async submitForm({ data }) {
|
|
let classid = this.classid;
|
|
let classid = this.classid;
|
|
- let dealData = data => {
|
|
|
|
- let { students, teachers } = data;
|
|
|
|
- students = students.map(item => ({ notifiedid: item.id }));
|
|
|
|
- teachers = teachers.map(item => ({ notifiedid: item.id }));
|
|
|
|
- let arr = [...students, ...teachers];
|
|
|
|
- return arr;
|
|
|
|
- };
|
|
|
|
- console.log(dealData);
|
|
|
|
- //如果classid为空,就说明是本期发送,应该把每个班的人都拽出来发送
|
|
|
|
if (classid) {
|
|
if (classid) {
|
|
- let r = await this.classNameList(classid);
|
|
|
|
- if (r.errcode != 0) return;
|
|
|
|
- console.log('不为空');
|
|
|
|
- data.notified = dealData(r.data);
|
|
|
|
- } else {
|
|
|
|
- let classids = this.list.map(i => i._id);
|
|
|
|
- let rarr = [];
|
|
|
|
- for (const classid of classids) {
|
|
|
|
- let r = await this.classNameList(classid);
|
|
|
|
- if (r.errcode != 0) continue;
|
|
|
|
- let arr = dealData(r.data);
|
|
|
|
- rarr = [...rarr, ...arr];
|
|
|
|
- }
|
|
|
|
- data.notified = rarr;
|
|
|
|
- console.log(rarr);
|
|
|
|
|
|
+ data.classid = classid;
|
|
}
|
|
}
|
|
- console.log(data);
|
|
|
|
data.noticeid = this.user.userid;
|
|
data.noticeid = this.user.userid;
|
|
let { planyearid, planid, termid } = this.defaultOption;
|
|
let { planyearid, planid, termid } = this.defaultOption;
|
|
data = { ...data, planyearid, planid, termid };
|
|
data = { ...data, planyearid, planid, termid };
|
|
-
|
|
|
|
- // const arr = await this.noticeCreate(data);
|
|
|
|
- // if (this.$checkRes(arr)) {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: '通知成功',
|
|
|
|
- // type: 'success',
|
|
|
|
- // });
|
|
|
|
- // this.resetForm();
|
|
|
|
- // }
|
|
|
|
|
|
+ const arr = await this.noticeCreate(data);
|
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '通知成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.resetForm();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
toSelect(val) {
|
|
toSelect(val) {
|
|
this.selected = val;
|
|
this.selected = val;
|