|
@@ -30,7 +30,7 @@
|
|
|
<script setup name='EmrWebSocket' lang="ts">
|
|
|
import {stringIsBlank} from "@/utils/blank-utils";
|
|
|
import store from "@/store";
|
|
|
-import {ref, defineProps, onMounted, nextTick, computed} from 'vue'
|
|
|
+import {ref, defineProps, onMounted, nextTick, computed, onDeactivated, onBeforeUnmount, onUnmounted} from 'vue'
|
|
|
import {xcMessage} from '@/utils/xiaochan-element-plus'
|
|
|
import {getRoomPeople, sendAMessage} from '@/api/zhu-yuan-yi-sheng/emr-socket'
|
|
|
import {ElNotification} from "element-plus";
|
|
@@ -55,7 +55,6 @@ const userMap = ref<any>({})
|
|
|
const dialogRef = ref(null)
|
|
|
|
|
|
const SOCKET_URL = import.meta.env.VITE_SOCKET_URL
|
|
|
-const EMR_SOCKET_URL = import.meta.env.VITE_EMR_SOCKET_URL
|
|
|
|
|
|
let webSocket = null
|
|
|
let userData = store.state.user.info
|
|
@@ -198,11 +197,34 @@ const clearDocument = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const clearSocket = () => {
|
|
|
+ if (webSocket != null) {
|
|
|
+ webSocket.close()
|
|
|
+ webSocket = null
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await nextTick()
|
|
|
initWebSocket(props.patInfo.inpatientNo, props.patInfo.admissTimes)
|
|
|
})
|
|
|
|
|
|
+onDeactivated(() => {
|
|
|
+ clearDocument()
|
|
|
+ clearSocket()
|
|
|
+})
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ clearDocument()
|
|
|
+ clearSocket()
|
|
|
+})
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ clearDocument()
|
|
|
+ clearSocket()
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
defineExpose({
|
|
|
medicalRecordSwitching,
|
|
|
documentChange,
|