Browse Source

监听模型文件消息

zhangyu 5 years ago
parent
commit
7d4fe6699a

+ 3 - 3
src/framework/components/messagesever/index.vue

@@ -2,7 +2,7 @@
  * @Author: zhangyu
  * @Date: 2019-08-26 15:22:13
  * @Info: 
- * @LastEditTime: 2019-09-05 17:57:15
+ * @LastEditTime: 2019-09-26 17:08:19
  -->
 <template>
   <div class="notification-box" @click="handleClickRead">
@@ -40,7 +40,7 @@ export default {
       sendMessage: '',
       messageList: [], // 历史消息
       subList: [], // 订阅的消息实例
-      topics: ["/topic/datacenter.broadcast","/topic/dataPlatform.broadcast"] // 订阅的消息名称
+      topics: ["/topic/model.manage"] // 订阅的消息名称
     }
   },
   created () {
@@ -66,7 +66,7 @@ export default {
     connect() {
       this.client = Stomp.client(MQTT_SERVICE)
       this.client.reconnect_delay = 5000
-      var clientid = `sagaMQ-${this.userInfo.username}`
+      var clientid = `sagaMQ-${this.userInfo.userName}`
       var headers = {
         'login': MQTT_USERNAME,
         'passcode': MQTT_PASSWORD,

+ 4 - 3
src/framework/components/messagesever/msmq.js

@@ -3,12 +3,13 @@ import Bus from '@/utils/bus.js'
 
 const MSMQ = {
   handleMsg (data, projects, unreadNum ) {
-    if(projects.some((item) => {return item.id == data.projectId})) { //判断消息是否是当前用户拥有的项目
+    // if(projects.some((item) => {return item.id == data.projectId})) { //判断消息是否是当前用户拥有的项目
       unreadNum++
       Bus.$emit('modelStatusChange', data)
-      Notification.info({ title: '消息',dangerouslyUseHTMLString: true, message: `项目编号:${data.projectId}<br>消息类型:${data.type}<br>描述信息:${data.description}<br>` })
+      // Notification.info({ title: '消息',dangerouslyUseHTMLString: true, message: `项目编号:${data.projectId}<br>消息类型:${data.type}<br>描述信息:${data.description}<br>` })
+      Notification.info({ title: '消息',dangerouslyUseHTMLString: true, message: `${JSON.stringify(data)}` })
       return unreadNum
-    }
+    // }
   }
 }