From cb3f0e7fc1039b7a2a17b3b814bce56f8d7e4736 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Thu, 5 Nov 2020 12:36:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0HAZOP=E5=88=86=E6=9E=90?= =?UTF-8?q?=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 | 65 +++++++++++++++++++++++++++++++++++++++ routes/project/project.js | 2 +- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/routes/project/hazop.js b/routes/project/hazop.js index ded80c6..8c7c7cc 100644 --- a/routes/project/hazop.js +++ b/routes/project/hazop.js @@ -8,6 +8,70 @@ var moment = require("moment") var util=require("../../public/javascripts/util") var route=require('../../public/javascripts/route') + +router.get('/analyse/all', function (req, res, next) { + var sst=Mock.mock({ + "si|1-100":[{ + t:/\d{3}/ + }] + }) + + Array.from(new Array(20).keys()).forEach(value => { + let t={t:`${JSON.stringify({node:Mock.Random.word(),nodeId:Mock.Random.integer(1,10)})}`} + sst.si.push(t) + }) + + + var data=Mock.mock({ + ...mock.ok(`HAZOP分析获取所有节点数据成功`), + ...{ + body:{ + sst, + sheetData:{ + row:function (){ + let rowCount=50 + let colCount=19 + let rows=Array.from(new Array(rowCount).keys()) + let cols=Array.from(new Array(colCount).keys()) + for(let row in rows){ + rows[+row]={ + r:+row+1, + spans:`1:${colCount}`, + c:[] + } + for(let col in cols){ + col=String.fromCharCode(+col+"A".charCodeAt()) + rows[row].c.push({ + r: `${col}${+row + 1}`, + s: 1, + t: 's', + v: (function (col){ + switch (col){ + case 'A': + return Mock.Random.integer(sst.si.length - 20, sst.si.length - 1) + default: + return Mock.Random.integer(0, sst.si.length - 21) + } + })(col) + } + ) + } + } + return rows + } + }, + mergeCells:{ + mergeCell:[{ref:'A1:A10'}, {ref:'A11:A20'}, {ref:'A21:A30'}, {ref:'A31:A40'}, {ref:'A41:A50'}], + count:5 + } + } + } + }) + + + res.json(data) +}) + //HAZOP分析 router.get('/analyse/:id', function (req, res, next) { var sst=Mock.mock({ @@ -57,6 +121,7 @@ router.get('/analyse/:id', function (req, res, next) { res.json(data) }) + //获取当前项目使用矩阵 router.get('/analyse/matrix/:name', function (req, res, next) { var data=Mock.mock({ diff --git a/routes/project/project.js b/routes/project/project.js index 5bae18c..cb8ba8e 100644 --- a/routes/project/project.js +++ b/routes/project/project.js @@ -19,7 +19,7 @@ router.get('/menu', function (req, res, next) { {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所有'}]} + ,{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:'SIL验算', childMenu: [{name:'SIL验算'},{name:'SIL验算[Nodes]'},{name:'SIL验算-总'}]}] config.forEach((item, index) => {