| | |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const sendRecords = ref([]); |
| | | const machineId=12;//当前页面的设备ID |
| | | |
| | | const userInfo=JSON.parse(window.localStorage.getItem('userInfo')); |
| | | const pageParams=userInfo.user.menus[0].pages[3].params; |
| | | const pageParamsJson=JSON.parse(pageParams); |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | console.log(machineId); |
| | | //const machineId=12;//当前页面的设备ID |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/marking`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | sendRecords.value = data.sendRecords[0]; |
| | | let dataJson = data[""+machineId][0]; |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0]; |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |