Merge remote-tracking branch 'origin/一期' into 一期

This commit is contained in:
熊猫 2024-05-29 17:12:33 +08:00
commit 2b5e36d3e4
4 changed files with 35 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { defineStore } from "pinia";
import { Session } from "@/utils/storage";
import { ElMessage } from "element-plus";
const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
@ -27,7 +28,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
Session.set("currentTaskIndex", i)
},
getCurrentTaskIndex() {
if (Session.get("currentTaskIndex")) {
if (Session.get("currentTaskIndex") > -1) {
this.currentTaskIndex = Session.get("currentTaskIndex")
}
return this.currentTaskIndex
@ -84,7 +85,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
getActiveRemoteTask() {
let index = 0;
for (let i = 0; i < this.remoteTasks.length; i++) {
if (this.remoteTasks[i].isRemote)index = i
if (this.remoteTasks[i].isRemote) index = i
}
return index
},
@ -103,6 +104,15 @@ export const useRemoteWsStore = defineStore("remoteWs", {
date: date
}))
}
vitalWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "已断开")
}
vitalWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "出错")
}
medicineWS.onopen = function () {
medicineWS.send(JSON.stringify({
patientName: name,
@ -110,6 +120,15 @@ export const useRemoteWsStore = defineStore("remoteWs", {
date: date
}))
}
medicineWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "给药已断开")
}
medicineWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "给药出错")
}
chatWS.onopen = function () {
chatWS.send(JSON.stringify({
patientName: name,
@ -117,6 +136,15 @@ export const useRemoteWsStore = defineStore("remoteWs", {
date: date
}))
}
chatWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "通讯已断开")
}
chatWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "通讯出错")
}
this.patient[name + id + date + index] = {
vitalWS,
medicineWS,

View File

@ -95,6 +95,7 @@ function subscribeVital() {
emit('addLogAfter', props.index)
}
})
}
function setLog(data: any, index: number) {

View File

@ -180,6 +180,7 @@ function getData() {
}
}
})
}
}

View File

@ -218,7 +218,7 @@ const medicineCustom: any[] = [
{ name: '罗库溴铵', plus: 0.1, total: 10 }
]
const remoteWsStore = useRemoteWsStore()
const currentRemote = ref(remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()])
const currentRemote = ref()
const userInfo = useUserStore()
const chartDom1 = ref(),
@ -254,6 +254,7 @@ let currentDocMedicine: any;
const medicineSpeedTemp: any = {};
onMounted(() => {
currentRemote.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]
if (!currentRemote.value.isRemote) {
router.replace('/remote-manage/remote-manage');
return;
@ -300,6 +301,7 @@ function subscribeWS() {
ElMessage.error(data.msg)
}
})
}
function initData() {