guhongwei 4 năm trước cách đây
mục cha
commit
da2c87fc16
2 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. 4 3
      app/controller/.repair.js
  2. 6 0
      app/model/repair.js

+ 4 - 3
app/controller/.repair.js

@@ -1,6 +1,6 @@
 module.exports = {
 module.exports = {
   create: {
   create: {
-    requestBody: ["!uid","name", "type","parts", "jobdate","totalmoney"],
+    requestBody: ["!uid", "name", "type", "parts", "jobdate", "totalmoney", "create_data","finish_date"],
   },
   },
   destroy: {
   destroy: {
     params: ["!id"],
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   },
   update: {
   update: {
     params: ["!id"],
     params: ["!id"],
-    requestBody: ["!uid","name", "type","parts", "jobdate","totalmoney"],
+    requestBody: ["!uid", "name", "type", "parts", "jobdate", "totalmoney", "create_data", "finish_date"],
   },
   },
   show: {
   show: {
     parameters: {
     parameters: {
@@ -24,7 +24,8 @@ module.exports = {
         parts: "parts",
         parts: "parts",
         jobdate: "jobdate",
         jobdate: "jobdate",
         totalmoney: "totalmoney",
         totalmoney: "totalmoney",
-        uid: "uid",
+        create_data: "create_data",
+        finish_date: "finish_date",
       },
       },
     },
     },
     service: "query",
     service: "query",

+ 6 - 0
app/model/repair.js

@@ -1,6 +1,10 @@
 'use strict';
 'use strict';
 const Schema = require('mongoose').Schema;
 const Schema = require('mongoose').Schema;
+const moment = require('moment');
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const dateNow = function () {
+  return moment().format("YYYY-MM-DD");
+};
 // 维修单
 // 维修单
 const RepairSchema = {
 const RepairSchema = {
   name: { type: String, required: false, maxLength: 200 }, // 维修项目名
   name: { type: String, required: false, maxLength: 200 }, // 维修项目名
@@ -8,6 +12,8 @@ const RepairSchema = {
   parts: { type: String, required: false, maxLength: 200 }, // 配件
   parts: { type: String, required: false, maxLength: 200 }, // 配件
   jobdate: { type: String, required: false, maxLength: 200 }, // 工时
   jobdate: { type: String, required: false, maxLength: 200 }, // 工时
   totalmoney: { type: String, required: false, maxLength: 200 }, // 合计
   totalmoney: { type: String, required: false, maxLength: 200 }, // 合计
+  create_data: { type: String, required: false, maxLength: 200, default: dateNow }, // 来店时间
+  finish_date: { type: String, required: false, maxLength: 200 }, // 交车时间
   uid: { type: String, required: true, maxLength: 500 }, // 所属用户id
   uid: { type: String, required: true, maxLength: 500 }, // 所属用户id
   // ref:'Company',关联数据
   // ref:'Company',关联数据
 };
 };