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") var route=require('../../public/javascripts/route') //获取一般信息 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)}`)) }) //获取团队成员 router.get('/member', function (req, res, next) { var data=mock.page(req,'获取团队成员成功',{ name:()=>Mock.Random.name(), email:()=>Mock.Random.email(), cellphone:/1[34578][0-9]{9}/, post:()=>Mock.Random.word(), company:()=>Mock.Random.word(), department:()=>Mock.Random.word(), specialty:()=>Mock.Random.word(), time:()=>Mock.Random.date(), note:()=>Mock.Random.sentence(3, 5) }) res.json(data) }) route.addContextMenu(router,'member','团队成员') router.get('/meeting', function (req, res, next) { var data=mock.page(req,'获取会议信息成功',{ date:()=>Mock.Random.date(), hour:()=>Mock.Random.integer(1, 3), //描述 desc:()=>Mock.Random.sentence(3, 5), //主席 chairman:()=>Mock.Random.name(), //记录员 recorder:()=>Mock.Random.name(), //会议议程 agenda:()=>Mock.Random.sentence(3, 5), //会议纪要 summary:()=>Mock.Random.sentence(3, 5), //备注 note:()=>Mock.Random.sentence(3, 5) }) res.json(data) }) route.addContextMenu(router,'meeting','会议信息') module.exports = router