|
@@ -16,10 +16,18 @@ class QuestionnaireService extends CrudService {
|
|
|
|
|
|
// 插入问卷
|
|
|
async create(data) {
|
|
|
- const { name, num, type } = data;
|
|
|
+ const { name, num, type, question } = data;
|
|
|
assert(name, '问卷名称不能为空');
|
|
|
assert(num, '问卷序号不能为空');
|
|
|
assert(type, '问卷类型不能为空');
|
|
|
+ const quedata = [];
|
|
|
+ for (const elm of question) {
|
|
|
+ const ques = await this.questionmodel.findById(elm);
|
|
|
+ if (ques) {
|
|
|
+ quedata.push(ques);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.question = quedata;
|
|
|
return await this.questionnairemodel.create(data);
|
|
|
}
|
|
|
|