parent
e3e81dd456
commit
1f56d906eb
@ -0,0 +1,42 @@ |
||||
var express = require('express'); |
||||
var router = express.Router(); |
||||
var mock = require('../../public/javascripts/mock') |
||||
var Mock = require("mockjs") |
||||
|
||||
router.get('/menu', function (req, res, next) { |
||||
res.json({ |
||||
...mock.ok('菜单获取成功'), |
||||
...Mock.mock({ |
||||
body: { |
||||
menus: function () { |
||||
let menus = [] |
||||
let config = [{name: '项目基本信息', childMenu: [{name: '一般信息'}, {name: '团队成员'}, {name: '会议信息'}]} |
||||
,{name: '项目准备', childMenu: [{name: 'HAZOP节点划分'}, {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: Mock.Random.boolean() |
||||
} |
||||
let childMenu = [] |
||||
item.childMenu.forEach((item, index) => { |
||||
childMenu.push({ |
||||
menuId: index, |
||||
menuName: item.name, |
||||
isSelected: false |
||||
}) |
||||
}) |
||||
menu.childMenu = childMenu |
||||
menus.push(menu) |
||||
}) |
||||
return menus |
||||
} |
||||
} |
||||
}) |
||||
}) |
||||
}) |
||||
|
||||
module.exports = router |
Loading…
Reference in new issue