msmq.js 907 B

12345678910111213141516171819202122
  1. import { Notification } from 'element-ui';
  2. import Bus from '@/utils/bus.js'
  3. const MSMQ = {
  4. handleMsg (message, projects, unreadNum ) {
  5. let data
  6. try {
  7. data = JSON.parse(message.body)
  8. } catch (err) {}
  9. // if(projects.some((item) => {return item.id == data.projectId})) { //判断消息是否是当前用户拥有的项目
  10. unreadNum++
  11. if(message.headers.destination == '/topic/model.manage'){ //模型文件的消息触发模型文件列表刷新事件
  12. Bus.$emit('modelStatusChange', data)
  13. }
  14. // Notification.info({ title: '消息',dangerouslyUseHTMLString: true, message: `项目编号:${data.projectId}<br>消息类型:${data.type}<br>描述信息:${data.description}<br>` })
  15. Notification.info({ title: '消息', dangerouslyUseHTMLString: true, message: `${JSON.stringify(data)}` })
  16. return unreadNum
  17. // }
  18. }
  19. }
  20. export default MSMQ