Sfoglia il codice sorgente

websocket相关调整

cfort 2 anni fa
parent
commit
3ce5ba69d5

+ 46 - 44
src/api/baseUrl.js

@@ -1,117 +1,119 @@
 import store from '@/store'
-import { BASE_API as baseApi,
-  BASE_GATEWAY_API as gatewayApi,
-  BASE_WEBSOCKET as baseWebsocket,
-  SINGLE, MULTIPLE_DOMAIN, API_DOMAIN_NAMES } from '@/constant'
+import {
+    BASE_API as baseApi,
+    BASE_GATEWAY_API as gatewayApi,
+    BASE_WEBSOCKET as baseWebsocket,
+    SINGLE, MULTIPLE_DOMAIN, API_DOMAIN_NAMES
+} from '@/constant'
 
 export const SINGLE_APP = () => {
-  if (!store || typeof (store.getters.single) === 'undefined') {
-    return SINGLE
-  }
-  return store.getters.single
+    if (!store || typeof (store.getters.single) === 'undefined') {
+        return SINGLE
+    }
+    return store.getters.single
 }
 
 const getApi = (api, i) => {
-  if (i === null || i === undefined) {
-    i = 0
-  }
-  const domainName = API_DOMAIN_NAMES[i] || API_DOMAIN_NAMES[0] || ''
+    if (i === null || i === undefined) {
+        i = 0
+    }
+    const domainName = API_DOMAIN_NAMES[i] || API_DOMAIN_NAMES[0] || ''
 
-  return api.replace('{DOMAIN}', domainName)
+    return api.replace('{DOMAIN}', domainName)
 }
 
 // 默认url
-export const BASE_API = function(i) {
-  const api = store && store.getters.baseApi ? store.getters.baseApi : baseApi
-  return MULTIPLE_DOMAIN ? getApi(api, i) : api
+export const BASE_API = function (i) {
+    const api = store && store.getters.baseApi ? store.getters.baseApi : baseApi
+    return MULTIPLE_DOMAIN ? getApi(api, i) : api
 }
 // 网关API 解决上传乱码问题
-export const BASE_GATEWAY_API = function(i) {
-  const api = store && store.getters.baseApi ? store.getters.baseApi : gatewayApi
-  return MULTIPLE_DOMAIN ? getApi(api, i) : api
+export const BASE_GATEWAY_API = function (i) {
+    const api = store && store.getters.baseApi ? store.getters.baseApi : gatewayApi
+    return MULTIPLE_DOMAIN ? getApi(api, i) : api
 }
 // websocket地址
 export const BASE_WEBSOCKET_API = (i) => {
-  const api = store && store.getters.websocket ? store.getters.websocket : baseWebsocket
-  return MULTIPLE_DOMAIN ? getApi(api, i) : api
+    const api = store && store.getters.websocket ? store.getters.websocket : baseWebsocket
+    return MULTIPLE_DOMAIN ? getApi(api, i) : api
 }
 export const OAUTH2_BASE_URL = () => {
-  return SINGLE_APP() ? '' : '/oauth2/v3'
+    return SINGLE_APP() ? '' : '/oauth2/v3'
 }
 export const PLATFORM_BASE_URL = () => {
-  return SINGLE_APP() ? '' : '/platform/v3'
+    return SINGLE_APP() ? '' : '/platform/v3'
 }
 
 export const BUSINESS_BASE_URL = () => {
-  return SINGLE_APP() ? '' : '/business/v3'
+    return SINGLE_APP() ? '' : '/business/v3'
 }
 
 // ========== business=================
 
 export const OAUTH2_URL = () => {
-  return OAUTH2_BASE_URL()
+    return OAUTH2_BASE_URL()
 }
 // ========== business=================
 export const FORM_URL = () => {
-  return BUSINESS_BASE_URL()
+    return BUSINESS_BASE_URL()
 }
 
 export const BPMN_URL = () => {
-  return BUSINESS_BASE_URL()
+    return BUSINESS_BASE_URL()
 }
 export const DATA_URL = () => {
-  return BUSINESS_BASE_URL()
+    return BUSINESS_BASE_URL()
 }
 export const CODEGEN_URL = () => {
-  return BUSINESS_BASE_URL()
+    return BUSINESS_BASE_URL()
 }
 
 // ========== PLATFORM_BASE_URL=================
 export const PLATFORM_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const ORG_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const AUTH_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const SAAS_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const CAT_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const JOB_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const SYSTEM_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const LOG_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const MSG_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const MAIL_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const OFFICE_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const SERV_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 
 export const DS_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 export const INFO_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 
 export const SOCKET_URL = () => {
-  return PLATFORM_BASE_URL()
+    return PLATFORM_BASE_URL()
 }
 

+ 3 - 4
src/business/platform/data/templaterender/templates/list.vue

@@ -878,7 +878,7 @@ export default {
             this.addDataCont = {}
         },
         /* 流程页面关闭,刷新当前页面*/
-        loadFlowFData (v,temp) {
+        loadFlowFData (v, temp) {
             this.npmDialogFormVisible = false
             this.addDataCont = {}
             this.dataTemplate = temp
@@ -1750,7 +1750,6 @@ export default {
                     editToolbars.push(btn)
                 }
             })
-            
             this.editToolbars = editToolbars
             this.pkValue = pkValue || ''
             this.afterScript(action, position, pkValue, data, () => {
@@ -1889,7 +1888,7 @@ export default {
              * 数据模板脚本里打开的对话框列表,不需要执行本模块代码,否则会执行到底层列表的onload脚本:洗眼器
              * 但是在表单页面打开对话框的时候需要执行本模块代码:考试管理对话框
              */
-            if (this.dataTemplate.type == 'default' || (this.dataTemplate.type == 'dialog'&& !this.tempSearch) || this.tempSearch) {
+            if (this.dataTemplate.type === 'default' || (this.dataTemplate.type === 'dialog' && !this.tempSearch) || this.tempSearch) {
                 JTemplate._onLoad(this)
             }
         },
@@ -1924,7 +1923,7 @@ export default {
             this.templateDialogVisible = visible
             this.initJTemplate()
         },
-        closeDataTemplateFormrenderDialog(visible,temp){
+        closeDataTemplateFormrenderDialog (visible, temp) {
             this.dialogFormVisible = visible
             this.dataTemplate = temp
             this.initJTemplate()

+ 3 - 1
src/business/platform/form/formrender/dynamic-form/dynamic-form-table.vue

@@ -454,7 +454,9 @@ export default {
                 // if (!valueEquals(val, oldVal)) {
                 //     this.dispatch('ElFormItem', 'el.form.change', val)
                 // }
-            }
+            },
+            deep: true,
+            immediate: true
         },
         dataModel: {
             handler (val, oldVal) {

+ 43 - 49
src/business/platform/socket/notify-monitor/index.vue

@@ -1,10 +1,7 @@
 <template>
-  <div>
-    <script
-      ref="script"
-      type="text/plain"
-    />
-  </div>
+    <div v-html="scriptContent">
+        <!-- <script ref="script" type="text/plain" /> -->
+    </div>
 </template>
 
 <script>
@@ -14,50 +11,47 @@ import { getToken } from '@/api/platform/socket/push'
 import { downloadUrl } from '@/api/platform/file/attachment'
 import WS_SDK from '@/components/ibps-websocket/ws_sdk'
 export default {
-  name: 'ibps-notify-monitor',
-  data() {
-    return {
-      ws: {}
-    }
-  },
-  created() {
-    enabled().then((enabledRes) => {
-      this.initWS(enabledRes.data)
-    }).catch((e) => {
-      this.initWS(false)
-    })
-  },
-  methods: {
-    initWS(enabled) {
-      getToken({ userId: this.$store.getters.userId }).then((res) => {
-        this.ws = new WS_SDK(
-          BASE_WEBSOCKET_API() + '/' + res.data,
-          (message) => {
-            this.$store.dispatch('ibps/message/set', true).then(() => {
-              console.info('收到一条推送')
-            })
-            const expandMap = message.getExpandMap()
-            let messageBody = ''
-            if (message.getMsgtype() === 'file') {
-              const url = downloadUrl({
-                attachmentId: expandMap.get('storageId')
-              })
-              messageBody = `<a href="${url}">${message.getMsgbody()}</a>`
-            } else {
-              messageBody = message.getMsgbody() || ''
-            }
-            this.$notify({
-              title: expandMap.get('title') || '提示',
-              message: messageBody,
-              type: expandMap.get('style') || 'success',
-              position: expandMap.get('position') || 'top-left',
-              duration: expandMap.get('duration') || 5 * 1000
+    name: 'ibps-notify-monitor',
+    data () {
+        return {
+            ws: {},
+            scriptContent: `<script ref="script" type="text/plain" />`
+        }
+    },
+    created () {
+        enabled().then((enabledRes) => {
+            this.initWS(enabledRes.data)
+        }).catch((e) => {
+            this.initWS(false)
+        })
+    },
+    methods: {
+        initWS (enabled) {
+            getToken({ userId: this.$store.getters.userId }).then((res) => {
+                this.ws = new WS_SDK(BASE_WEBSOCKET_API() + '/' + res.data, (message) => {
+                    this.$store.dispatch('ibps/message/set', true).then(() => {
+                        console.info('收到一条推送')
+                    })
+                    const expandMap = message.getExpandMap()
+                    let messageBody = ''
+                    if (message.getMsgtype() === 'file') {
+                        const url = downloadUrl({
+                            attachmentId: expandMap.get('storageId')
+                        })
+                        messageBody = `<a href="${url}">${message.getMsgbody()}</a>`
+                    } else {
+                        messageBody = message.getMsgbody() || ''
+                    }
+                    this.$notify({
+                        title: expandMap.get('title') || '提示',
+                        message: messageBody,
+                        type: expandMap.get('style') || 'success',
+                        position: expandMap.get('position') || 'top-left',
+                        duration: expandMap.get('duration') || 5 * 1000
+                    })
+                }, true, enabled)
             })
-          },
-          true,
-          enabled/* 请求platform/v3/socket/enabled */)
-      })
+        }
     }
-  }
 }
 </script>

+ 211 - 210
src/components/ibps-websocket/ws_sdk.js

@@ -2,242 +2,243 @@
 import Long from 'long'
 import proto from './IMDataProto'
 var configure = {
-  heartbeatTimer: 1500, // 心跳定时器
-  timeoutTimer: null, // 超时定时器
-  heartbeatMS: 3000, // 心跳时间
-  timeoutMS: 30000, // 超时时间
-  reconnectNum: 0, // 重连次数
-  reconnectMaxNum: 20, // 最大重连次数
-  reconnectMS: 1000, // 重连 毫秒 (梯度)
-  allowAccess: true // 是否允许访问
+    heartbeatTimer: 1500, // 心跳定时器
+    timeoutTimer: null, // 超时定时器
+    heartbeatMS: 3000, // 心跳时间
+    timeoutMS: 30000, // 超时时间
+    reconnectNum: 0, // 重连次数
+    reconnectMaxNum: 20, // 最大重连次数
+    reconnectMS: 1000, // 重连 毫秒 (梯度)
+    allowAccess: true // 是否允许访问
 }
-var WS_SDK = window.WS_SDK = function(url, msgCallBackFunc, isReconnect, isEnabled) {
-  if (!window.WebSocket) {
-    window.WebSocket = window.MozWebSocket
-  }
-  if (!window.WebSocket) {
-    alert('抱歉,您的浏览器不支持WebSocket协议!')
-    return
-  }
-  if (WS_SDK._CONS_ && WS_SDK._CONS_.WEB_SOCKET && url === WS_SDK._CONS_.URL) {
-    WS_SDK.close()
-  }
-  WS_SDK._init_(url, msgCallBackFunc, isReconnect)
-  WS_SDK.initWebSocket()
-  WS_SDK.self = this
+var WS_SDK = window.WS_SDK = function (url, msgCallBackFunc, isReconnect, isEnabled) {
+    if (!window.WebSocket) {
+        window.WebSocket = window.MozWebSocket
+    }
+    if (!window.WebSocket) {
+        alert('抱歉,您的浏览器不支持WebSocket协议!')
+        return
+    }
+    if (WS_SDK._CONS_ && WS_SDK._CONS_.WEB_SOCKET && url === WS_SDK._CONS_.URL) {
+        WS_SDK.close()
+    }
+    WS_SDK._init_(url, msgCallBackFunc, isReconnect)
+    WS_SDK.initWebSocket()
+    WS_SDK.self = this
 }
 WS_SDK.self = {}
-WS_SDK._init_ = function(url, msgCallBackFunc, isReconnect, isEnabled) {
-  this._CONS_ = {
-    ENABELED: isEnabled || false, // socket 服务器地址
-    URL: url, // socket 服务器地址
-    WEB_SOCKET: null, // websocket 对象
-    msgCallBackFunc: msgCallBackFunc,
-    isReconnect: isReconnect || true, // 是否自动重连
-    EVENT_TYPE: { // 事件类型
-      open: 'open', // 通道打开
-      message: 'message', // 服务端消息接收
-      close: 'close', // 通道关闭
-      error: 'error' // 消息异常
+WS_SDK._init_ = function (url, msgCallBackFunc, isReconnect, isEnabled) {
+    this._CONS_ = {
+        ENABELED: isEnabled || false, // socket 服务器地址
+        URL: url, // socket 服务器地址
+        WEB_SOCKET: null, // websocket 对象
+        msgCallBackFunc: msgCallBackFunc,
+        isReconnect: isReconnect || true, // 是否自动重连
+        EVENT_TYPE: { // 事件类型
+            open: 'open', // 通道打开
+            message: 'message', // 服务端消息接收
+            close: 'close', // 通道关闭
+            error: 'error' // 消息异常
+        }
     }
-  }
-}
-WS_SDK.handle = function(eventType, event, msg) {
-  try {
-    this._CONS_.handleFunc(eventType, event, msg)
-  } catch (e) {
-    console.error('业务处理回调方法异常:')
-    console.error(e)
-  }
 }
-
-WS_SDK.ping = function() {
-  var imdata = new proto.IMData()
-  imdata.setType(4)
-  imdata.setTimestamp(new Date().getTime())
-  if (WS_SDK._CONS_.WEB_SOCKET.readyState === 1 || WS_SDK._CONS_.WEB_SOCKET.readyState === WebSocket.OPEN) {
-    WS_SDK._CONS_.WEB_SOCKET.send(imdata.serializeBinary())
-  } else {
-    console.error('ping fail')
-  }
-  // eslint-disable-next-line no-implied-eval
-  window.setTimeout('WS_SDK.ping()', configure.heartbeatMS)
-}
-WS_SDK.initWebSocket = function() {
-  var self = this
-  // 重连
-  function reconnect() {
-    WS_SDK._CONS_.WEB_SOCKET.close()
-    if (self._CONS_.isReconnect) {
-      connect()
-      configure.timeoutTimer = null
+WS_SDK.handle = function (eventType, event, msg) {
+    try {
+        this._CONS_.handleFunc(eventType, event, msg)
+    } catch (e) {
+        console.error('业务处理回调方法异常:')
+        console.error(e)
     }
-    console.debug('重连--------------')
-    console.debug(configure)
-    console.debug('重连--------------')
-  }
+}
 
-  // 设置长时间无通信处理定时器
-  function setTimeoutTimer(timerTime) {
-    if (configure.timeoutTimer) {
-      clearTimeout(configure.timeoutTimer)
+WS_SDK.ping = function () {
+    var imdata = new proto.IMData()
+    imdata.setType(4)
+    imdata.setTimestamp(new Date().getTime())
+    if (WS_SDK._CONS_.WEB_SOCKET.readyState === 1 || WS_SDK._CONS_.WEB_SOCKET.readyState === WebSocket.OPEN) {
+        WS_SDK._CONS_.WEB_SOCKET.send(imdata.serializeBinary())
+    } else {
+        console.error('ping fail')
     }
-    configure.timeoutTimer = setTimeout(function() {
-      configure.timeoutTimer = null
-      reconnect()
-    }, timerTime)
-  }
-
-  // 设置心跳定时器
-  function setTeartbeatTimer() {
     // eslint-disable-next-line no-implied-eval
     window.setTimeout('WS_SDK.ping()', configure.heartbeatMS)
-  }
+}
+WS_SDK.initWebSocket = function () {
+    var self = this
+    // 重连
+    function reconnect () {
+        WS_SDK._CONS_.WEB_SOCKET.close()
+        if (self._CONS_.isReconnect) {
+            connect()
+            configure.timeoutTimer = null
+        }
+        console.debug('重连--------------')
+        console.debug(configure)
+        console.debug('重连--------------')
+    }
 
-  // 异常重连
-  function errorReconnect() {
-    if (!configure.timeoutTimer) {
-      if (configure.reconnectNum < configure.reconnectMaxNum) {
-        configure.reconnectNum = configure.reconnectNum + 1
-        configure.timeoutTimer = setTimeoutTimer(configure.reconnectMS)
-      } else {
-        console.error('无法连接请稍后再试')
-      }
+    // 设置长时间无通信处理定时器
+    function setTimeoutTimer (timerTime) {
+        if (configure.timeoutTimer) {
+            clearTimeout(configure.timeoutTimer)
+        }
+        configure.timeoutTimer = setTimeout(function () {
+            configure.timeoutTimer = null
+            reconnect()
+        }, timerTime)
     }
-  }
 
-  // 连接
-  function connect() {
-    if (self._CONS_.ENABELED !== true) {
-      return
+    // 设置心跳定时器
+    function setTeartbeatTimer () {
+        // eslint-disable-next-line no-implied-eval
+        window.setTimeout('WS_SDK.ping()', configure.heartbeatMS)
     }
-    if ('WebSocket' in window) {
-      self._CONS_.WEB_SOCKET = new WebSocket(self._CONS_.URL)
-    } else if ('MozWebSocket' in window) {
-      self._CONS_.WEB_SOCKET = new window.MozWebSocket(self._CONS_.URL)
+
+    // 异常重连
+    function errorReconnect () {
+        if (!configure.timeoutTimer) {
+            if (configure.reconnectNum < configure.reconnectMaxNum) {
+                configure.reconnectNum = configure.reconnectNum + 1
+                configure.timeoutTimer = setTimeoutTimer(configure.reconnectMS)
+            } else {
+                console.error('无法连接请稍后再试')
+            }
+        }
     }
-    // 消息接收监听
-    WS_SDK._CONS_.WEB_SOCKET.onmessage = function(event) {
-      var reader = new FileReader()
-      reader.readAsArrayBuffer(event.data)
-      reader.onload = function(e) {
-        var buf = new Uint8Array(reader.result)
-        var imData = proto.IMData.deserializeBinary(buf)
-        if (imData === undefined) {
-          console.info('错误的消息')
+
+    // 连接
+    function connect () {
+        if (self._CONS_.ENABELED !== true) {
+            console.log('连接已关闭')
+            return
         }
-        if (imData.getType() === 4) {
-          console.info('收到心跳响应')
-          return
+        if ('WebSocket' in window) {
+            self._CONS_.WEB_SOCKET = new WebSocket(self._CONS_.URL)
+        } else if ('MozWebSocket' in window) {
+            self._CONS_.WEB_SOCKET = new window.MozWebSocket(self._CONS_.URL)
         }
-        if (imData.getType() === 1) {
-          var initData = imData.getInitdata()
-          configure.allowAccess = initData.getAllowaccess()
-          if (!configure.allowAccess) {
-            WS_SDK._CONS_.WEB_SOCKET.close()
-            console.info('非法连接!!!')
-            return
-          }
+        // 消息接收监听
+        WS_SDK._CONS_.WEB_SOCKET.onmessage = function (event) {
+            var reader = new FileReader()
+            reader.readAsArrayBuffer(event.data)
+            reader.onload = function (e) {
+                var buf = new Uint8Array(reader.result)
+                var imData = proto.IMData.deserializeBinary(buf)
+                if (imData === undefined) {
+                    console.info('错误的消息')
+                }
+                if (imData.getType() === 4) {
+                    console.info('收到心跳响应')
+                    return
+                }
+                if (imData.getType() === 1) {
+                    var initData = imData.getInitdata()
+                    configure.allowAccess = initData.getAllowaccess()
+                    if (!configure.allowAccess) {
+                        WS_SDK._CONS_.WEB_SOCKET.close()
+                        console.info('非法连接!!!')
+                        return
+                    }
 
-          configure.heartbeatMS = initData.getHeartbeatms()
-          configure.timeoutMS = initData.getTimeoutms()
-          configure.reconnectMaxNum = initData.getReconnectmaxnum()
-          configure.reconnectMS = initData.getReconnectms()
-          setTeartbeatTimer()
-          return
+                    configure.heartbeatMS = initData.getHeartbeatms()
+                    configure.timeoutMS = initData.getTimeoutms()
+                    configure.reconnectMaxNum = initData.getReconnectmaxnum()
+                    configure.reconnectMS = initData.getReconnectms()
+                    setTeartbeatTimer()
+                    return
+                }
+                // TODO: 消息防丢处理
+                if (imData.getType() === 3) {
+                    return
+                }
+                if (imData.getType() === 2) {
+                    WS_SDK._CONS_.msgCallBackFunc(imData.getMsgdata())
+                    var imdataResponse = new proto.IMData()
+                    imdataResponse.setId(imData.getId())
+                    imdataResponse.setType(3)
+                    WS_SDK._CONS_.WEB_SOCKET.send(imdataResponse.serializeBinary())
+                }
+            }
         }
-        // TODO: 消息防丢处理
-        if (imData.getType() === 3) {
-          return
+        // 通道开启事件
+        WS_SDK._CONS_.WEB_SOCKET.onopen = function (event) {
+            console.debug('开启--------------')
+            console.debug(configure)
+            console.debug(event)
+            console.debug('开启--------------')
         }
-        if (imData.getType() === 2) {
-          WS_SDK._CONS_.msgCallBackFunc(imData.getMsgdata())
-          var imdataResponse = new proto.IMData()
-          imdataResponse.setId(imData.getId())
-          imdataResponse.setType(3)
-          WS_SDK._CONS_.WEB_SOCKET.send(imdataResponse.serializeBinary())
+        // 关闭事件
+        WS_SDK._CONS_.WEB_SOCKET.onclose = function (event) {
+            console.debug('关闭--------------')
+            clearTimeout(configure.heartbeatTimer)
+            if (configure.allowAccess) {
+                errorReconnect()
+            }
+        }
+        // 异常事件
+        WS_SDK._CONS_.WEB_SOCKET.error = function (event) {
+            if (configure.allowAccess) {
+                errorReconnect()
+            }
         }
-      }
-    }
-    // 通道开启事件
-    WS_SDK._CONS_.WEB_SOCKET.onopen = function(event) {
-      console.debug('开启--------------')
-      console.debug(configure)
-      console.debug(event)
-      console.debug('开启--------------')
-    }
-    // 关闭事件
-    WS_SDK._CONS_.WEB_SOCKET.onclose = function(event) {
-      console.debug('关闭--------------')
-      clearTimeout(configure.heartbeatTimer)
-      if (configure.allowAccess) {
-        errorReconnect()
-      }
-    }
-    // 异常事件
-    WS_SDK._CONS_.WEB_SOCKET.error = function(event) {
-      if (configure.allowAccess) {
-        errorReconnect()
-      }
     }
-  }
-  connect()
+    connect()
 }
 WS_SDK.prototype = {
-  close: function() {
-    console.info('============')
-    clearTimeout(configure.timeoutTimer)
-    configure.timeoutTimer = null
-    clearTimeout(configure.heartbeatTimer)
-    configure.heartbeatTimer = null
-    WS_SDK._CONS_.WEB_SOCKET.close()
-  },
-  send: function(sysId, toUserId, sType, msgType, msg, customType) { // 发送消息
-    if (WS_SDK._CONS_.WEB_SOCKET.readyState === 1 || WS_SDK._CONS_.WEB_SOCKET.readyState === WebSocket.OPEN) {
-      try {
-        var imdata = new proto.IMData()
-        imdata.setId(new Date().getTime())
-        imdata.setType(2)
-        imdata.setTimestamp(new Date().getTime())
-        var msgData = new proto.IMData.MsgData()
-        if (sysId !== undefined && sysId !== '') {
-          msgData.setSysid(Long.fromValue(sysId, false))
-        }
-        var fromData = new proto.IMData.MsgData.FromUser()
-        fromData.setId(Long.fromValue(WS_SDK._CONS_.imUid, false))
-        if (sysId !== undefined && sysId !== '') {
-          fromData.setSysid(Long.fromValue(sysId, false))
-        }
-        fromData.setBususerid(WS_SDK._BUSUSERINFO_.busUid)
-        fromData.setHeadimg(WS_SDK._BUSUSERINFO_.headImg)
-        fromData.setNickname(WS_SDK._BUSUSERINFO_.nickName)
-        msgData.setFromuser(fromData)
-        msgData.setMsgbody(msg)
-        msgData.setMsgtype(msgType)
-        if (msgType !== undefined && msgType === 'custom') {
-          if (customType === undefined || customType === '') {
-            alert('自定义消息中自定义类型不能为空自定义类型不能为空')
-            return
-          }
-          msgData.setCustomtype(customType)
+    close: function () {
+        console.info('============')
+        clearTimeout(configure.timeoutTimer)
+        configure.timeoutTimer = null
+        clearTimeout(configure.heartbeatTimer)
+        configure.heartbeatTimer = null
+        WS_SDK._CONS_.WEB_SOCKET.close()
+    },
+    send: function (sysId, toUserId, sType, msgType, msg, customType) { // 发送消息
+        if (WS_SDK._CONS_.WEB_SOCKET.readyState === 1 || WS_SDK._CONS_.WEB_SOCKET.readyState === WebSocket.OPEN) {
+            try {
+                var imdata = new proto.IMData()
+                imdata.setId(new Date().getTime())
+                imdata.setType(2)
+                imdata.setTimestamp(new Date().getTime())
+                var msgData = new proto.IMData.MsgData()
+                if (sysId !== undefined && sysId !== '') {
+                    msgData.setSysid(Long.fromValue(sysId, false))
+                }
+                var fromData = new proto.IMData.MsgData.FromUser()
+                fromData.setId(Long.fromValue(WS_SDK._CONS_.imUid, false))
+                if (sysId !== undefined && sysId !== '') {
+                    fromData.setSysid(Long.fromValue(sysId, false))
+                }
+                fromData.setBususerid(WS_SDK._BUSUSERINFO_.busUid)
+                fromData.setHeadimg(WS_SDK._BUSUSERINFO_.headImg)
+                fromData.setNickname(WS_SDK._BUSUSERINFO_.nickName)
+                msgData.setFromuser(fromData)
+                msgData.setMsgbody(msg)
+                msgData.setMsgtype(msgType)
+                if (msgType !== undefined && msgType === 'custom') {
+                    if (customType === undefined || customType === '') {
+                        alert('自定义消息中自定义类型不能为空自定义类型不能为空')
+                        return
+                    }
+                    msgData.setCustomtype(customType)
+                }
+                msgData.setStype(sType)
+                msgData.setTouserid(Long.fromValue(toUserId, false))
+                msgData.setSendtime(new Date().getTime())
+                imdata.setMsgdata(msgData)
+                WS_SDK._CONS_.WEB_SOCKET.send(imdata.serializeBinary())
+                return true
+            } catch (e) {
+                console.error(e)
+                console.error('网络异常,请稍后再试!!!')
+                return false
+            }
+        } else {
+            console.error('网络异常,请稍后再试!!!')
+            WS_SDK._CONS_.WEB_SOCKET.error('')
+            return false
         }
-        msgData.setStype(sType)
-        msgData.setTouserid(Long.fromValue(toUserId, false))
-        msgData.setSendtime(new Date().getTime())
-        imdata.setMsgdata(msgData)
-        WS_SDK._CONS_.WEB_SOCKET.send(imdata.serializeBinary())
-        return true
-      } catch (e) {
-        console.error(e)
-        console.error('网络异常,请稍后再试!!!')
-        return false
-      }
-    } else {
-      console.error('网络异常,请稍后再试!!!')
-      WS_SDK._CONS_.WEB_SOCKET.error('')
-      return false
     }
-  }
 }
 
 export default WS_SDK

+ 149 - 152
src/layout/header-aside/layout.vue

@@ -17,7 +17,7 @@
         <!-- 半透明遮罩 -->
         <div class="ibps-layout-header-aside-mask" />
         <!-- websocket -->
-        <!-- <ibps-notify-monitor /> -->
+        <ibps-notify-monitor />
         <!-- 主体内容 -->
         <div class="ibps-layout-header-aside-content" flex="dir:top">
             <panle />
@@ -104,7 +104,7 @@
                     <ibps-header-message />
                     <!-- 消息中心 -->
                     <span style="margin: 0 10px;">|</span>
-                    <ibps-header-user style="margin-right: 15px;"/>
+                    <ibps-header-user style="margin-right: 15px;" />
                     <!-- <span style="margin-left: 10px;">|</span>
                     <ibps-header-setting /> -->
                 </div>
@@ -144,7 +144,7 @@
                             class="ibps-theme-container-main-layer"
                             flex
                         >
-                            <ibps-panel-search ref="panelSearch" @close="searchPanelClose"/>
+                            <ibps-panel-search ref="panelSearch" @close="searchPanelClose" />
                         </div>
                     </transition>
                     <!-- 内容 -->
@@ -177,164 +177,161 @@
 </template>
 
 <script>
-    import IbpsLogo from './components/logo'
-    import IbpsMenuSide from './components/menu-side/index.js'
-    import IbpsMenuHeader from './components/menu-header/index.js'
-    import IbpsTabs from './components/tabs'
-    import IbpsHeaderSearch from './components/header-search'
-    import FloatBall from './components/components/float-ball'
-    import IbpsHeaderFullscreen from './components/header-fullscreen'
-    // import IbpsHeaderLocking from './components/header-locking'
-    // import IbpsHeaderLanguage from './components/header-language'
-    // import IbpsHeaderSize from './components/header-size'
-    // import IbpsHeaderTheme from './components/header-theme'
-    // import IbpsHeaderToolbar from './components/header-toolbar'
+import IbpsLogo from './components/logo'
+import IbpsMenuSide from './components/menu-side/index.js'
+import IbpsMenuHeader from './components/menu-header/index.js'
+import IbpsTabs from './components/tabs'
+import IbpsHeaderSearch from './components/header-search'
+import FloatBall from './components/components/float-ball'
+import IbpsHeaderFullscreen from './components/header-fullscreen'
+// import IbpsHeaderLocking from './components/header-locking'
+// import IbpsHeaderLanguage from './components/header-language'
+// import IbpsHeaderSize from './components/header-size'
+// import IbpsHeaderTheme from './components/header-theme'
+// import IbpsHeaderToolbar from './components/header-toolbar'
 
-    // import IbpsHeaderTenant from './components/header-tenant'
-    import IbpsHeaderSetting from './components/header-setting'
-    import IbpsHeaderMessage from './components/header-message'
-    import panle from '@/components/jbd-panel'
-    import IbpsHeaderUser from './components/header-user'
-    import IbpsHeaderErrorLog from './components/header-error-log'
-    import IbpsHeaderBaseUrl from './components/header-base-url'
-    import IbpsHeaderCleanCache from './components/header-clean-cache'
-    // import IbpsHeaderDownload from './components/header-download'
-    // import IbpsNotifyMonitor from '@/business/platform/socket/notify-monitor'
-    import { mapState, mapGetters, mapActions } from 'vuex'
-    import mixinSearch from './mixins/search'
-    import mixinLock from './mixins/lock'
+// import IbpsHeaderTenant from './components/header-tenant'
+import IbpsHeaderSetting from './components/header-setting'
+import IbpsHeaderMessage from './components/header-message'
+import panle from '@/components/jbd-panel'
+import IbpsHeaderUser from './components/header-user'
+import IbpsHeaderErrorLog from './components/header-error-log'
+import IbpsHeaderBaseUrl from './components/header-base-url'
+import IbpsHeaderCleanCache from './components/header-clean-cache'
+// import IbpsHeaderDownload from './components/header-download'
+import IbpsNotifyMonitor from '@/business/platform/socket/notify-monitor'
+import { mapState, mapGetters, mapActions } from 'vuex'
+import mixinSearch from './mixins/search'
+import mixinLock from './mixins/lock'
 
-    import setting from '@/setting.js'
-    export default {
-        name: 'ibps-layout-header-aside',
-        components: {
-            IbpsLogo,
-            IbpsMenuSide,
-            IbpsMenuHeader,
-            IbpsTabs,
-            IbpsHeaderSearch,
-            FloatBall,
-            panle,
-            IbpsHeaderFullscreen,
-            // IbpsHeaderLocking,
-            // IbpsHeaderLanguage,
-            // IbpsHeaderSize,
-            // IbpsHeaderTheme,
-            // IbpsHeaderToolbar,
-            // IbpsHeaderTenant,
-            IbpsHeaderSetting,
-            IbpsHeaderMessage,
-            IbpsHeaderUser,
-            IbpsHeaderErrorLog,
-            IbpsHeaderBaseUrl,
-            IbpsHeaderCleanCache
-            // IbpsHeaderDownload,
-            // IbpsNotifyMonitor
-        },
-        mixins: [mixinSearch, mixinLock],
-        data() {
-            const {isSuper, account} = this.$store.getters
-            return {
-                // [侧边栏宽度] 正常状态
-                asideWidth: '200px',
-                // [侧边栏宽度] 折叠状态
-                asideWidthCollapse: '65px',
-                isSuper,
-                account
-            }
-        },
-        // watch: {
-        //     getSystemName(value) {
-        //         this.sysName = ''
-        //     }
-        // },
-        mounted() {
-            // window.performance.navigation.type === 1
-            if (this.$route.name === 'dashboard') {
-                this.sysName = '首页'
-            }
+import setting from '@/setting.js'
+export default {
+    name: 'ibps-layout-header-aside',
+    components: {
+        IbpsLogo,
+        IbpsMenuSide,
+        IbpsMenuHeader,
+        IbpsTabs,
+        IbpsHeaderSearch,
+        FloatBall,
+        panle,
+        IbpsHeaderFullscreen,
+        // IbpsHeaderLocking,
+        // IbpsHeaderLanguage,
+        // IbpsHeaderSize,
+        // IbpsHeaderTheme,
+        // IbpsHeaderToolbar,
+        // IbpsHeaderTenant,
+        IbpsHeaderSetting,
+        IbpsHeaderMessage,
+        IbpsHeaderUser,
+        IbpsHeaderErrorLog,
+        IbpsHeaderBaseUrl,
+        IbpsHeaderCleanCache,
+        // IbpsHeaderDownload,
+        IbpsNotifyMonitor
+    },
+    mixins: [mixinSearch, mixinLock],
+    data () {
+        const { isSuper, account } = this.$store.getters
+        return {
+            // [侧边栏宽度] 正常状态
+            asideWidth: '200px',
+            // [侧边栏宽度] 折叠状态
+            asideWidthCollapse: '65px',
+            isSuper,
+            account
+        }
+    },
+    // watch: {
+    //     getSystemName(value) {
+    //         this.sysName = ''
+    //     }
+    // },
+    computed: {
+        ...mapState('ibps', {
+            // sysName:state=>state.menu.sysName,
+            keepAlive: state => state.page.keepAlive,
+            grayActive: state => state.gray.active,
+            transitionActive: state => state.transition.active,
+            asideCollapse: state => state.menu.asideCollapse,
+            asideTransition: state => state.menu.asideTransition,
+            system: state => state.system.system,
+            subsystemList: state => state.system.subsystemList
+        }),
+        ...mapGetters('ibps', {
+            themeActiveSetting: 'theme/activeSetting'
+        }),
+        getSystemName () {
+            return this.header().filter(name => { return name.id === this.activeHeader() })
         },
-        computed: {
-            ...mapState('ibps', {
-                // sysName:state=>state.menu.sysName,
-                keepAlive: state => state.page.keepAlive,
-                grayActive: state => state.gray.active,
-                transitionActive: state => state.transition.active,
-                asideCollapse: state => state.menu.asideCollapse,
-                asideTransition: state => state.menu.asideTransition,
-                system: state => state.system.system,
-                subsystemList: state => state.system.subsystemList
-            }),
-            ...mapGetters('ibps', {
-                themeActiveSetting: 'theme/activeSetting'
-            }),
-            getSystemName() {
-                return this.header().filter(name => { return name.id === this.activeHeader() })
-            },
-            /**
-             * @description 用来实现带参路由的缓存
-             */
-            sysName: {
-                get() {
-                    if (this.$route.name === 'dashboard') {
-                        return '首页'
-                    } else {
-                        return ''
-                    }
-                },
-                set() {
-                    if (this.$route.name === 'dashboard') {
-                        return '首页'
-                    } else {
-                        return ''
-                    }
+        /**
+         * @description 用来实现带参路由的缓存
+         */
+        sysName: {
+            get () {
+                if (this.$route.name === 'dashboard') {
+                    return '首页'
+                } else {
+                    return ''
                 }
             },
-            routerViewKey() {
-                // 默认情况下 key 类似 __transition-n-/foo
-                // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo
-                const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || ''
-                return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}`
-            },
-            /**
-             * @description 最外层容器的背景图片样式
-             */
-            styleLayoutMainGroup() {
-                return { ...(this.themeActiveSetting.backgroundImage ? {backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`} : {})}
-            },
-            logoIconAll() {
-                return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/all.png`
-            },
-            logoIconOnly() {
-                return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/only.png`
+            set () {
+                if (this.$route.name === 'dashboard') {
+                    return '首页'
+                } else {
+                    return ''
+                }
             }
         },
-        methods: {
-            ...mapActions('ibps/menu', ['asideCollapseToggle']),
-            ...mapState('ibps/menu', ['activeHeader', 'header', 'activeName']),
-            /* 跳转首页*/
-            goToMain() {
-                // this.sysName = "首页"
-                this.$router.push({
-                    name: 'dashboard'
-                })
-            },
-            pageChange() {
-                this.sysName = ''
-            },
-            /**
-             * 接收点击切换侧边栏的按钮
-             */
-            handleToggleAside() {
-                this.asideCollapseToggle()
-            },
-            handleSubsystemClick(system) {
-                this.$store.dispatch('ibps/system/set', system)
-                window.location.href = this.$baseUrl
-                // location.reload() // 为了重新实例化vue-router对象 避免bug
-            }
+        routerViewKey () {
+            // 默认情况下 key 类似 __transition-n-/foo
+            // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo
+            const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || ''
+            return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}`
+        },
+        /**
+         * @description 最外层容器的背景图片样式
+         */
+        styleLayoutMainGroup () {
+            return { ...(this.themeActiveSetting.backgroundImage ? { backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')` } : {}) }
+        },
+        logoIconAll () {
+            return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/all.png`
+        },
+        logoIconOnly () {
+            return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/only.png`
+        }
+    },
+    mounted () {
+        // window.performance.navigation.type === 1
+        if (this.$route.name === 'dashboard') {
+            this.sysName = '首页'
+        }
+    },
+    methods: {
+        ...mapActions('ibps/menu', ['asideCollapseToggle']),
+        ...mapState('ibps/menu', ['activeHeader', 'header', 'activeName']),
+        goToMain () {
+            // this.sysName = "首页"
+            this.$router.push({ path: '/' })
+        },
+        pageChange () {
+            this.sysName = ''
+        },
+        /**
+         * 接收点击切换侧边栏的按钮
+         */
+        handleToggleAside () {
+            this.asideCollapseToggle()
+        },
+        handleSubsystemClick (system) {
+            this.$store.dispatch('ibps/system/set', system)
+            window.location.href = this.$baseUrl
+            // location.reload() // 为了重新实例化vue-router对象 避免bug
         }
     }
+}
 </script>
 
 <style lang="scss">

+ 0 - 1
src/views/system/dashboard/components/workbench.vue

@@ -427,7 +427,6 @@ export default {
                 pageParams = page
             }
             // const s = this.activeTab === 'news' ? this.sorts { 'PUBLIC_DATE_': 'DESC' } : this.sorts
-            console.log(ActionUtils.formatParams(params, pageParams, this.sorts))
             return ActionUtils.formatParams(params, pageParams, this.sorts)
         },
         // 处理表格点击事件