3 changed files with 81 additions and 2 deletions
@ -0,0 +1,67 @@ |
|||
import express from "express"; |
|||
import { delay } from "../utils/helper"; |
|||
import { wsSend } from "../utils/wss"; |
|||
const router = express.Router(); |
|||
|
|||
router.post("/list", async (req, res) => { |
|||
await delay(100); |
|||
wsSend(req.app.locals["wss"], { |
|||
messageType: "STATE", |
|||
data: { |
|||
isConnect: true, |
|||
"connectPort": "COM4",//串口名
|
|||
"sn": "",//连接的设备ID
|
|||
"descriptivePortName": "COM4 serial ch340" //用于详细系
|
|||
}, |
|||
path: "/subdevice/uartchanel/get-channel-state", |
|||
}); |
|||
|
|||
res.json({ |
|||
status: 0 , |
|||
data:{ |
|||
list:[{ |
|||
"id": 27033,//数据主键id
|
|||
"createTime": "2025-03-03 17:05:34",//数据创建时间
|
|||
"updateTime": "2025-03-03 17:05:34",//数据修改时间
|
|||
"uuid": "650fc0a3-8bb2-4223-973e-72846fd31b82",//数据uuid
|
|||
"operatorName": "张三",//操作员姓名
|
|||
"trackShapeCode": "001",//轨型code
|
|||
"verificationMethodCode": "aaa",//核校方式code
|
|||
"name": "京沪铁路12",//测量名称
|
|||
"lineName": "河北段",//线路名称
|
|||
"location": "100米处",//位置
|
|||
"direction": "左"///方向
|
|||
},{ |
|||
"id": 27044,//数据主键id
|
|||
"createTime": "2025-03-03 17:05:34",//数据创建时间
|
|||
"updateTime": "2025-03-03 17:05:34",//数据修改时间
|
|||
"uuid": "650fc0a3-8bb2-4223-973e-72846fd31b83",//数据uuid
|
|||
"operatorName": "李四",//操作员姓名
|
|||
"trackShapeCode": "002",//轨型code
|
|||
"verificationMethodCode": "bbb",//核校方式code
|
|||
"name": "京昆铁路",//测量名称
|
|||
"lineName": "河北段",//线路名称
|
|||
"location": "5100米处",//位置
|
|||
"direction": "右"///方向
|
|||
}] |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
router.post("/getDevice", async (req, res) => { |
|||
res.json({ |
|||
status: 0 , |
|||
data:{ |
|||
list:[{ |
|||
name:'Kdkow_1', |
|||
id:'1', |
|||
},{ |
|||
name:'llwoa_2', |
|||
id:'2', |
|||
}] |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
|
|||
export default router |
Write
Preview
Loading…
Cancel
Save
Reference in new issue