修改bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-07-19 15:18:30
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-12-28 10:22:06
|
||||
* @LastEditTime: 2023-12-29 15:15:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -557,6 +557,7 @@ export default {
|
||||
mounted() {
|
||||
this.getList()
|
||||
this.initWebSocket()
|
||||
this.SJGInitWebSocket()
|
||||
this.getTimes()
|
||||
const _this = this;
|
||||
_this.beilv2 = document.documentElement.clientWidth / 1920
|
||||
@@ -597,14 +598,14 @@ export default {
|
||||
'get',
|
||||
this.queryParams
|
||||
).then((res) => {
|
||||
console.log('11111', res);
|
||||
// console.log('11111', res);
|
||||
this.productLineList = res.data
|
||||
})
|
||||
this.$axios.get(
|
||||
'base/quality-inspection-record/dayStatistics',
|
||||
'get',
|
||||
).then((res) => {
|
||||
console.log('11111', res);
|
||||
// console.log('11111', res);
|
||||
this.qualityMonthList = res.data
|
||||
})
|
||||
},
|
||||
@@ -639,17 +640,6 @@ export default {
|
||||
const wsUrl = `ws://192.168.0.33:48082/websocket/message?userId=EN${date}`
|
||||
// const wsUrl = 'ws://192.168.1.104:48082/websocket/message?userId=SJG'
|
||||
let date = new Date().valueOf()
|
||||
console.log(date);
|
||||
const SJGWsUrl = `ws://192.168.0.33:48082/websocket/message?userId=SJG${date}`
|
||||
this.SJGWebsocket = new WebSocket(SJGWsUrl)
|
||||
// 监听 WebSocket 连接
|
||||
this.SJGWebsocket.onopen = this.SJGWebsocketOnOpen
|
||||
// 监听 WebSocket 错误信息
|
||||
this.SJGWebsocket.onerror = this.SJGWebsocketOnError
|
||||
// 监听 WebSocket 消息
|
||||
this.SJGWebsocket.onmessage = this.SJGWebsocketOnMessage
|
||||
// 监听 webSocket 断开信息
|
||||
this.SJGWebsocket.onclose = this.SJGWebsocketClose
|
||||
// const wsUrl = 'ws://192.168.0.33:48082/websocket/message?userId=EN111'
|
||||
// 实例化 WebSocket
|
||||
this.websocket = new WebSocket(wsUrl)
|
||||
@@ -663,6 +653,26 @@ export default {
|
||||
this.websocket.onclose = this.websocketClose
|
||||
}
|
||||
},
|
||||
SJGInitWebSocket() {
|
||||
if (typeof (WebSocket) === 'undefined') {
|
||||
alert('您的浏览器不支持WebSocket')
|
||||
} else {
|
||||
// const wsUrl = `ws://192.168.0.33:48082/websocket/message?userId=EN${date}`
|
||||
// const wsUrl = 'ws://192.168.1.104:48082/websocket/message?userId=SJG'
|
||||
let date = new Date().valueOf()
|
||||
// console.log(date);
|
||||
const SJGWsUrl = `ws://192.168.0.33:48082/websocket/message?userId=SJG${date}`
|
||||
this.SJGWebsocket = new WebSocket(SJGWsUrl)
|
||||
// 监听 WebSocket 连接
|
||||
this.SJGWebsocket.onopen = this.SJGWebsocketOnOpen
|
||||
// 监听 WebSocket 错误信息
|
||||
this.SJGWebsocket.onerror = this.SJGWebsocketOnError
|
||||
// 监听 WebSocket 消息
|
||||
this.SJGWebsocket.onmessage = this.SJGWebsocketOnMessage
|
||||
// 监听 webSocket 断开信息
|
||||
this.SJGWebsocket.onclose = this.SJGWebsocketClose
|
||||
}
|
||||
},
|
||||
SJGWebsocketOnOpen() {
|
||||
console.log('socket连接成功')
|
||||
console.log(this.SJGWebsocket.onmessage);
|
||||
@@ -671,16 +681,16 @@ export default {
|
||||
// 连接建立失败重连
|
||||
SJGWebsocketOnError(e) {
|
||||
// console.log('11111', e)
|
||||
this.initWebSocket()
|
||||
this.SJGInitWebSocket()
|
||||
},
|
||||
// 数据接收
|
||||
SJGWebsocketOnMessage(e) {
|
||||
// console.log(1111, e)
|
||||
this.wsData = JSON.parse(e.data)
|
||||
this.SJGWsData = JSON.parse(e.data)
|
||||
// console.log(this.wsData.detData);
|
||||
// console.log('22222', this.wsData.data)
|
||||
if (this.wsData.type === 'order') {
|
||||
this.orderList = this.wsData.detData.map((ele, index) => {
|
||||
if (this.SJGWsData.type === 'order') {
|
||||
this.orderList = this.SJGWsData.detData.map((ele, index) => {
|
||||
if (ele.progressRate != 1) {
|
||||
return {
|
||||
id: ele.id,
|
||||
@@ -690,8 +700,8 @@ export default {
|
||||
}
|
||||
});
|
||||
console.log(this.orderList)
|
||||
} else if (this.wsData.type === 'equipment') {
|
||||
this.equipmentList = this.wsData.detData.map((ele, index) => {
|
||||
} else if (this.SJGWsData.type === 'equipment') {
|
||||
this.equipmentList = this.SJGWsData.detData.map((ele, index) => {
|
||||
// if (ele.progressRate != 1) {
|
||||
return {
|
||||
id: ele.id,
|
||||
@@ -702,16 +712,16 @@ export default {
|
||||
}
|
||||
// }
|
||||
});
|
||||
// console.log(this.orderList)
|
||||
} else if (this.wsData.type === 'productline') {
|
||||
console.log(this.wsData.detData);
|
||||
// console.log(SJGWsData.orderList)
|
||||
} else if (this.SJGWsData.type === 'productline') {
|
||||
// console.log(this.wsData.detData);
|
||||
let nameList = []
|
||||
let passRateList = []
|
||||
let outputNumList = []
|
||||
|
||||
// console.log('2222222222', this.productLineList);
|
||||
this.productLineList.forEach((item) => {
|
||||
this.wsData.detData.forEach((ele) => {
|
||||
this.SJGWsData.detData.forEach((ele) => {
|
||||
if (item.id == ele.productionLineId) {
|
||||
nameList.push(item.name)
|
||||
}
|
||||
@@ -720,11 +730,11 @@ export default {
|
||||
console.log(Array.from(new Set(nameList)))
|
||||
// progressRateList = EnergyNameList
|
||||
// let EnergyDataList = []
|
||||
this.wsData.detData.forEach((ele) => {
|
||||
this.SJGWsData.detData.forEach((ele) => {
|
||||
passRateList.push(ele.passRate *100
|
||||
)
|
||||
})
|
||||
this.wsData.detData.forEach((ele) => {
|
||||
this.SJGWsData.detData.forEach((ele) => {
|
||||
outputNumList.push(ele.outputNum
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user