You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1 KiB

4 years ago
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')
4 years ago
router.get('/sif/instrumentData', function (req, res, next) {
var data=mock.page(req,'获取仪表失效数据成功',{
//仪表名称/Name
instrumentName:()=>Mock.Random.name(),
//制造商
manufacturer:()=>Mock.Random.name(),
//仪表型号
instrumentModel:()=>Mock.Random.name(),
//数据来源
dataSources:()=>Mock.Random.name(),
//仪表类型
instrumentType:()=>Mock.Random.name(),
//SD
sd:()=>Mock.Random.integer(1,999),
//SU
su:()=>Mock.Random.integer(1,999),
//DD
dd:()=>Mock.Random.integer(1,999),
//DU
du:()=>Mock.Random.integer(1,999),
//架构类型
architectureType:'A',
//TSD
tsd:()=>Mock.Random.integer(1,999),
//MTTR
mttr:()=>Mock.Random.integer(1,999),
//TI
ti:()=>Mock.Random.integer(1,999),
//CTR
ctr:()=>Mock.Random.integer(1,999),
//LT
lt:()=>Mock.Random.integer(1,999),
//HTF
htf:0,
//SIL认证
silCertification:'2/3',
//Route
route:'2H'
})
res.json(data)
})
4 years ago
router.get('/sif/:nodeId/:sifId', 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
4 years ago
let colCount=47
4 years ago
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:{
4 years ago
mergeCell:[],
count:0
4 years ago
}
}
}
})
res.json(data)
})
module.exports=router