远程生命体征断开报错

This commit is contained in:
yy 2024-06-05 17:58:00 +08:00
parent 2ca8b04bd6
commit 30b7e00b38
2 changed files with 9 additions and 9 deletions

View File

@ -126,7 +126,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
},
subscribeVital(name: string, id: string, date: string, index: number, cb: any) {
const patient = this.patient[name + id + date + index]
if (patient.vitalWS) {
if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = (e: any) => {
if (e && e.data) {
const data = JSON.parse(e.data);
@ -146,11 +146,13 @@ export const useRemoteWsStore = defineStore("remoteWs", {
},
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient = this.patient[name + id + date + index]
patient.vitalWS.onclose = () => {
const status = this.getCloseStatus()
if (!status[name + id + date + index + 'vitalWS']) {
delete patient.vitalWS
cb()
if (patient && patient.vitalWS) {
patient.vitalWS.onclose = () => {
const status = this.getCloseStatus()
if (!status[name + id + date + index + 'vitalWS']) {
delete patient.vitalWS
cb()
}
}
}
},

View File

@ -207,9 +207,7 @@ function setLog(data: any) {
const breakRemote = () => {
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index)
remoteWsStore.resetRemoteTask(remoteWsStore.getCurrentTaskIndex())
if (remoteWsStore.getActiveRemoteTask()) {
showData(remoteWsStore.getActiveRemoteTask())
}
showData(remoteWsStore.getActiveRemoteTask())
emit('breakRemote')
}