|
|
|
@ -24,19 +24,32 @@ 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}/, |
|
|
|
|
var data=Mock.mock({ |
|
|
|
|
...mock.ok('获取所有HAOZP节点划分成功'), |
|
|
|
|
...{ |
|
|
|
|
body:function (){ |
|
|
|
|
let obj={} |
|
|
|
|
Array.from(new Array(20).keys()).forEach(value => { |
|
|
|
|
obj[Mock.Random.integer(1,999)]=Mock.mock({ |
|
|
|
|
//节点
|
|
|
|
|
node:()=>Mock.Random.word(), |
|
|
|
|
//节点编号
|
|
|
|
|
nodeId:/Node\d{3}/, |
|
|
|
|
//节点描述
|
|
|
|
|
nodeDesc:()=>Mock.Random.sentence(3, 5), |
|
|
|
|
//节点PID号
|
|
|
|
|
nodePid:/PID\d{3}/ |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return obj |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
res.json(data) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
router.patch('/hdivide/:nodeId', function (req, res, next) { |
|
|
|
|
var data=mock.ok(`节点${req.params.nodeId}更新成功`) |
|
|
|
|
res.json(data) |
|
|
|
@ -93,6 +106,50 @@ router.get('/sdivide/:nodeId', function (req, res, next) { |
|
|
|
|
res.json(data) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
router.get('/sdivide/:nodeId/all', function (req, res, next) { |
|
|
|
|
var data=Mock.mock({ |
|
|
|
|
...mock.ok('获取所有HAOZP节点划分成功'), |
|
|
|
|
...{ |
|
|
|
|
body:function (){ |
|
|
|
|
let obj={} |
|
|
|
|
Array.from(new Array(20).keys()).forEach(value => { |
|
|
|
|
obj[Mock.Random.integer(1,999)]=Mock.mock({ |
|
|
|
|
//sif_id
|
|
|
|
|
id:/\d{3}/, |
|
|
|
|
//SIF名称
|
|
|
|
|
name:()=>Mock.Random.name(), |
|
|
|
|
//SIF编号
|
|
|
|
|
sifId:/SIF\d{3}/, |
|
|
|
|
//SIF描述
|
|
|
|
|
desc:()=>Mock.Random.sentence(3, 5), |
|
|
|
|
//SIF连带动作
|
|
|
|
|
action:()=>Mock.Random.word(), |
|
|
|
|
//需求模式
|
|
|
|
|
demandModel:()=>`${Mock.Random.integer(1,3)}`, |
|
|
|
|
//SIL等级要求
|
|
|
|
|
level:()=>Mock.Random.integer(1,10), |
|
|
|
|
//触发机构
|
|
|
|
|
impactMmechanism:()=>Mock.Random.word(), |
|
|
|
|
//后果描述
|
|
|
|
|
consequence:()=>Mock.Random.sentence(3, 5), |
|
|
|
|
//安全状态
|
|
|
|
|
status:()=>Mock.Random.word(), |
|
|
|
|
//安全失效等级
|
|
|
|
|
loseEfficacy:()=>Mock.Random.integer(1,10), |
|
|
|
|
//PID号
|
|
|
|
|
pid:/PID\d{3}/, |
|
|
|
|
//备注
|
|
|
|
|
note:()=>Mock.Random.sentence(3, 5) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return obj |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
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) |
|
|
|
|