You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riskcloudmock/routes/project/project.js

50 lines
2.5 KiB

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'}]}
4 years ago
,{name:'LOPA定级', childMenu: [{name:'LOPA',path:'/project/lopa/lopa'},{name:'LOPA表单',path:'/project/lopa/form'},{name:'LOPA所有节点',path:'/project/lopa/all'}]}
4 years ago
,{name:'SIL验算', childMenu: [{name:'SIL验算',path:'/project/sif/sif'},{name:'SIL验算-总',path:'/project/sif/all'}]}]
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