|
@@ -415,6 +415,8 @@
|
|
deptOptions: [], //任务领取部门列表
|
|
deptOptions: [], //任务领取部门列表
|
|
centerTaskTaskDepts: [], //任务领取部门
|
|
centerTaskTaskDepts: [], //任务领取部门
|
|
deptName: [], //任务领取部门
|
|
deptName: [], //任务领取部门
|
|
|
|
+ wsurl:'',
|
|
|
|
+ postName:'',
|
|
|
|
|
|
taskCount: 0, //任务数量
|
|
taskCount: 0, //任务数量
|
|
taskList: 0, //任务列表
|
|
taskList: 0, //任务列表
|
|
@@ -519,15 +521,20 @@
|
|
this.websockSid.userId=Cookies.get("userId")
|
|
this.websockSid.userId=Cookies.get("userId")
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- initWebSocket(wsurl,userId) { //初始化weosocket
|
|
|
|
- //const wsuri = 'ws://127.0.0.1:10003/eventPush/' + userId + '/' + eventTypeDl + '/' + eventType
|
|
|
|
- const wsuri = wsurl+userId
|
|
|
|
- // const wsuri = 'ws://172.28.20.82:10012/taskPush/'+userId
|
|
|
|
- this.websock = new WebSocket(wsuri)
|
|
|
|
- console.log('建立websocket连接'+wsuri)
|
|
|
|
- this.websock.onopen = this.websocketonopen
|
|
|
|
- this.websock.onmessage = this.websocketonmessage
|
|
|
|
- this.websock.onerror = this.websocketonerror
|
|
|
|
|
|
+ initWebSocket(wsurl,postName,userId) {
|
|
|
|
+ this.postName=postName
|
|
|
|
+ this.wsurl=wsurl
|
|
|
|
+ selectConfigKey(wsurl).then(res => {
|
|
|
|
+ //初始化weosocket
|
|
|
|
+ //const wsuri = 'ws://127.0.0.1:10003/eventPush/' + userId + '/' + eventTypeDl + '/' + eventType
|
|
|
|
+ const wsuri = res.data + userId +postName+ userId
|
|
|
|
+ // const wsuri = 'ws://172.28.20.82:10012/taskPush/'+userId
|
|
|
|
+ this.websock = new WebSocket(wsuri)
|
|
|
|
+ //console.log('建立websocket连接' + wsuri)
|
|
|
|
+ this.websock.onopen = this.websocketonopen
|
|
|
|
+ this.websock.onmessage = this.websocketonmessage
|
|
|
|
+ this.websock.onerror = this.websocketonerror
|
|
|
|
+ })
|
|
},
|
|
},
|
|
websocketonopen() { //连接建立之后执行send方法发送数据
|
|
websocketonopen() { //连接建立之后执行send方法发送数据
|
|
console.log('websocket连接成功')
|
|
console.log('websocket连接成功')
|
|
@@ -535,7 +542,7 @@
|
|
this.sendPing()
|
|
this.sendPing()
|
|
},
|
|
},
|
|
websocketonerror() { //连接建立失败重连
|
|
websocketonerror() { //连接建立失败重连
|
|
- this.initWebSocket(this.wsuri,this.websockSid.userId)
|
|
|
|
|
|
+ this.initWebSocket(this.wsurl,this.postName,this.websockSid.userId)
|
|
},
|
|
},
|
|
websocketonmessage(e) { //数据接收
|
|
websocketonmessage(e) { //数据接收
|
|
console.log('接收数据', e.data)
|
|
console.log('接收数据', e.data)
|
|
@@ -797,7 +804,7 @@
|
|
this.taskList = res.data
|
|
this.taskList = res.data
|
|
this.taskCount = res.data.length
|
|
this.taskCount = res.data.length
|
|
})
|
|
})
|
|
- this.initWebSocket(this.wsuri2,this.websockSid.userId)
|
|
|
|
|
|
+ this.initWebSocket('MESSAGE_SOCKET','/messagePush/',this.websockSid.userId)
|
|
},
|
|
},
|
|
|
|
|
|
selectMessageById(id) {
|
|
selectMessageById(id) {
|
|
@@ -805,7 +812,7 @@
|
|
/** 获取消息列表 */
|
|
/** 获取消息列表 */
|
|
this.selectMessageList();
|
|
this.selectMessageList();
|
|
});
|
|
});
|
|
- this.initWebSocket(this.wsuri,this.websockSid.userId)
|
|
|
|
|
|
+ this.initWebSocket('TASK_SOCKET','/taskPush/',this.websockSid.userId)
|
|
},
|
|
},
|
|
/** 获取消息列表 */
|
|
/** 获取消息列表 */
|
|
selectMessageList(){
|
|
selectMessageList(){
|