App.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <router-view/>
  3. <soctet-dialog v-if="socketErrDialog"/>
  4. <progress-bar/>
  5. <JsDialogComp/>
  6. <CyDialogV2/>
  7. </template>
  8. <script setup lang="jsx">
  9. import {setCallback, socketErrDialog} from "@/utils/websocket";
  10. import {ElMessageBox, ElNotification} from "element-plus";
  11. import sleep from "@/utils/sleep";
  12. import SoctetDialog from "@/components/xiao-chan/websocket/SoctetDialog.vue";
  13. import router from "@/router";
  14. import ProgressBar from "@/components/xiao-chan/progress-bar/ProgressBar.vue";
  15. import {formatDateToStr} from '@/utils/moment-utils'
  16. import {ElLink} from 'element-plus'
  17. import JsDialogComp from "@/components/js-dialog-comp/JsDialogComp.vue";
  18. import {CyMessageBox} from "@/components/cy/message-box";
  19. import {useProgressBarStore} from "@/pinia/progress-bar-store";
  20. import {useUserStore} from "@/pinia/user-store";
  21. import {useSystemStore} from "@/pinia/system-store";
  22. import useChangeToken from "@/utils/cy-use/useChangeToken";
  23. import CyDialogV2 from "@/components/cy/CyDialog/index.vue";
  24. const progressBarStore = useProgressBarStore()
  25. const systemStore = useSystemStore()
  26. useChangeToken()
  27. progressBarStore.initialize({
  28. title: '数据上传',
  29. isOpen: false,
  30. abnormalClosing: false,
  31. })
  32. function avatarNotification(data) {
  33. const message = (
  34. <div>
  35. <div>
  36. 科室: {data.deptName}
  37. </div>
  38. <div>
  39. {data.msg}
  40. </div>
  41. </div>
  42. )
  43. ElNotification({
  44. icon: <img src={data.avatar} style={{width: '32px', height: "32px", borderRadius: '16px'}} alt=""/>,
  45. title: data.title,
  46. message: message,
  47. dangerouslyUseHTMLString: true,
  48. duration: 0,
  49. })
  50. }
  51. function checkTheCallbacks({data, isAdd}) {
  52. const message = (
  53. <table style="width: 100%">
  54. <tbody>
  55. <tr>
  56. <td style="padding-right: 8px">患者:</td>
  57. <td>{data.patientName}</td>
  58. </tr>
  59. <tr>
  60. <td style="padding-right: 8px">检查名称:</td>
  61. <td>{data.reqName}</td>
  62. </tr>
  63. <tr>
  64. <td style="padding-right: 8px"> 报告时间:</td>
  65. <td>{formatDateToStr(data.reportTime)}</td>
  66. </tr>
  67. <tr>
  68. <td colspan="2" style="text-ali">
  69. <ElLink type="primary" target="_blank"
  70. href={`http://172.16.32.122:8099/mReport?REQUISITIONID=${data.reqNo}`}>
  71. 查看图像
  72. </ElLink>
  73. </td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. )
  78. ElNotification({
  79. title: isAdd ? '检查结果返回' : '修改检查结果',
  80. message: message,
  81. dangerouslyUseHTMLString: true,
  82. type: 'success',
  83. position: 'bottom-right',
  84. duration: 0
  85. })
  86. }
  87. function systemNotification(data) {
  88. if (data.count) {
  89. systemStore.addUnreadMessageCount(data.count)
  90. }
  91. if (data.refreshDelay) {
  92. sleep(data.refreshDelay).then(() => {
  93. location.reload();
  94. })
  95. }
  96. if (data?.donTDisplay) {
  97. return
  98. }
  99. ElNotification({
  100. title: data.title ?? '新消息',
  101. message: h('pre', {
  102. class: 'message_pre'
  103. }, data.message),
  104. dangerouslyUseHTMLString: true,
  105. type: data.title ?? 'warning',
  106. duration: 0,
  107. })
  108. }
  109. onMounted(() => {
  110. setCallback('refreshToken', (data) => {
  111. useUserStore().setToken(data.token)
  112. })
  113. setCallback('sidSingle', async () => {
  114. localStorage.clear()
  115. await router.push('/login')
  116. await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
  117. type: 'warning',
  118. })
  119. })
  120. setCallback('criticalValue', (data) => {
  121. CyMessageBox({
  122. title: '患者危急值',
  123. message: data.message,
  124. type: 'error',
  125. confirmButtonText: '前往处理',
  126. cancelButtonText: '关闭'
  127. }).then(() => {
  128. router.push(`/inpatient/zhuYuanYiSheng/criticalValue?id=${data.id}`)
  129. }).catch(() => {
  130. })
  131. })
  132. setCallback('systemNotification', systemNotification)
  133. setCallback('checkTheCallbacks', checkTheCallbacks)
  134. setCallback('avatarNotification', avatarNotification);
  135. })
  136. </script>
  137. <style lang="scss">
  138. .message_pre {
  139. font-weight: normal;
  140. margin: 0;
  141. font-size: 14px;
  142. line-height: 1;
  143. white-space: pre-wrap;
  144. }
  145. </style>