|
|
|
@ -174,10 +174,10 @@ export default { |
|
|
|
reconntime:0, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
// 初始化ws 链接 |
|
|
|
|
|
|
|
}, |
|
|
|
// created() { |
|
|
|
// // 初始化ws 链接 |
|
|
|
// this.getsckdata(); |
|
|
|
// }, |
|
|
|
mounted() { |
|
|
|
// 客流趋势 |
|
|
|
this.btgetdata(this.klselt) |
|
|
|
@ -186,12 +186,8 @@ export default { |
|
|
|
//统计日月年进馆总数 |
|
|
|
this.getStat(); |
|
|
|
// |
|
|
|
this.getInfoDatas() |
|
|
|
// 设置websocket定时 |
|
|
|
setInterval(()=>{ |
|
|
|
this.getsckdata(); |
|
|
|
},5000) |
|
|
|
|
|
|
|
// get data in webscoket |
|
|
|
this.getsckdata(); |
|
|
|
|
|
|
|
}, |
|
|
|
// 方法 |
|
|
|
@ -679,43 +675,38 @@ export default { |
|
|
|
// interface |
|
|
|
homeApi.allGcgNumDatas().then(res=>{ |
|
|
|
this.ssjgNumDatas = res.data.returnData |
|
|
|
// |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// |
|
|
|
getsckdata(){ |
|
|
|
// 待删除 |
|
|
|
TPgetsckdata_tcp(){ |
|
|
|
// websocket |
|
|
|
const param ={ |
|
|
|
type:'realTimeData', |
|
|
|
} |
|
|
|
|
|
|
|
const ws = new WebSocket("ws://10.97.121.2/ws"); |
|
|
|
ws.onopen = function() { |
|
|
|
ws.send(JSON.stringify(param)) |
|
|
|
}; |
|
|
|
ws.onmessage = function(e) { |
|
|
|
ws.onmessage = (e)=>{ |
|
|
|
var jstr = JSON.parse(e.data) |
|
|
|
func1(jstr) |
|
|
|
}; |
|
|
|
// |
|
|
|
ws.onclose=function(e){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let func2=function(jstr){ |
|
|
|
const darr = jstr.data; |
|
|
|
this.ssjgNumDatas = darr.data |
|
|
|
console.log("ws_out") |
|
|
|
console.log(this.ssjgNumDatas) |
|
|
|
} |
|
|
|
|
|
|
|
let func1 = func2.bind(this) |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
// udp |
|
|
|
getsckdata(){ |
|
|
|
// websocket |
|
|
|
const ws = new WebSocket("ws://10.97.121.2/rt"); |
|
|
|
ws.onopen = function() { |
|
|
|
console.log("ws connected success!") |
|
|
|
}; |
|
|
|
ws.onmessage = (e)=> { |
|
|
|
var jstr = JSON.parse(e.data) |
|
|
|
this.ssjgNumDatas=jstr.data |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|