mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
11111
This commit is contained in:
parent
2881c819b6
commit
269ee1c120
|
@ -1,5 +1,5 @@
|
||||||
import {defineStore} from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import {Session} from "@/utils/storage";
|
import { Local, Session } from "@/utils/storage";
|
||||||
|
|
||||||
const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
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()
|
const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
||||||
|
@ -22,7 +22,29 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
setCurrentTaskIndex(i: number) {
|
||||||
|
this.currentTaskIndex = i
|
||||||
|
Local.set("currentTaskIndex", i)
|
||||||
|
},
|
||||||
|
getCurrentTaskIndex() {
|
||||||
|
if (Local.get("currentTaskIndex")) {
|
||||||
|
this.currentTaskIndex = Local.get("currentTaskIndex")
|
||||||
|
}
|
||||||
|
return this.currentTaskIndex
|
||||||
|
},
|
||||||
|
setRemoteTask() {
|
||||||
|
Local.set("remoteTasks", this.remoteTasks)
|
||||||
|
},
|
||||||
|
getRemoteTask() {
|
||||||
|
if (Local.get("remoteTasks")) {
|
||||||
|
this.remoteTasks = Local.get("remoteTasks")
|
||||||
|
}
|
||||||
|
return this.remoteTasks
|
||||||
|
},
|
||||||
initRemoteTask() {
|
initRemoteTask() {
|
||||||
|
if (Local.get("remoteTasks")) {
|
||||||
|
this.remoteTasks = Local.get("remoteTasks")
|
||||||
|
}
|
||||||
if (this.remoteTasks.length <= 0) {
|
if (this.remoteTasks.length <= 0) {
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
this.remoteTasks.push({
|
this.remoteTasks.push({
|
||||||
|
@ -57,6 +79,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
||||||
index: i,
|
index: i,
|
||||||
message: []
|
message: []
|
||||||
})
|
})
|
||||||
|
Local.set("remoteTasks", this.remoteTasks)
|
||||||
},
|
},
|
||||||
getActiveRemoteTask() {
|
getActiveRemoteTask() {
|
||||||
for (let i = 0; i < this.remoteTasks.length; i++) {
|
for (let i = 0; i < this.remoteTasks.length; i++) {
|
||||||
|
@ -114,10 +137,9 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
||||||
patient.vitalWS.onmessage = cb
|
patient.vitalWS.onmessage = cb
|
||||||
patient.vitalCB = cb
|
patient.vitalCB = cb
|
||||||
} else {
|
} else {
|
||||||
cb({
|
this.createConnect(name, id, date)
|
||||||
status: 1,
|
this.patient[name + id + date].vitalWS.onmessage = cb
|
||||||
msg: "已断开连接"
|
this.patient[name + id + date].vitalCB = cb
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unsubscribeVital(name: string, id: string, date: string) {
|
unsubscribeVital(name: string, id: string, date: string) {
|
||||||
|
|
|
@ -8,23 +8,18 @@ import Cookies from 'js-cookie';
|
||||||
* @method clear 移除全部永久缓存
|
* @method clear 移除全部永久缓存
|
||||||
*/
|
*/
|
||||||
export const Local = {
|
export const Local = {
|
||||||
// 查看 v2.4.3版本更新日志
|
|
||||||
setKey(key: string) {
|
|
||||||
// @ts-ignore
|
|
||||||
return `${__NEXT_NAME__}:${key}`;
|
|
||||||
},
|
|
||||||
// 设置永久缓存
|
// 设置永久缓存
|
||||||
set<T>(key: string, val: T) {
|
set<T>(key: string, val: T) {
|
||||||
window.localStorage.setItem(Local.setKey(key), JSON.stringify(val));
|
window.localStorage.setItem(key, JSON.stringify(val));
|
||||||
},
|
},
|
||||||
// 获取永久缓存
|
// 获取永久缓存
|
||||||
get(key: string) {
|
get(key: string) {
|
||||||
let json = <string>window.localStorage.getItem(Local.setKey(key));
|
let json = <string>window.localStorage.getItem(key);
|
||||||
return JSON.parse(json);
|
return JSON.parse(json);
|
||||||
},
|
},
|
||||||
// 移除永久缓存
|
// 移除永久缓存
|
||||||
remove(key: string) {
|
remove(key: string) {
|
||||||
window.localStorage.removeItem(Local.setKey(key));
|
window.localStorage.removeItem(key);
|
||||||
},
|
},
|
||||||
// 移除全部永久缓存
|
// 移除全部永久缓存
|
||||||
clear() {
|
clear() {
|
||||||
|
|
|
@ -66,7 +66,8 @@ const confirmRemote = () => {
|
||||||
patientInfo.value.taskName = '远程控制' + (patientInfo.value.index + 1)
|
patientInfo.value.taskName = '远程控制' + (patientInfo.value.index + 1)
|
||||||
patientInfo.value.date = dateFormater("yyyyMMdd", patientInfo.value.date)
|
patientInfo.value.date = dateFormater("yyyyMMdd", patientInfo.value.date)
|
||||||
unsubscribeLastTask();
|
unsubscribeLastTask();
|
||||||
remoteWsStore.$patch({currentTaskIndex: patientInfo.value.index})
|
remoteWsStore.setCurrentTaskIndex(patientInfo.value.index)
|
||||||
|
remoteWsStore.setRemoteTask()
|
||||||
remoteWsStore.setRemoteLog({
|
remoteWsStore.setRemoteLog({
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
taskName: patientInfo.value.taskName,
|
taskName: patientInfo.value.taskName,
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import {onUnmounted, ref} from 'vue'
|
import {onMounted, onUnmounted, ref} from 'vue'
|
||||||
import {useRemoteWsStore} from "@/stores/remote-ws-store";
|
import {useRemoteWsStore} from "@/stores/remote-ws-store";
|
||||||
|
|
||||||
const emit = defineEmits(['addLogAfter', 'breakRemote'])
|
const emit = defineEmits(['addLogAfter', 'breakRemote'])
|
||||||
|
@ -134,6 +134,10 @@ window.addEventListener('resize', () => {
|
||||||
mediaMini800.value = Boolean(window.innerWidth < 801)
|
mediaMini800.value = Boolean(window.innerWidth < 801)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initData();
|
||||||
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date);
|
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date);
|
||||||
})
|
})
|
||||||
|
@ -150,7 +154,8 @@ function showData(i: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initData() {
|
function initData() {
|
||||||
remoteItem.value = remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex]
|
const remoteTasks = remoteWsStore.getRemoteTask();
|
||||||
|
remoteItem.value = remoteTasks[remoteWsStore.currentTaskIndex]
|
||||||
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
|
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
|
||||||
getData()
|
getData()
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ const medicineCustom: any[] = [
|
||||||
{ name: '罗库溴铵', plus: 0.1, total: 10 }
|
{ name: '罗库溴铵', plus: 0.1, total: 10 }
|
||||||
]
|
]
|
||||||
const remoteWsStore = useRemoteWsStore()
|
const remoteWsStore = useRemoteWsStore()
|
||||||
const currentRemote = ref(remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex])
|
const currentRemote = ref(remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()])
|
||||||
const userInfo = useUserStore()
|
const userInfo = useUserStore()
|
||||||
|
|
||||||
const chartDom1 = ref(),
|
const chartDom1 = ref(),
|
||||||
|
|
|
@ -39,7 +39,7 @@ const remoteTask = ref([] as any);
|
||||||
const remoteWsStore = useRemoteWsStore();
|
const remoteWsStore = useRemoteWsStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
remoteTask.value = remoteWsStore.remoteTasks;
|
remoteTask.value = remoteWsStore.getRemoteTask();
|
||||||
})
|
})
|
||||||
|
|
||||||
const openRemote = (params: any) => {
|
const openRemote = (params: any) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user