App.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <router-view />
  3. <SocketDialog 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 SocketDialog from "@/components/xiao-chan/websocket/SocketDialog.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>科室: {data.deptName}</div>
  36. <div>{data.msg}</div>
  37. </div>
  38. );
  39. ElNotification({
  40. icon: (
  41. <img
  42. src={data.avatar}
  43. style={{ width: "32px", height: "32px", borderRadius: "16px" }}
  44. alt=""
  45. />
  46. ),
  47. title: data.title,
  48. message: message,
  49. dangerouslyUseHTMLString: true,
  50. duration: 0,
  51. });
  52. }
  53. function checkTheCallbacks({ data, isAdd }) {
  54. const message = (
  55. <table style="width: 100%">
  56. <tbody>
  57. <tr>
  58. <td style="padding-right: 8px">患者:</td>
  59. <td>{data.patientName}</td>
  60. </tr>
  61. <tr>
  62. <td style="padding-right: 8px">检查名称:</td>
  63. <td>{data.reqName}</td>
  64. </tr>
  65. <tr>
  66. <td style="padding-right: 8px"> 报告时间:</td>
  67. <td>{formatDateToStr(data.reportTime)}</td>
  68. </tr>
  69. <tr>
  70. <td colspan="2" style="text-ali">
  71. <ElLink
  72. type="primary"
  73. target="_blank"
  74. href={`http://172.16.32.122:8099/mReport?REQUISITIONID=${data.reqNo}`}
  75. >
  76. 查看图像
  77. </ElLink>
  78. </td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. );
  83. ElNotification({
  84. title: isAdd ? "检查结果返回" : "修改检查结果",
  85. message: message,
  86. dangerouslyUseHTMLString: true,
  87. type: "success",
  88. position: "bottom-right",
  89. duration: 0,
  90. });
  91. }
  92. function systemNotification(data) {
  93. if (data.count) {
  94. systemStore.addUnreadMessageCount(data.count);
  95. }
  96. if (data.refreshDelay) {
  97. sleep(data.refreshDelay).then(() => {
  98. location.reload();
  99. });
  100. }
  101. if (data?.donTDisplay) {
  102. return;
  103. }
  104. ElNotification({
  105. title: data.title ?? "新消息",
  106. message: h(
  107. "pre",
  108. {
  109. class: "message_pre",
  110. },
  111. data.message
  112. ),
  113. dangerouslyUseHTMLString: true,
  114. type: data.title ?? "warning",
  115. duration: 0,
  116. });
  117. }
  118. onMounted(() => {
  119. setCallback("refreshToken", data => {
  120. useUserStore().setToken(data.token);
  121. });
  122. setCallback("sidSingle", async () => {
  123. localStorage.clear();
  124. await router.push("/login");
  125. await ElMessageBox.alert(
  126. "您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。",
  127. "提示",
  128. {
  129. type: "warning",
  130. }
  131. );
  132. });
  133. setCallback("criticalValue", data => {
  134. CyMessageBox({
  135. title: "患者危急值",
  136. message: data.message,
  137. type: "error",
  138. confirmButtonText: "前往处理",
  139. cancelButtonText: "关闭",
  140. })
  141. .then(() => {
  142. router.push(`/inpatient/zhuYuanYiSheng/criticalValue?id=${data.id}`);
  143. })
  144. .catch(() => {});
  145. });
  146. setCallback("systemNotification", systemNotification);
  147. setCallback("checkTheCallbacks", checkTheCallbacks);
  148. setCallback("avatarNotification", avatarNotification);
  149. });
  150. </script>
  151. <style lang="scss">
  152. .message_pre {
  153. font-weight: normal;
  154. margin: 0;
  155. font-size: 14px;
  156. line-height: 1;
  157. white-space: pre-wrap;
  158. }
  159. </style>