|
|
|
@ -2,7 +2,32 @@ var express = require('express'); |
|
|
|
|
var router = express.Router(); |
|
|
|
|
var mock = require('../../public/javascripts/mock') |
|
|
|
|
var Mock = require("mockjs") |
|
|
|
|
var multipart = require('connect-multiparty'); |
|
|
|
|
var multipartMiddleware = multipart(); |
|
|
|
|
var moment = require("moment") |
|
|
|
|
var util=require("../../public/javascripts/util") |
|
|
|
|
//获取一般信息
|
|
|
|
|
router.get('/info', function (req, res, next) { |
|
|
|
|
var data={ |
|
|
|
|
...mock.ok('成功获取项目一般信息') |
|
|
|
|
,...{ |
|
|
|
|
body: { |
|
|
|
|
companyName: Mock.Random.name(), |
|
|
|
|
device: Mock.Random.name(), |
|
|
|
|
unit: Mock.Random.name(), |
|
|
|
|
projectNumber: Mock.Random.guid(), |
|
|
|
|
startDate: Mock.Random.date(), |
|
|
|
|
endDate: Mock.Random.date(), |
|
|
|
|
analyticalMethod: Mock.Random.name(), |
|
|
|
|
note: Mock.Random.name() |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
res.json(data) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存一般信息
|
|
|
|
|
router.post('/info', multipartMiddleware,function (req, res, next) { |
|
|
|
|
res.json(mock.ok(`数据自动保存成功,最后更新时间:${moment().format(util.dateFormat)}`)) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
module.exports = router |