|
@@ -68,7 +68,7 @@ class TrainplanService extends CrudService {
|
|
|
// 自动生成班级
|
|
|
await this.autoclass(res, trainplanold);
|
|
|
// 将生成的班级重新将班级排班名
|
|
|
- await this.autoclassname(res);
|
|
|
+ // await this.autoclassname(res);
|
|
|
// 发送培训计划信息通知给相应人员
|
|
|
// 查询所有入库的教师
|
|
|
const teachers = await this.tmodel.find({ status: '4' });
|
|
@@ -124,8 +124,8 @@ class TrainplanService extends CrudService {
|
|
|
for (const batchnum of batchnums) {
|
|
|
// 取得当前批次的班级数
|
|
|
const classnum = batchnum.class;
|
|
|
- for (let i = 1; i <= classnum; i++) {
|
|
|
- const newdata = { name: i, number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
|
|
|
+ for (const cla of classnum) {
|
|
|
+ const newdata = { name: cla.name, number: cla.number, batchid: batchnum.id, termid: el.id, planid: res.id, type: cla.type };
|
|
|
await this.clamodel.create(newdata);
|
|
|
}
|
|
|
}
|
|
@@ -150,8 +150,8 @@ class TrainplanService extends CrudService {
|
|
|
if (_.indexOf(addbatch, batchnum.id) !== -1) {
|
|
|
// 取得当前批次的班级数
|
|
|
const classnum = batchnum.class;
|
|
|
- for (let i = 1; i <= classnum; i++) {
|
|
|
- const newdata = { name: i, number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
|
|
|
+ for (const cla of classnum) {
|
|
|
+ const newdata = { name: cla.name, number: cla.number, batchid: batchnum.id, termid: el.id, planid: res.id, type: cla.type };
|
|
|
await this.clamodel.create(newdata);
|
|
|
}
|
|
|
} else {
|
|
@@ -165,8 +165,8 @@ class TrainplanService extends CrudService {
|
|
|
}
|
|
|
} else {
|
|
|
const classnum = batchnum.class;
|
|
|
- for (let i = 1; i <= classnum; i++) {
|
|
|
- const newdata = { name: i, number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
|
|
|
+ for (const cla of classnum) {
|
|
|
+ const newdata = { name: cla.name, number: cla.number, batchid: batchnum.id, termid: el.id, planid: res.id, type: cla.type };
|
|
|
await this.clamodel.create(newdata);
|
|
|
}
|
|
|
}
|
|
@@ -175,8 +175,8 @@ class TrainplanService extends CrudService {
|
|
|
// 删除所有班级 并重新生成班级
|
|
|
await this.clamodel.deleteMany({ termid: el.id, batchid: batchnum.id });
|
|
|
const classnum = batchnum.class;
|
|
|
- for (let i = 1; i <= classnum; i++) {
|
|
|
- const newdata = { name: i, number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
|
|
|
+ for (const cla of classnum) {
|
|
|
+ const newdata = { name: cla.name, number: cla.number, batchid: batchnum.id, termid: el.id, planid: res.id, type: cla.type };
|
|
|
await this.clamodel.create(newdata);
|
|
|
}
|
|
|
}
|
|
@@ -187,20 +187,20 @@ class TrainplanService extends CrudService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // 将分好的班级重新编排名字
|
|
|
- async autoclassname(res) {
|
|
|
- // 取得所有期id
|
|
|
- const tremid_res = _.map(res.termnum, 'id');
|
|
|
- for (const termid of tremid_res) {
|
|
|
- const classs = await this.clamodel.find({ planid: res.id, termid });
|
|
|
- let i = 0;
|
|
|
- for (const cla of classs) {
|
|
|
- i = i + 1;
|
|
|
- cla.name = i;
|
|
|
- await cla.save();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // // 将分好的班级重新编排名字
|
|
|
+ // async autoclassname(res) {
|
|
|
+ // // 取得所有期id
|
|
|
+ // const tremid_res = _.map(res.termnum, 'id');
|
|
|
+ // for (const termid of tremid_res) {
|
|
|
+ // const classs = await this.clamodel.find({ planid: res.id, termid });
|
|
|
+ // let i = 0;
|
|
|
+ // for (const cla of classs) {
|
|
|
+ // i = i + 1;
|
|
|
+ // cla.name = i;
|
|
|
+ // await cla.save();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
module.exports = TrainplanService;
|