|
@@ -47,7 +47,7 @@ class ExperienceService extends CrudService {
|
|
|
}
|
|
|
|
|
|
async exportDocx(data) {
|
|
|
- const { planid, termid, batchid, classid, id } = data;
|
|
|
+ const { planid, termid, batchid, classid, studentid, id } = data;
|
|
|
// 从小到大判断
|
|
|
// res是最后的结果,可能是Object也可能是Array
|
|
|
// 作者拼接:能直接获取学生姓名,班级名称,需要单独查下期数
|
|
@@ -76,6 +76,12 @@ class ExperienceService extends CrudService {
|
|
|
const { term } = await trainPlanInfo(r.termid);
|
|
|
if (term) { r.term = `第${term}期`; }
|
|
|
res = r;
|
|
|
+ } else if (studentid) {
|
|
|
+ const r = await this.model.findOne({ studentid }).populate({ path: 'studentid', select: 'name job' }).populate({ path: 'classid', select: 'name' });
|
|
|
+ if (!r) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定范围的培训心得');
|
|
|
+ const { term } = await trainPlanInfo(r.termid);
|
|
|
+ if (term) { r.term = `第${term}期`; }
|
|
|
+ res = r;
|
|
|
} else if (classid) {
|
|
|
let r = await this.model.find({ classid }).populate({ path: 'studentid', select: 'name job' }).populate({ path: 'classid', select: 'name' });
|
|
|
if (r.length <= 0) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定范围的培训心得');
|