parent
e9da9d5b8e
commit
b1e49bc332
@ -0,0 +1,71 @@ |
||||
var express = require('express'); |
||||
var router = express.Router(); |
||||
var mock = require('../../public/javascripts/mock') |
||||
var Mock = require("mockjs") |
||||
var multipart = require('connect-multiparty'); |
||||
var multipartMiddleware = multipart(); |
||||
var moment = require("moment") |
||||
var util=require("../../public/javascripts/util") |
||||
var route=require('../../public/javascripts/route') |
||||
|
||||
//HAZOP分析
|
||||
router.get('/analyse/:id', function (req, res, next) { |
||||
var sst=Mock.mock({ |
||||
"si|1-100":[{ |
||||
t:/\d{3}/ |
||||
}] |
||||
}) |
||||
|
||||
var data=Mock.mock({ |
||||
...mock.ok(`HAZOP分析获取节点${req.params.id}数据成功`), |
||||
...{ |
||||
body:{ |
||||
sst, |
||||
sheetData:{ |
||||
row:function (){ |
||||
let rowCount=20 |
||||
let colCount=18 |
||||
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){ |
||||
rows[row].c.push({ |
||||
r:`${String.fromCharCode(+col+"A".charCodeAt())}${+row+1}`, |
||||
s:1, |
||||
t:'s', |
||||
v:Mock.Random.integer(0,sst.si.length-1) |
||||
}) |
||||
} |
||||
} |
||||
return rows |
||||
} |
||||
}, |
||||
mergeCells:{ |
||||
mergeCell:[], |
||||
count:0 |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
res.json(data) |
||||
}) |
||||
|
||||
route.addContextMenu(router,'analyse/:id','HAZOP分析') |
||||
|
||||
//HAZOP偏差知识库
|
||||
router.get('/analyse/repository/:know', function (req, res, next) { |
||||
var data=mock.page(req,`查询${req.params.know}知识库成功`,{ |
||||
//选项值
|
||||
key: ()=>Mock.Random.integer(1,5), |
||||
//描述
|
||||
value: ()=>Mock.Random.word() |
||||
}) |
||||
res.json(data) |
||||
}) |
||||
|
||||
module.exports=router |
Loading…
Reference in new issue