From 65601fcede8dc287085420f635283f358cc6fc20 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Fri, 6 Nov 2020 07:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=8E=B7=E5=8F=96=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/project/hazop.js | 2 +- routes/project/prepare.js | 19 +++++++++++++------ routes/project/project.js | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/routes/project/hazop.js b/routes/project/hazop.js index 8c7c7cc..08effef 100644 --- a/routes/project/hazop.js +++ b/routes/project/hazop.js @@ -17,7 +17,7 @@ router.get('/analyse/all', function (req, res, next) { }) Array.from(new Array(20).keys()).forEach(value => { - let t={t:`${JSON.stringify({node:Mock.Random.word(),nodeId:Mock.Random.integer(1,10)})}`} + let t={t:`${JSON.stringify({node:Mock.Random.word(),id:Mock.Random.integer(1,10)})}`} sst.si.push(t) }) diff --git a/routes/project/prepare.js b/routes/project/prepare.js index d53438f..2e48231 100644 --- a/routes/project/prepare.js +++ b/routes/project/prepare.js @@ -25,7 +25,7 @@ router.get('/hdivide', function (req, res, next) { router.get('/hdivide/all', function (req, res, next) { var data=mock.page(req,'获取HAOZP节点划分成功',{ - //节点 + //节点id id:/\d{3}/, //节点 node:()=>Mock.Random.word(), @@ -37,8 +37,8 @@ router.get('/hdivide/all', function (req, res, next) { res.json(data) }) -router.patch('/hdivide/:id', function (req, res, next) { - var data=mock.ok(`节点${req.params.id}更新成功`) +router.patch('/hdivide/:nodeId', function (req, res, next) { + var data=mock.ok(`节点${req.params.nodeId}更新成功`) res.json(data) }) @@ -60,12 +60,14 @@ router.get('/hreuse', function (req, res, next) { route.addContextMenu(router,'hreuse','HAZOP节点复用') //SIF节点划分 -router.get('/sdivide/:id', function (req, res, next) { - var data=mock.page(req,`获取节点${req.params.id}SIF节点划分成功`,{ +router.get('/sdivide/:nodeId', function (req, res, next) { + var data=mock.page(req,`获取节点${req.params.nodeId}SIF节点划分成功`,{ + //sif_id + id:/\d{3}/, //SIF名称 name:()=>Mock.Random.name(), //SIF编号 - id:/SIF\d{3}/, + sifId:/SIF\d{3}/, //SIF描述 desc:()=>Mock.Random.sentence(3, 5), //SIF连带动作 @@ -91,6 +93,11 @@ router.get('/sdivide/:id', function (req, res, next) { res.json(data) }) +router.patch('/sdivide/:nodeId/:id', function (req, res, next) { + var data=mock.ok(`节点:${req.params.nodeId},SIF:${req.params.id}更新成功`) + res.json(data) +}) + route.addContextMenu(router,'sdivide','SIF节点划分') router.get('/matrix', function (req, res, next) { diff --git a/routes/project/project.js b/routes/project/project.js index cb8ba8e..f27b67a 100644 --- a/routes/project/project.js +++ b/routes/project/project.js @@ -20,7 +20,7 @@ router.get('/menu', function (req, res, next) { {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'},{name:'LOPA表单'},{name:'LOPA所有节点'}]} + ,{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 = {