更新HAZOP分析接口

master
pan 4 years ago
parent f3aa8e09ca
commit cb3f0e7fc1
  1. 65
      routes/project/hazop.js
  2. 2
      routes/project/project.js

@ -8,6 +8,70 @@ var moment = require("moment")
var util=require("../../public/javascripts/util") var util=require("../../public/javascripts/util")
var route=require('../../public/javascripts/route') 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分析 //HAZOP分析
router.get('/analyse/:id', function (req, res, next) { router.get('/analyse/:id', function (req, res, next) {
var sst=Mock.mock({ var sst=Mock.mock({
@ -57,6 +121,7 @@ router.get('/analyse/:id', function (req, res, next) {
res.json(data) res.json(data)
}) })
//获取当前项目使用矩阵 //获取当前项目使用矩阵
router.get('/analyse/matrix/:name', function (req, res, next) { router.get('/analyse/matrix/:name', function (req, res, next) {
var data=Mock.mock({ var data=Mock.mock({

@ -19,7 +19,7 @@ router.get('/menu', function (req, res, next) {
{name: 'HAZOP节点复用',path: '/project/prepare/hreuse'}, {name: 'HAZOP节点复用',path: '/project/prepare/hreuse'},
{name: 'SIF节点划分',path:'/project/prepare/sdivide'}, {name: 'SIF节点划分',path:'/project/prepare/sdivide'},
{name: '矩阵选择',path:'/project/prepare/matrix'}]} {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:'LOPA定级', childMenu: [{name:'LOPA'},{name:'LOPA表单'},{name:'LOPA所有节点'}]}
,{name:'SIL验算', childMenu: [{name:'SIL验算'},{name:'SIL验算[Nodes]'},{name:'SIL验算-总'}]}] ,{name:'SIL验算', childMenu: [{name:'SIL验算'},{name:'SIL验算[Nodes]'},{name:'SIL验算-总'}]}]
config.forEach((item, index) => { config.forEach((item, index) => {

Loading…
Cancel
Save