+
TEMP
{{ patientInfo.TEMP }}
@@ -138,7 +138,7 @@ function subscribeVital() {
function wsClose() {
remoteWsStore.vitalOnclose(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, props.index, () => {
setTimeout(() => {
- ElMessage.info('远程查看' + props.index + ', 生命体征数据连接断开,正在尝试重连……')
+ ElMessage.info('远程查看' + (props.index + 1) + ', 生命体征数据连接断开,正在尝试重连……')
initData()
}, 3000)
})
@@ -165,7 +165,7 @@ function wsClose() {
// // }
// }
-const lastTimes:any = ref([]); // 使用数组来存储每个任务的lastTime
+const lastTimes: any = ref([]); // 使用数组来存储每个任务的lastTime
function setLog(data: any, index: number) {
console.log(lastTimes.value[index], data.Time);
diff --git a/src/views/remote-manage/part/remote-part.vue b/src/views/remote-manage/part/remote-part.vue
index c4a0805..62018bd 100644
--- a/src/views/remote-manage/part/remote-part.vue
+++ b/src/views/remote-manage/part/remote-part.vue
@@ -216,11 +216,23 @@ function initData() {
if (remoteItem.value && remoteItem.value.patient) {
remoteWsStore.createVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.vitalOnclose(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, () => {
- setTimeout(() => {
- ElMessage.info('远程查看' + (currentIndex + 1) + ', 生命体征数据连接断开,正在尝试重连……')
- remoteWsStore.createVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
+ if (remoteWsStore.isActiveDisconnect(currentIndex)) {
+ return;
+ }
+ // 创建定时器并保存到store
+ const timerId = setTimeout(() => {
+ ElMessage.info(`远程查看${currentIndex + 1},生命体征数据连接断开,正在尝试重连……`)
+ remoteWsStore.createVital(
+ remoteItem.value.patient,
+ remoteItem.value.patientId,
+ remoteItem.value.date,
+ currentIndex
+ )
initData()
}, 3000)
+
+ // 将定时器ID保存到store中
+ remoteWsStore.setReconnectTimer(currentIndex, timerId)
})
remoteWsStore.createChat(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.chatOnclose(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, () => {
@@ -275,6 +287,12 @@ function setLog(data: any) {
}
const breakRemote = () => {
+ ElMessage.success('断开连接成功!')
+ // 1. 标记为主动断开
+ remoteWsStore.setActiveDisconnect(currentIndex, true)
+ // 2. 清除对应的重连定时器
+ remoteWsStore.clearReconnectTimer(currentIndex)
+ // 3. 关闭websocket连接
remoteWsStore.getRemoteTask()[currentIndex]
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.resetRemoteTask(currentIndex)
diff --git a/src/views/remote-manage/remote-control.vue b/src/views/remote-manage/remote-control.vue
index 5494bf5..8403a5e 100644
--- a/src/views/remote-manage/remote-control.vue
+++ b/src/views/remote-manage/remote-control.vue
@@ -352,7 +352,7 @@ const subscribeVital = () => {
})
remoteWsStore.vitalOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex, () => {
setTimeout(() => {
- ElMessage.info('远程查看' + currentIndex + ', 生命体征数据连接断开,正在尝试重连……')
+ // ElMessage.info('远程查看' + currentIndex + ', 生命体征数据连接断开,正在尝试重连……')
subscribeVital()
}, 3000)
})
@@ -376,7 +376,7 @@ const subscribeChat = () => {
messageList.value = msg.history;
}
if (msg.msgType == "destroy") {
- ElMessageBox.confirm('远程查看' + currentIndex + '已断开与手术室连接', '提示', {
+ ElMessageBox.confirm('远程查看' + (currentIndex + 1) + '已断开与手术室连接', '提示', {
confirmButtonText: '确认',
type: 'info'
}).then(() => {