|
|
|
@ -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({ |
|
|
|
|