reloaded %!s(int64=5) %!d(string=hai) anos
pai
achega
c70ecf1c44
Modificáronse 3 ficheiros con 8 adicións e 1 borrados
  1. 3 0
      app/controller/.leave.js
  2. 1 0
      app/model/leave.js
  3. 4 1
      app/service/leave.js

+ 3 - 0
app/controller/.leave.js

@@ -8,6 +8,7 @@ module.exports = {
       "classid",
       "starttime",
       "endtime",
+      "stuname",
       "reason",
       "status",
       "refcause",
@@ -28,6 +29,7 @@ module.exports = {
       "studentid",
       "starttime",
       "endtime",
+      "stuname",
       "reason",
       "status",
       "refcause",
@@ -50,6 +52,7 @@ module.exports = {
         classid: "classid",
         starttime: "starttime",
         endtime: "endtime",
+        stuname: "stuname",
         reason: "reason",
         status: "status",
         refcause: "refcause",

+ 1 - 0
app/model/leave.js

@@ -9,6 +9,7 @@ const LeaveSchema = {
   classid: { type: String, required: false, maxLength: 200 }, // 班级id
   planid: { type: String, required: false, maxLength: 200 }, // 计划
   studentid: { type: String, required: true, maxLength: 200 }, // 学生id
+  stuname: { type: String, required: true, maxLength: 200 }, // 学生名称
   starttime: { type: String, required: false, maxLength: 200 }, // 开始时间
   endtime: { type: String, required: false, maxLength: 500 }, // 结束时间
   reason: { type: String, required: false, maxLength: 2000 }, // 请假理由

+ 4 - 1
app/service/leave.js

@@ -34,7 +34,7 @@ class LeaveService extends CrudService {
 
   async update({ id }, data) {
     const leave = await this.model.findById(id);
-    const { studentid, starttime, endtime, reason, status, refcause, batchid, termid, classid, planid } = data;
+    const { studentid, starttime, endtime, reason, status, refcause, batchid, termid, classid, planid, stuname } = data;
     if (studentid) {
       leave.studentid = studentid;
     }
@@ -59,6 +59,9 @@ class LeaveService extends CrudService {
     if (planid) {
       leave.planid = planid;
     }
+    if (stuname) {
+      leave.stuname = stuname;
+    }
     if (status) {
       leave.status = status;
       const student = await this.smodel.findById(leave.studentid);