reloaded преди 5 години
родител
ревизия
0b3653d589
променени са 3 файла, в които са добавени 5 реда и са изтрити 4 реда
  1. 1 1
      app/controller/trainplan.js
  2. 3 2
      app/service/class.js
  3. 1 1
      app/service/trainplan.js

+ 1 - 1
app/controller/trainplan.js

@@ -5,7 +5,7 @@ const meta = require('./.trainplan.js');
 const Controller = require('egg').Controller;
 const { CrudController } = require('naf-framework-mongoose/lib/controller');
 
-// 科目管理
+// 培训计划管理
 class TrainplanController extends Controller {
 
   constructor(ctx) {

+ 3 - 2
app/service/class.js

@@ -15,11 +15,11 @@ class ClassService extends CrudService {
   }
 
   async divide(data) {
-    const termid = await data.termid;
-    const batchid = await data.batchid;
     const name = await data.classname;
     const number = await data.students.length;
     const type = await data.type;
+    const termid = await data.termid;
+    const batchid = await data.batchid;
     const classdata = { name, batchid, termid, number, type };
     // 根据班级名称查询班级是否已存在
     const newclass = await this.model.findOne({ name });
@@ -37,6 +37,7 @@ class ClassService extends CrudService {
       const student = await this.stumodel.findById(studentid);
       student.classid = classid;
       student.batchid = batchid;
+      student.termid = termid;
       await student.save();
     }
   }

+ 1 - 1
app/service/trainplan.js

@@ -10,7 +10,7 @@ const { BusinessError, ErrorCode } = require('naf-core').Error;
 class TrainplanService extends CrudService {
   constructor(ctx) {
     super(ctx, 'trainplan');
-    this.tpmodel = this.ctx.model.Trainplan;
+    this.model = this.ctx.model.Trainplan;
     this.clamodel = this.ctx.model.Class;
   }