This commit is contained in:
mouse 2024-01-20 09:36:28 +08:00
parent f268349edf
commit 02b8a38337
4 changed files with 23 additions and 36 deletions

View File

@ -62,24 +62,26 @@ import { onMounted, onBeforeUnmount, reactive, ref, toRefs, watch } from 'vue'
import type { RemoteItem, PatientInfoItem, RemoteLogItem } from '@/utils/public-interface'
import { useRemoteStore } from '@/stores/remote-info-store'
import { dateFormater } from '@/utils/date-util'
import { getDataAlarmState } from '@/static-data/core'
import { setRemoteLog } from '@/static-data/core'
interface Props {
remoteTask: RemoteItem
index: number
}
const props = withDefaults(defineProps<Props>(), {
remoteTask: () => ({} as RemoteItem)
index: () => 0
})
const emit = defineEmits(['addLogAfter'])
const remoteStore = useRemoteStore()
const remoteTask = remoteStore.remoteTasks[props.index]
let timer = 0
const patientInfo = ref({} as PatientInfoItem)
onMounted(() => {
clearInterval(timer)
//
if (props.remoteTask.isRemote) {
if (remoteTask.isRemote) {
timer = setInterval(() => {
initData()
}, 2000)
@ -87,13 +89,13 @@ onMounted(() => {
})
onBeforeUnmount(() => {
//
console.log('~~~~~~~~~~~~~~~')
clearInterval(timer)
})
function initData() {
remoteTask.dataAlarm = false
const obj = {
name: props.remoteTask.patientName,
name: remoteTask.patientName,
code: '',
time: new Date(),
state: false,
@ -104,33 +106,17 @@ function initData() {
HR: Number((Math.random() * 100).toFixed(2)),
TEMP: Number((Math.random() * 100).toFixed(2))
}
const alarms = {
BIS: getDataAlarmState(obj.BIS, 'BIS'),
SBP: getDataAlarmState(obj.SBP, 'SBP'),
SPO2: getDataAlarmState(obj.SPO2, 'SPO2'),
DBP: getDataAlarmState(obj.DBP, 'DBP'),
HR: getDataAlarmState(obj.HR, 'HR'),
TEMP: getDataAlarmState(obj.TEMP, 'TEMP')
}
if (alarms.BIS) addLog('脑电双频指数')
if (alarms.SBP) addLog('收缩率')
if (alarms.SPO2) addLog('氧饱和度')
if (alarms.DBP) addLog('舒张压')
if (alarms.HR) addLog('心率')
if (alarms.TEMP) addLog('体温')
patientInfo.value = obj
function addLog(title: string) {
setRemoteLog(obj, (title: string, size: string) => {
obj.state = true
useRemoteStore().setRemoteLog({
remoteTask.dataAlarm = true
remoteStore.setRemoteLog({
time: new Date(),
title,
state: '异常'
}, props.remoteTask.index)
emit('addLogAfter', props.remoteTask.index)
}
}, props.index)
})
Object.assign(patientInfo.value, obj)
emit('addLogAfter', props.index)
}
</script>

View File

@ -158,6 +158,7 @@ function initData(e?: RemoteItem) {
function getData() {
remoteItem.value.dataAlarm = false
const obj = {
state: false,
BIS: Math.ceil(Math.random() * 100),
SBP: Math.ceil(Math.random() * 100),
SPO2: Math.ceil(Math.random() * 100),

View File

@ -35,6 +35,7 @@ import RemotePart from './part/remote-part.vue'
import MessagePart from './part/message-part.vue'
const router = useRouter()
const remoteStore = useRemoteStore()
const remotePartRef = ref()
const messagePartRef = ref()
@ -55,7 +56,7 @@ function resetRemoteTaskItem(e: RemoteItem) {
})
}
function initRemoteTask() {
remoteTask.value = useRemoteStore().remoteTasks
remoteTask.value = remoteStore.remoteTasks
if (remoteTask.value.length < 1) {
while (remoteTask.value.length < 10) {
const obj = {
@ -77,10 +78,9 @@ function initRemoteTask() {
if (remoteTask.value.length == 1) obj.dataAlarm = true
remoteTask.value.push(obj)
}
useRemoteStore().setRemoteTasks(remoteTask.value)
const remoteStore = useRemoteStore().currentRemote
if (!remoteStore.index) {
useRemoteStore().$patch({ currentRemote: remoteTask.value[0] })
remoteStore.setRemoteTasks(remoteTask.value)
if (!remoteStore.currentRemote.index) {
remoteStore.$patch({ currentRemote: remoteTask.value[0] })
}
}
}

View File

@ -3,13 +3,13 @@
<div class="remote-thumbnail-page">
<div class="remote-box row1">
<div class="remote-item" v-for="item in remoteTask.slice(0, 4)" :key="item.title" @click="openRemote(item)">
<RemoteItemPart :ref="'remoteItemPartRef' + item.index" :remoteTask="item" @addLogAfter="addLogAfter"></RemoteItemPart>
<RemoteItemPart :ref="'remoteItemPartRef' + item.index" :index="item.index" @addLogAfter="addLogAfter"></RemoteItemPart>
</div>
</div>
<div class="remote-box row2">
<div class="left-box">
<div class="remote-item" v-for="item in remoteTask.slice(4)" :key="item.title" @click="openRemote(item)">
<RemoteItemPart :ref="'remoteItemPartRef' + item.index" :remoteTask="item" @addLogAfter="addLogAfter"></RemoteItemPart>
<RemoteItemPart :ref="'remoteItemPartRef' + item.index" :index="item.index" @addLogAfter="addLogAfter"></RemoteItemPart>
</div>
</div>
<div class="right-box">