Kaynağa Gözat

增加学生类别

liuyu 4 yıl önce
ebeveyn
işleme
e353142eb1
4 değiştirilmiş dosya ile 9 ekleme ve 4 silme
  1. 3 0
      app/controller/.student.js
  2. 1 0
      app/model/student.js
  3. 1 1
      app/router.js
  4. 4 3
      app/service/school.js

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

@@ -34,6 +34,7 @@ module.exports = {
       "score",
       "diy",
       "isComming",
+      "type",
     ],
   },
   destroy: {
@@ -76,6 +77,7 @@ module.exports = {
       "score",
       "diy",
       "isComming",
+      "type",
     ],
   },
   show: {
@@ -120,6 +122,7 @@ module.exports = {
         score: "score",
         diy: "diy",
         isComming:"isComming",
+        type: "type",
       },
     },
     service: "query",

+ 1 - 0
app/model/student.js

@@ -37,6 +37,7 @@ const StudentSchema = {
   score: { type: String, required: false, maxLength: 200, zh: '总分' }, // 总分
   diy: { type: { Object }, required: false, zh: '自定义' }, // 自定义
   isComming: { type: String, default: '0', zh: '签到' }, // 是否签到0否,1是
+  type: { type: String, required: false, maxLength: 200, default: '0' }, // 类型:0-正常,1-特殊
 };
 
 

+ 1 - 1
app/router.js

@@ -236,7 +236,7 @@ module.exports = app => {
   router.resources('classtype', '/api/train/classtype', controller.classtype); // index、create、show、destroy
   router.post('classtype', '/api/train/classtype/update/:id', controller.classtype.update);
 
-  // 职责说明表设置路由
+  // 学校上传任务表设置路由
   router.resources('job', '/api/train/job', controller.job); // index、create、show、destroy
   router.post('job', '/api/train/job/update/:id', controller.job.update);
 

+ 4 - 3
app/service/school.js

@@ -20,7 +20,7 @@ class SchoolService extends CrudService {
   }
 
   async stuimport(data) {
-    const { filepath, termid, schid } = data;
+    const { filepath, termid, schid, type } = data;
     assert(filepath, 'filepath不能为空');
     assert(termid, 'termid不能为空');
     assert(schid, 'schid不能为空');
@@ -40,7 +40,7 @@ class SchoolService extends CrudService {
     // 取得excle中数据
     const _filepath = this.ctx.app.config.baseUrl + filepath;
     console.log(_filepath);
-    const studatas = await this.getImportXLSXData(_filepath, termid, schid, planid, planyearid);
+    const studatas = await this.getImportXLSXData(_filepath, termid, schid, planid, planyearid, type);
     console.log(studatas);
     // 将得到的数据校验
     const datacheck = await this.datacheck(studatas);
@@ -75,7 +75,7 @@ class SchoolService extends CrudService {
   }
 
   // 获取导入的XLSX文件中的数据
-  async getImportXLSXData(filepath, termid, schid, planid, planyearid) {
+  async getImportXLSXData(filepath, termid, schid, planid, planyearid, type) {
     console.log(filepath);
     const file = await this.ctx.curl(filepath);
     const workbook = XLSX.read(file.data);
@@ -132,6 +132,7 @@ class SchoolService extends CrudService {
         schid,
         planid,
         planyearid,
+        type,
       });
     }
     exceldata = [ ...exceldata, ..._datas ];