增加sif接口

master
pan 4 years ago
parent 0e81b85b57
commit 27c8a7a85c
  1. 2
      routes/project/project.js
  2. 48
      routes/project/sif.js

@ -21,7 +21,7 @@ router.get('/menu', function (req, res, next) {
{name: '矩阵选择',path:'/project/prepare/matrix'}]} {name: '矩阵选择',path:'/project/prepare/matrix'}]}
,{name: 'HAZOP分析', childMenu: [{name: 'HAZOP分析',path:'/project/hazop/analyse'}, {name: 'HAZOP所有',path:'/project/hazop/all'}]} ,{name: 'HAZOP分析', childMenu: [{name: 'HAZOP分析',path:'/project/hazop/analyse'}, {name: 'HAZOP所有',path:'/project/hazop/all'}]}
,{name:'LOPA定级', childMenu: [{name:'LOPA',path:'/project/lopa/lopa'},{name:'LOPA表单',path:'/project/lopa/form'},{name:'LOPA所有节点',path:'/project/lopa/all'}]} ,{name:'LOPA定级', childMenu: [{name:'LOPA',path:'/project/lopa/lopa'},{name:'LOPA表单',path:'/project/lopa/form'},{name:'LOPA所有节点',path:'/project/lopa/all'}]}
,{name:'SIL验算', childMenu: [{name:'SIL验算',path:'/project/sif/sif'},{name:'SIL验算[Nodes]'},{name:'SIL验算-总'}]}] ,{name:'SIL验算', childMenu: [{name:'SIL验算',path:'/project/sif/sif'},{name:'SIL验算-总',path:'/project/sif/all'}]}]
config.forEach((item, index) => { config.forEach((item, index) => {
let menu = { let menu = {
menuId: `a${index}`, menuId: `a${index}`,

@ -50,6 +50,54 @@ router.get('/sif/instrumentData', function (req, res, next) {
res.json(data) res.json(data)
}) })
router.get('/sif/all', function (req, res, next) {
var sst=Mock.mock({
"si|1-100":[{
t:/\d{3}/
}]
})
var data=Mock.mock({
...mock.ok(`LOPA获取节点${req.params.nodeId},${req.params.sifId}数据成功`),
...{
body:{
sst,
sheetData:{
row:function (){
let rowCount=50
let colCount=49
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: Mock.Random.integer(0, sst.si.length - 1)
}
)
}
}
return rows
}
},
mergeCells:{
mergeCell:[],
count:0
}
}
}
})
res.json(data)
})
router.get('/sif/:nodeId/:sifId', function (req, res, next) { router.get('/sif/:nodeId/:sifId', function (req, res, next) {
var sst=Mock.mock({ var sst=Mock.mock({
"si|1-100":[{ "si|1-100":[{

Loading…
Cancel
Save