|
@@ -141,8 +141,8 @@ class ApplyService extends CrudService {
|
|
|
await trainplan.save();
|
|
|
}
|
|
|
// 确认计划安排
|
|
|
- async arrangeConfirm({ planid, ids }) {
|
|
|
- console.log(planid, ids);
|
|
|
+ async arrangeConfirm({ planid, ids, classtype }) {
|
|
|
+ console.log(planid, ids, classtype);
|
|
|
const trainplan = await this.trainmodel.findById(planid);
|
|
|
if (!trainplan) {
|
|
|
throw new BusinessError(ErrorCode.DATA_EXISTED, '年度计划不存在');
|
|
@@ -162,6 +162,13 @@ class ApplyService extends CrudService {
|
|
|
const { batch } = b;
|
|
|
if (!(b.class && _.isArray(b.class))) continue;
|
|
|
for (const c of b.class) {
|
|
|
+ // 检查是否要求班级类型
|
|
|
+ if (classtype) {
|
|
|
+ // 获取这个班级的班级类型
|
|
|
+ const { type } = c;
|
|
|
+ // 判断班级类型与要求的符不符合,不符合就跳过不改
|
|
|
+ if (`${type}` !== `${classtype}`) continue;
|
|
|
+ }
|
|
|
if (!(c.lessons && _.isArray(c.lessons))) continue;
|
|
|
for (const l of c.lessons) {
|
|
|
l.status = '1';
|
|
@@ -169,6 +176,7 @@ class ApplyService extends CrudService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // console.log(termnum);
|
|
|
trainplan.termnum = termnum;
|
|
|
await trainplan.save();
|
|
|
}
|