|
|
|
var express = require('express');
|
|
|
|
var router = express.Router();
|
|
|
|
var mock = require('../../public/javascripts/mock')
|
|
|
|
var Mock = require("mockjs")
|
|
|
|
const multipart = require("connect-multiparty");
|
|
|
|
var multipartMiddleware = multipart();
|
|
|
|
|
|
|
|
router.get('/menu', function (req, res, next) {
|
|
|
|
res.json({
|
|
|
|
...mock.ok('菜单获取成功'),
|
|
|
|
...Mock.mock({
|
|
|
|
body: {
|
|
|
|
menus: function () {
|
|
|
|
let menus = []
|
|
|
|
let config = [{name: '项目基本信息', isOpen:true,childMenu: [
|
|
|
|
{name: '一般信息',path:'/project/info/baseinfo',selected:true},
|
|
|
|
{name: '团队成员',path:'/project/info/team_members'}, {name: '会议信息',path:'/project/info/meeting'}]}
|
|
|
|
,{name: '项目准备', childMenu: [{name: 'HAZOP节点划分',path:'/project/prepare/hdivide'},
|
|
|
|
{name: 'HAZOP节点复用',path: '/project/prepare/hreuse'},
|
|
|
|
{name: 'SIF节点划分',path:'/project/prepare/sdivide'},
|
|
|
|
{name: '矩阵选择',path:'/project/prepare/matrix'}]}
|
|
|
|
,{name: 'HAZOP分析', childMenu: [{name: 'HAZOP分析',path:'/project/hazop/analyse'}, {name: 'HAZOP所有',path:'/project/hazop/all'}]}
|
|
|
|
,{name:'LOPA定级', childMenu: [{name:'LOPA',path:'/project/lopa/lopa'},{name:'LOPA表单'},{name:'LOPA所有节点'}]}
|
|
|
|
,{name:'SIL验算', childMenu: [{name:'SIL验算'},{name:'SIL验算[Nodes]'},{name:'SIL验算-总'}]}]
|
|
|
|
config.forEach((item, index) => {
|
|
|
|
let menu = {
|
|
|
|
menuId: `a${index}`,
|
|
|
|
menuName: item.name,
|
|
|
|
isOpen: item.isOpen?item.isOpen:false
|
|
|
|
}
|
|
|
|
let childMenu = []
|
|
|
|
item.childMenu.forEach((item, index) => {
|
|
|
|
childMenu.push({
|
|
|
|
menuId: index,
|
|
|
|
menuName: item.name,
|
|
|
|
path:item.path?item.path:''
|
|
|
|
})
|
|
|
|
})
|
|
|
|
menu.childMenu = childMenu
|
|
|
|
menus.push(menu)
|
|
|
|
})
|
|
|
|
return menus
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = router
|