Jelajahi Sumber

班级管理 添加 培训场地 课表中添加 日间助教

zs 10 bulan lalu
induk
melakukan
6f28fcf328

+ 57 - 54
app/controller/.class.js

@@ -1,84 +1,87 @@
 module.exports = {
   create: {
     requestBody: [
-      "!name",
-      "number",
-      "batchid",
-      "termid",
-      "planid",
-      "planyearid",
-      "headteacherid",
-      "lyteacherid",
-      "yclocationid",
-      "kzjhlocationid",
-      "kbyslocationid",
-      "jslocationid",
-      "lessonid",
-      "type",
+      '!name',
+      'number',
+      'batchid',
+      'termid',
+      'planid',
+      'planyearid',
+      'headteacherid',
+      'lyteacherid',
+      'rjteacherid',
+      'yclocationid',
+      'kzjhlocationid',
+      'kbyslocationid',
+      'jslocationid',
+      'lessonid',
+      'type',
     ],
   },
   destroy: {
-    params: ["!id"],
-    service: "delete",
+    params: ['!id'],
+    service: 'delete',
   },
   update: {
-    params: ["!id"],
+    params: ['!id'],
     requestBody: [
-      "name",
-      "number",
-      "batchid",
-      "termid",
-      "planid",
-      "planyearid",
-      "headteacherid",
-      "lyteacherid",
-      "yclocationid",
-      "kzjhlocationid",
-      "kbyslocationid",
-      "jslocationid",
-      "lessonid",
-      "type",
+      'name',
+      'number',
+      'batchid',
+      'termid',
+      'planid',
+      'planyearid',
+      'headteacherid',
+      'lyteacherid',
+      'rjteacherid',
+      'yclocationid',
+      'kzjhlocationid',
+      'kbyslocationid',
+      'jslocationid',
+      'lessonid',
+      'type',
     ],
   },
   show: {
     parameters: {
-      params: ["!id"],
+      params: ['!id'],
     },
-    service: "fetch",
+    service: 'fetch',
   },
   index: {
     parameters: {
       query: {
-        name: "name",
-        number: "number",
-        batchid: "batchid",
-        termid: "termid",
-        planid: "planid",
-        planyearid: "planyearid",
-        headteacherid: "headteacherid",
-        lyteacherid: "lyteacherid",
-        yclocationid: "yclocationid",
-        kzjhlocationid: "kzjhlocationid",
-        kbyslocationid: "kbyslocationid",
-        jslocationid: "jslocationid",
-        lessonid: "lessonid",
-        type: "type",
+        name: 'name',
+        number: 'number',
+        batchid: 'batchid',
+        termid: 'termid',
+        planid: 'planid',
+        planyearid: 'planyearid',
+        headteacherid: 'headteacherid',
+        lyteacherid: 'lyteacherid',
+        rjteacherid: 'rjteacherid',
+        yclocationid: 'yclocationid',
+        kzjhlocationid: 'kzjhlocationid',
+        kbyslocationid: 'kbyslocationid',
+        jslocationid: 'jslocationid',
+        lessonid: 'lessonid',
+        type: 'type',
       },
     },
-    service: "query",
+    service: 'query',
     options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
       desc: true,
       count: true,
     },
   },
   toSetClassSetting: {
     parameters: {
-      query:{
-        classid:"classid"
-      }
+      query: {
+        classid: 'classid',
+      },
     },
-    service: "toSetClassSetting",
+    service: 'toSetClassSetting',
   },
 };

+ 1 - 0
app/model/class.js

@@ -12,6 +12,7 @@ const ClassSchema = {
   planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id
   headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
   lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
+  rjteacherid: { type: String, required: false, maxLength: 200 }, // 日间助教老师id
   yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
   kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展训练地点id
   kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id

+ 1 - 1
app/model/location.js

@@ -5,7 +5,7 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 // 位置表
 const LocationSchema = {
   name: { type: String, required: true, maxLength: 500 }, // 名称
-  type: { type: String, required: true, maxLength: 10 }, // 0、教室位置 1、开班仪式地点 2拓展训练地点 3、用餐地点
+  type: { type: String, required: true, maxLength: 10 }, // 0、教室位置 1、开班仪式地点 2拓展训练地点 3、用餐地点 4、培训场地
   ibeacon: { type: String, required: false, maxLength: 500 }, // 蓝牙设备号
 };
 

+ 16 - 1
app/service/class.js

@@ -561,6 +561,12 @@ class ClassService extends CrudService {
       if (!res) res = await this.heamodel.findById(cla.lyteacherid);
       if (res) cla.lyteacher = res.name;
     }
+    // 日间助教
+    if (cla.rjteacherid) {
+      let res = await this.teamodel.findById(cla.rjteacherid);
+      if (!res) res = await this.heamodel.findById(cla.rjteacherid);
+      if (res) cla.rjteacher = res.name;
+    }
     return cla;
   }
 
@@ -626,6 +632,14 @@ class ClassService extends CrudService {
         lyteacher = await this.teamodel.findById(classes.lyteacherid);
       }
     }
+    // 日间助教老师信息
+    let rjteacher;
+    if (classes.rjteacherid) {
+      rjteacher = await this.heamodel.findById(classes.rjteacherid);
+      if (!rjteacher) {
+        rjteacher = await this.teamodel.findById(classes.rjteacherid);
+      }
+    }
     // 教课老师信息
     let teachers = [];
     const lessones = await this.lessmodel.findOne({ classid });
@@ -637,8 +651,9 @@ class ClassService extends CrudService {
         }
       }
     }
-    teachers.push(lyteacher);
     teachers.push(headteacher);
+    teachers.push(lyteacher);
+    teachers.push(rjteacher);
     teachers = _.uniq(_.compact(teachers));
     for (const tea of teachers) {
       const user = users.find(item => item.uid === tea.id);

+ 1 - 0
app/service/headteacher.js

@@ -30,6 +30,7 @@ class HeadteacherService extends CrudService {
     const yjyUsers = await this.yjy.find({ suid: uids }).lean();
     for (const i of rs) {
       const { _id: did } = i;
+      i.id = did;
       const user = users.find(f => ObjectId(did).equals(f.uid));
       if (!user) {
         i.is_bind = false;

+ 1 - 1
app/service/teaplan.js

@@ -26,7 +26,7 @@ class TeaplanService extends CrudService {
     const headteachers = await this.hmodel.find();
     // 根据批次id取得当前批次具体信息
     const trainplan = await this.tmodel.findById(planid);
-    if (!trainplan) {
+    if (!trainplan) { 
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '全年计划信息不存在');
     }
     const term = await trainplan.termnum.id(termid);