|
@@ -187,6 +187,7 @@ import TVWall from '@/components/TVWall.vue' //电视墙弹窗
|
|
|
import eventdetailsdialog from '@/views/eventdetailsdialog.vue' //事件详情弹窗
|
|
|
import firespread from '@/views/firespread.vue' //事件详情弹窗
|
|
|
|
|
|
+import {selectConfigKey} from "@/api/system/config";
|
|
|
let echarts = require('echarts')
|
|
|
export default {
|
|
|
components: {
|
|
@@ -216,12 +217,7 @@ export default {
|
|
|
/** ----------------------------------weosocket开始------------------------------------- */
|
|
|
// this.initWebSocket()
|
|
|
/** ----------------------------------weosocket结束------------------------------------- */
|
|
|
- setInterval(() => {
|
|
|
- if (this.calendarDay == this.getCurrentDataStr()) {
|
|
|
- // this.getEventList(this.getCurrentDataStr(),this.bigEventTypeId,this.smallEventTypeId,this.pageSize,this.pageNum,this.eventSearch,true);//day, bigEventTypeId,smallEventTypeId, pageSize, pageNum, eventSearch, loading
|
|
|
- this.getEventByEventType(this.getCurrentDataStr(), true);
|
|
|
- }
|
|
|
- }, 3000)
|
|
|
+
|
|
|
this.bottomMenuList() //获取底部公共组件消息和任务
|
|
|
},
|
|
|
data() {
|
|
@@ -720,14 +716,14 @@ export default {
|
|
|
},
|
|
|
/** ----------------------------------weosocket开始------------------------------------- */
|
|
|
initWebSocket(userId, eventTypeDl, eventType) { //初始化weosocket
|
|
|
- const wsuri = 'ws://127.0.0.1:10003/eventPush/' + userId + '/' + eventTypeDl + '/' + eventType
|
|
|
- this.websock = new WebSocket(wsuri)
|
|
|
- console.log('建立websocket连接')
|
|
|
- this.websock.onopen = this.websocketonopen
|
|
|
- this.websock.onmessage = this.websocketonmessage
|
|
|
- this.websock.onerror = this.websocketonerror
|
|
|
- this.websock.onclose = this.websocketclose
|
|
|
- this.websock.onclose = this.websocketclose
|
|
|
+ selectConfigKey('KSH_SOCKET').then(res => {
|
|
|
+ const wsuri = res.data + userId + '/' + eventTypeDl + '/' + eventType
|
|
|
+ this.websock = new WebSocket(wsuri)
|
|
|
+ console.log('建立websocket连接')
|
|
|
+ this.websock.onopen = this.websocketonopen
|
|
|
+ this.websock.onmessage = this.websocketonmessage
|
|
|
+ this.websock.onerror = this.websocketonerror
|
|
|
+ })
|
|
|
},
|
|
|
websocketonopen() { //连接建立之后执行send方法发送数据
|
|
|
console.log('websocket连接成功')
|
|
@@ -740,19 +736,15 @@ export default {
|
|
|
websocketonmessage(e) { //数据接收
|
|
|
console.log('接收数据', e.data)
|
|
|
// let data = "{\"fromId\":\"forest\",\"fromUserId\":\""+Cookies.get('username')+"\",\"toUserId\":\""+Cookies.get('username')+"\"}";
|
|
|
- let data = "{\"fromId\":\"forest\",\"fromUserId\":\"admin\",\"toUserId\":\"admin\"}";
|
|
|
+ let data = "{\"fromId\":\"village\"}";
|
|
|
if (this.calendarDay == this.getCurrentDataStr() && data != e.data) {
|
|
|
// 处理收到的消息
|
|
|
this.handleWebSoceketEvent(e.data)
|
|
|
|
|
|
- // this.getEventListNew();
|
|
|
- // this.getTodayEvents(this.getCurrentDataStr());
|
|
|
- // this.getDeptEventCount(this.getCurrentDataStr());
|
|
|
- // this.getEventByEventType(this.getCurrentDataStr());
|
|
|
- // this.getEventByReportorOrder(this.getCurrentDataStr());
|
|
|
+ this.getEventByEventType(this.getCurrentDataStr(), true);
|
|
|
|
|
|
- // this.$refs.bottomMenu.updateAlert();
|
|
|
- // this.$refs.up.play();
|
|
|
+ this.$refs.bottomMenu.updateAlert();
|
|
|
+ this.$refs.up.play();
|
|
|
// thes.$refs.up.pause();//停止播放音乐
|
|
|
}
|
|
|
},
|
|
@@ -792,9 +784,7 @@ export default {
|
|
|
* @param {string} ping 心跳名称 默认字符串ping
|
|
|
*/
|
|
|
sendPing(time = 5000, ping = {
|
|
|
- 'fromId': 'forest',
|
|
|
- 'fromUserId': Cookies.get('username'),
|
|
|
- 'toUserId': Cookies.get('username')
|
|
|
+ 'fromId': 'village'
|
|
|
}) {
|
|
|
clearInterval(this.setIntervalWesocketPush)
|
|
|
this.websock.send(JSON.stringify(ping))
|