Selaa lähdekoodia

修改学校计划人数

liuyu 4 vuotta sitten
vanhempi
commit
74a02a8290
3 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 2 0
      app/controller/.trainplan.js
  2. 1 1
      app/model/trainplan.js
  3. 4 1
      app/service/trainplan.js

+ 2 - 0
app/controller/.trainplan.js

@@ -6,6 +6,7 @@ module.exports = {
       '!title',
       'status',
       'termnum',
+      'school',
       'festivals'
     ]
   },
@@ -21,6 +22,7 @@ module.exports = {
       'title',
       'status',
       'termnum',
+      'school',
       'festivals'
     ]
   },

+ 1 - 1
app/model/trainplan.js

@@ -25,7 +25,6 @@ const termInfo = new Schema({
   term: { type: String, required: false, maxLength: 200 }, // 期数
   classnum: { type: String, required: false, maxLength: 200 }, // 班级数
   batchnum: { type: [ batchInfo ], select: true }, // 批
-  school: { type: [ schInfo ], select: true }, // 学校
 });
 
 // 节假日信息表
@@ -43,6 +42,7 @@ const TrainplanSchema = {
   title: { type: String, required: true, maxLength: 500 }, // 标题
   status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-筹备中,1-发布,2-结束
   termnum: { type: [ termInfo ], select: true }, // 期
+  school: { type: [ schInfo ], select: true }, // 学校
   festivals: { type: [ festivalInfo ], select: true }, // 节假日
 };
 

+ 4 - 1
app/service/trainplan.js

@@ -42,7 +42,7 @@ class TrainplanService extends CrudService {
     // 保存原数据
     const trainplanold = _.cloneDeep(trainplan);
 
-    const { year, title, termnum, festivals, status } = data;
+    const { year, title, termnum, festivals, status, school } = data;
     if (year) {
       trainplan.year = year;
     }
@@ -52,6 +52,9 @@ class TrainplanService extends CrudService {
     if (termnum) {
       trainplan.termnum = termnum;
     }
+    if (school) {
+      trainplan.school = school;
+    }
     if (festivals) {
       trainplan.festivals = festivals;
     }