错误修复

This commit is contained in:
yy 2024-05-29 19:16:11 +08:00
parent c575509eaf
commit 134d202f67
3 changed files with 29 additions and 2 deletions

View File

@ -172,6 +172,10 @@ export const useRemoteWsStore = defineStore("remoteWs", {
this.patient[name + id + date + index].vitalCB = cb
}
},
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.vitalWS.onclose = cb
},
unsubscribeVital(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
if (patient && patient.vitalWS) {
@ -211,6 +215,10 @@ export const useRemoteWsStore = defineStore("remoteWs", {
})
}
},
chatOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.chatWS.onclose = cb
},
unsubscribeChat(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.chatCB = undefined;
@ -257,6 +265,10 @@ export const useRemoteWsStore = defineStore("remoteWs", {
})
}
},
medicineOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.medicineWS.onclose = cb
},
unsubscribeMedicine(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.medicineCB = undefined;

View File

@ -69,6 +69,7 @@ const emit = defineEmits(['addLogAfter'])
const remoteWsStore = useRemoteWsStore();
const remoteTask = ref(remoteWsStore.remoteTasks[props.index]);
const patientInfo = ref({} as any)
let reconnectTime = 0
onMounted(() => {
//
@ -81,7 +82,8 @@ onUnmounted(() => {
})
function initData() {
subscribeVital();
subscribeVital()
wsClose()
}
function subscribeVital() {
@ -98,6 +100,19 @@ function subscribeVital() {
}
function wsClose() {
remoteWsStore.vitalOnclose(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, props.index, () => {
if (reconnectTime < 3) {
remoteWsStore.createConnect(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, props.index)
subscribeVital()
wsClose()
} else {
reconnectTime = 0
}
})
}
function setLog(data: any, index: number) {
remoteWsStore.exceptionType.forEach((item: any) => {
if (data[item]) {

View File

@ -166,7 +166,7 @@ function initData() {
}
function getData() {
if (currentIndex > -1 && remoteItem.value.patient) {
if (currentIndex > -1 && remoteItem.value?.patient) {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, (res: any) => {
if (res && res.data) {