|
@@ -54,64 +54,17 @@ export default {
|
|
|
withoutAnimation: this.sidebar.withoutAnimation,
|
|
|
mobile: this.device === 'mobile'
|
|
|
}
|
|
|
- },
|
|
|
- websocketMsg() {
|
|
|
- return this.$store.getters.STAFF_UPDATE.msg
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
- websocketMsg(curVal, oldVal) {
|
|
|
- let obj = JSON.parse(curVal)
|
|
|
- this.openMessageTips(obj)
|
|
|
- }
|
|
|
},
|
|
|
mounted() {
|
|
|
- // 判断长连接,是否已经开启
|
|
|
- if(this.$store.state.websocket.websock == null){
|
|
|
- // 页面刚进入时开启长连接
|
|
|
- this.$store.dispatch('STAFF_WEBSOCKET')
|
|
|
- }
|
|
|
- },
|
|
|
- // 销毁
|
|
|
- destroyed() {
|
|
|
- this.websocketClose()
|
|
|
- },
|
|
|
+
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleClickOutside() {
|
|
|
this.$store.commit('setting/closeSidebar', { withoutAnimation: false })
|
|
|
- },
|
|
|
- openMessageTips(data){ //排除数字大屏
|
|
|
- if(this.$route.fullPath.indexOf("/largeScreen")<0){
|
|
|
- //console.log("接收websocket的推送信息 == ", data)
|
|
|
- if(data!=null && data.type == 'PUSH_TYPE_GLOBAL_EXCEPTION'){
|
|
|
- this.$nextTick(()=> {
|
|
|
- let datas = data.data.warnMap.warnData.records
|
|
|
- datas.forEach((data)=>{
|
|
|
- let msg = data.feedback ? data.feedback : " 响应超时 ";
|
|
|
- //let url = data.taskNodeId ? "#/dispatchMgr/exception":"#/developer/warnLong";
|
|
|
- let url = "#/developer/warnLong"
|
|
|
- let content = "<a href='"+url+"'>"+(data.resourceName? "["+ data.resourceName +"] " : "" )+(data.procedureName? data.procedureName : "")
|
|
|
- + (data.instructionName? "("+data.instructionName+")" : "") + msg+"</a>";
|
|
|
- this.$notification.error(content, { messageIsHTML: true, timer:10, title:"异常警报", showCloseIcn:true });
|
|
|
- })
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 组件销毁的时候,关闭websocket连接
|
|
|
- websocketClose() {
|
|
|
- this.$store.getters.STAFF_UPDATE.lockReconnect = true
|
|
|
- this.$store.getters.STAFF_UPDATE.websock.close() // 离开路由之后断开websocket连接
|
|
|
- clearTimeout(this.$store.getters.STAFF_UPDATE.reconnectData) // 离开清除 timeout
|
|
|
- clearTimeout(this.$store.getters.STAFF_UPDATE.timeoutObj) // 离开清除 timeout
|
|
|
- clearTimeout(this.$store.getters.STAFF_UPDATE.serverTimeoutObj) // 离开清除 timeout
|
|
|
- },
|
|
|
- // websocket信息变更
|
|
|
- onmessage() {
|
|
|
- this.$store.getters.STAFF_UPDATE.websock.onmessage = function(evt) {
|
|
|
- console.log("websocket获取数据==="+evt)
|
|
|
- }
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|