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 type { RemoteItem, PatientInfoItem, RemoteLogItem } from '@/utils/public-interface'
import { useRemoteStore } from '@/stores/remote-info-store' import { useRemoteStore } from '@/stores/remote-info-store'
import { dateFormater } from '@/utils/date-util' import { dateFormater } from '@/utils/date-util'
import { getDataAlarmState } from '@/static-data/core' import { setRemoteLog } from '@/static-data/core'
interface Props { interface Props {
remoteTask: RemoteItem index: number
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
remoteTask: () => ({} as RemoteItem) index: () => 0
}) })
const emit = defineEmits(['addLogAfter']) const emit = defineEmits(['addLogAfter'])
const remoteStore = useRemoteStore()
const remoteTask = remoteStore.remoteTasks[props.index]
let timer = 0 let timer = 0
const patientInfo = ref({} as PatientInfoItem) const patientInfo = ref({} as PatientInfoItem)
onMounted(() => { onMounted(() => {
clearInterval(timer) clearInterval(timer)
// //
if (props.remoteTask.isRemote) { if (remoteTask.isRemote) {
timer = setInterval(() => { timer = setInterval(() => {
initData() initData()
}, 2000) }, 2000)
@ -87,13 +89,13 @@ onMounted(() => {
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
// //
console.log('~~~~~~~~~~~~~~~')
clearInterval(timer) clearInterval(timer)
}) })
function initData() { function initData() {
remoteTask.dataAlarm = false
const obj = { const obj = {
name: props.remoteTask.patientName, name: remoteTask.patientName,
code: '', code: '',
time: new Date(), time: new Date(),
state: false, state: false,
@ -104,33 +106,17 @@ function initData() {
HR: Number((Math.random() * 100).toFixed(2)), HR: Number((Math.random() * 100).toFixed(2)),
TEMP: Number((Math.random() * 100).toFixed(2)) TEMP: Number((Math.random() * 100).toFixed(2))
} }
const alarms = { setRemoteLog(obj, (title: string, size: string) => {
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) {
obj.state = true obj.state = true
useRemoteStore().setRemoteLog({ remoteTask.dataAlarm = true
remoteStore.setRemoteLog({
time: new Date(), time: new Date(),
title, title,
state: '异常' state: '异常'
}, props.remoteTask.index) }, props.index)
emit('addLogAfter', props.remoteTask.index) })
} Object.assign(patientInfo.value, obj)
emit('addLogAfter', props.index)
} }
</script> </script>

View File

@ -158,6 +158,7 @@ function initData(e?: RemoteItem) {
function getData() { function getData() {
remoteItem.value.dataAlarm = false remoteItem.value.dataAlarm = false
const obj = { const obj = {
state: false,
BIS: Math.ceil(Math.random() * 100), BIS: Math.ceil(Math.random() * 100),
SBP: Math.ceil(Math.random() * 100), SBP: Math.ceil(Math.random() * 100),
SPO2: 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' import MessagePart from './part/message-part.vue'
const router = useRouter() const router = useRouter()
const remoteStore = useRemoteStore()
const remotePartRef = ref() const remotePartRef = ref()
const messagePartRef = ref() const messagePartRef = ref()
@ -55,7 +56,7 @@ function resetRemoteTaskItem(e: RemoteItem) {
}) })
} }
function initRemoteTask() { function initRemoteTask() {
remoteTask.value = useRemoteStore().remoteTasks remoteTask.value = remoteStore.remoteTasks
if (remoteTask.value.length < 1) { if (remoteTask.value.length < 1) {
while (remoteTask.value.length < 10) { while (remoteTask.value.length < 10) {
const obj = { const obj = {
@ -77,10 +78,9 @@ function initRemoteTask() {
if (remoteTask.value.length == 1) obj.dataAlarm = true if (remoteTask.value.length == 1) obj.dataAlarm = true
remoteTask.value.push(obj) remoteTask.value.push(obj)
} }
useRemoteStore().setRemoteTasks(remoteTask.value) remoteStore.setRemoteTasks(remoteTask.value)
const remoteStore = useRemoteStore().currentRemote if (!remoteStore.currentRemote.index) {
if (!remoteStore.index) { remoteStore.$patch({ currentRemote: remoteTask.value[0] })
useRemoteStore().$patch({ currentRemote: remoteTask.value[0] })
} }
} }
} }

View File

@ -3,13 +3,13 @@
<div class="remote-thumbnail-page"> <div class="remote-thumbnail-page">
<div class="remote-box row1"> <div class="remote-box row1">
<div class="remote-item" v-for="item in remoteTask.slice(0, 4)" :key="item.title" @click="openRemote(item)"> <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> </div>
<div class="remote-box row2"> <div class="remote-box row2">
<div class="left-box"> <div class="left-box">
<div class="remote-item" v-for="item in remoteTask.slice(4)" :key="item.title" @click="openRemote(item)"> <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> </div>
<div class="right-box"> <div class="right-box">