From 020f925fc0795bac69a3af05eb50e77d98921286 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Fri, 23 Oct 2020 22:36:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0HAZOP=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=88=92=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 3 ++- routes/project/prepare.js | 28 ++++++++++++++++++++++++++++ routes/project/project.js | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 routes/project/prepare.js diff --git a/app.js b/app.js index 141d51f..1a915ed 100644 --- a/app.js +++ b/app.js @@ -11,6 +11,7 @@ var projectRouter=require('./routes/main/project') var dataRouter=require('./routes/main/data') var projectDetailRouter=require('./routes/project/project') var infoRouter=require('./routes/project/info') +var prepareRouter=require('./routes/project/prepare') const server = require("inspector"); var app = express(); @@ -34,7 +35,7 @@ app.use(cors({ app.use('/', indexRouter); app.use('/api/account',accountRouter) app.use('/api/main',mainRouter,projectRouter,dataRouter) -app.use('/api/project',projectDetailRouter,infoRouter) +app.use('/api/project',projectDetailRouter,infoRouter,prepareRouter) // catch 404 and forward to error handler app.use(function(req, res, next) { diff --git a/routes/project/prepare.js b/routes/project/prepare.js new file mode 100644 index 0000000..c1da6ad --- /dev/null +++ b/routes/project/prepare.js @@ -0,0 +1,28 @@ +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') + +//获取HAZOP节点划分 +router.get('/hdivide', function (req, res, next) { + var data=mock.page(req,'获取HAOZP节点划分成功',{ + //节点 + node:()=>Mock.Random.word(), + //节点编号 + nodeId:/Node\d{3}/, + //节点描述 + nodeDesc:()=>Mock.Random.sentence(3, 5), + //节点PID号 + nodePid:/PID\d{3}/ + }) + res.json(data) +}) + +route.addContextMenu(router,'hdivide','HAZOP节点划分') + +module.exports=router \ No newline at end of file diff --git a/routes/project/project.js b/routes/project/project.js index 76f3e73..07209dc 100644 --- a/routes/project/project.js +++ b/routes/project/project.js @@ -15,7 +15,7 @@ router.get('/menu', function (req, res, next) { 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节点划分'}, {name: 'HAZOP节点复用'}, {name: 'SIF节点划分'}, {name: '矩阵选择'}]} + ,{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验算-总'}]}]