|
@@ -11,6 +11,34 @@ class UploadquestionService extends CrudService {
|
|
|
constructor(ctx) {
|
|
|
super(ctx, 'uploadquestion');
|
|
|
this.model = this.ctx.model.Uploadquestion;
|
|
|
+ this.smodel = this.ctx.model.Student;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 完成度查询
|
|
|
+ async completion(data) {
|
|
|
+ const { type, typeid } = data;
|
|
|
+ let allcount = '';
|
|
|
+ let answercount = '';
|
|
|
+ // 如果是期查询
|
|
|
+ if (type === '0') {
|
|
|
+ // 取得当前期学生总数
|
|
|
+ allcount = await this.smodel.count({ termid: typeid });
|
|
|
+ // 取得当前期学生答问卷数
|
|
|
+ answercount = await this.model.count({ termid: typeid });
|
|
|
+ } else if (type === '1') {
|
|
|
+ // 取得当前期学生总数
|
|
|
+ allcount = await this.smodel.count({ batchid: typeid });
|
|
|
+ // 取得当前期学生答问卷数
|
|
|
+ answercount = await this.model.count({ batchid: typeid });
|
|
|
+ } else if (type === '2') {
|
|
|
+ // 取得当前期学生总数
|
|
|
+ allcount = await this.smodel.count({ classid: typeid });
|
|
|
+ // 取得当前期学生答问卷数
|
|
|
+ answercount = await this.model.count({ classid: typeid });
|
|
|
+ }
|
|
|
+
|
|
|
+ const newdata = { allcount, answercount };
|
|
|
+ return newdata;
|
|
|
}
|
|
|
|
|
|
}
|