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

47 lines
2.1 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节点复用'}, {name: 'SIF节点划分'}, {name: '矩阵选择'}]}
,{name: 'HAZOP分析', childMenu: [{name: 'HAZOP分析'}, {name: 'HAZOP所有'}]}
,{name:'LOPA定级', childMenu: [{name:'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