diff --git a/src/static-data/core.ts b/src/static-data/core.ts index e4d9a76..2af4174 100644 --- a/src/static-data/core.ts +++ b/src/static-data/core.ts @@ -1,110 +1,128 @@ -import {getData, postData} from '@/axios/index' +import { getData, postData } from '@/axios/index' export const getHospitalsData = () => { - const hospitals = [] as any - hospitals.push({ label: '北京朝阳医院', value: '北京朝阳医院' }) - hospitals.push({ label: '北京朝阳医院1', value: '北京朝阳医院1' }) - hospitals.push({ label: '北京朝阳医院2', value: '北京朝阳医院2' }) - return new Promise((resolve, reject) => { - getData('/url', {}).then((res: any) => { - resolve(hospitals) - }).catch((err: any) => { - resolve(hospitals) - }) + const hospitals = [] as any + hospitals.push({ label: '北京朝阳医院', value: '北京朝阳医院' }) + hospitals.push({ label: '北京朝阳医院1', value: '北京朝阳医院1' }) + hospitals.push({ label: '北京朝阳医院2', value: '北京朝阳医院2' }) + return new Promise((resolve, reject) => { + getData('/url', {}).then((res: any) => { + resolve(hospitals) + }).catch((err: any) => { + resolve(hospitals) }) + }) } export const getPhoneAreasData = () => { - return ['中国 +86'] + return ['中国 +86'] } export const getDeptData = () => { - const depts = [] - depts.push({ label: '神经外科', value: '神经外科' }) - depts.push({ label: '心脏内科', value: '心脏内科' }) - return depts + const depts = [] + depts.push({ label: '神经外科', value: '神经外科' }) + depts.push({ label: '心脏内科', value: '心脏内科' }) + return depts } export const getMessageType = () => { - const type = [] - type.push({ label: '通知', value: '通知' }) - type.push({ label: '公告', value: '公告' }) - return type + const type = [] + type.push({ label: '通知', value: '通知' }) + type.push({ label: '公告', value: '公告' }) + return type } export const getLogType = () => { - const type = [] - type.push({ label: '正常', value: '正常' }) - type.push({ label: '异常', value: '异常' }) - type.push({ label: '添加', value: '添加' }) - type.push({ label: '删除', value: '删除' }) - type.push({ label: '编辑', value: '编辑' }) - return type + const type = [] + type.push({ label: '正常', value: '正常' }) + type.push({ label: '异常', value: '异常' }) + type.push({ label: '添加', value: '添加' }) + type.push({ label: '删除', value: '删除' }) + type.push({ label: '编辑', value: '编辑' }) + return type } export const getusers = () => { - const user = [] - while (user.length < 50) { - user.push({ name: '管理员' + user.length, code: 'admin' + user.length }) - } - return user + const user = [] + while (user.length < 50) { + user.push({ name: '管理员' + user.length, code: 'admin' + user.length }) + } + return user } // 病人名称数据 export const getPatients = () => { - const patients = [] - while (patients.length < 10000) { - patients.push({ name: '张' + patients.length, code: 'BH' + patients.length }) - } - return patients + const patients = [] + while (patients.length < 10000) { + patients.push({ name: '张' + patients.length, code: 'BH' + patients.length }) + } + return patients } export const getNarcotismWay = () => { - const narcotismWay = [] - while (narcotismWay.length < 10) { - const str: string = '麻醉方式' + (narcotismWay.length + 1) - narcotismWay.push({label: str, value: str}) - } - return narcotismWay + const narcotismWay = [] + while (narcotismWay.length < 10) { + const str: string = '麻醉方式' + (narcotismWay.length + 1) + narcotismWay.push({ label: str, value: str }) + } + return narcotismWay } export const getFormTypes = () => { - const types = [ - {name: '生命体征表单'}, - {name: 'AI给药记录'}, - {name: '医生给药记录'}, - {name: '给药命令反馈'}, - {name: '输药泵定时间反馈'}, - {name: '术后信息表单'}, - {name: '1生命体征表单'}, - {name: '1AI给药记录'}, - {name: '1医生给药记录'}, - {name: '1给药命令反馈'}, - {name: '1输药泵定时间反馈'}, - {name: '1术后信息表单'}, - {name: '2生命体征表单'}, - {name: '2AI给药记录'}, - {name: '2医生给药记录'}, - {name: '2给药命令反馈'}, - {name: '2输药泵定时间反馈'}, - {name: '2术后信息表单'}, - ] - return types + const types = [ + { name: '生命体征表单' }, + { name: 'AI给药记录' }, + { name: '医生给药记录' }, + { name: '给药命令反馈' }, + { name: '输药泵定时间反馈' }, + { name: '术后信息表单' }, + { name: '1生命体征表单' }, + { name: '1AI给药记录' }, + { name: '1医生给药记录' }, + { name: '1给药命令反馈' }, + { name: '1输药泵定时间反馈' }, + { name: '1术后信息表单' }, + { name: '2生命体征表单' }, + { name: '2AI给药记录' }, + { name: '2医生给药记录' }, + { name: '2给药命令反馈' }, + { name: '2输药泵定时间反馈' }, + { name: '2术后信息表单' }, + ] + return types } -export const getDataAlarmState = (value: number, key: string) => { - const alarms: any = { - BIS: { min: 40, max: 60 }, - HR: { min: 50, max: 80 }, - SBP: { min: 90, max: 120 }, - DBP: { min: 60, max: 90 }, - ST: { min: -0.2, max: 0.2 }, - EtCO2: { min: 30, max: 45 } - } - const obj = alarms[key] - let res: 'min' | 'max' | '' = '' - if(obj) { - if(value < obj.min) res = 'min' - else if(value > obj.max) res = 'max' - } - return res +export const getDataAlarmState = (value: number | undefined, key: string) => { + if (value === undefined) return + const alarms: any = { + BIS: { min: 40, max: 60 }, + HR: { min: 50, max: 80 }, + SBP: { min: 90, max: 120 }, + DBP: { min: 60, max: 90 }, + ST: { min: -0.2, max: 0.2 }, + EtCO2: { min: 30, max: 45 } + } + const obj = alarms[key] + let res: 'min' | 'max' | '' = '' + if (obj) { + if (value < obj.min) res = 'min' + else if (value > obj.max) res = 'max' + } + return res +} + +export const setRemoteLog = (obj: any, callback: (title: string, size: string) => void) => { + 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) callback('脑电双频指数', alarms.BIS) + if (alarms.SBP) callback('收缩率', alarms.SBP) + if (alarms.SPO2) callback('氧饱和度', alarms.SPO2) + if (alarms.DBP) callback('舒张压', alarms.DBP) + if (alarms.HR) callback('心率', alarms.HR) + if (alarms.TEMP) callback('体温', alarms.TEMP) } \ No newline at end of file diff --git a/src/stores/remote-info-store.ts b/src/stores/remote-info-store.ts index 2218d3e..a263a5e 100644 --- a/src/stores/remote-info-store.ts +++ b/src/stores/remote-info-store.ts @@ -25,6 +25,11 @@ export const useRemoteStore = defineStore('remote', { this.remoteTasks[index].log.push(obj) } }, + setRemoteDataAlarm(bol: boolean, index: number) { + if(this.remoteTasks[index]) { + this.remoteTasks[index].dataAlarm = bol + } + }, getCurrentRemote() { return this.currentRemote }, diff --git a/src/views/remote-manage/part/message-item-part.vue b/src/views/remote-manage/part/message-item-part.vue index 50f6bb6..1061694 100644 --- a/src/views/remote-manage/part/message-item-part.vue +++ b/src/views/remote-manage/part/message-item-part.vue @@ -40,10 +40,12 @@ remoteTasks.value = useRemoteStore().remoteTasks // }) function scrollToBottom() { - listRef.value.scrollTo({ - top: listRef.value.scrollHeight, - behavior: 'smooth' - }); + setTimeout(() => { + listRef.value.scrollTo({ + top: listRef.value.scrollHeight, + behavior: 'smooth' + }) + }, 0) } diff --git a/src/views/remote-manage/part/message-part.vue b/src/views/remote-manage/part/message-part.vue index 7415b6c..9b18d71 100644 --- a/src/views/remote-manage/part/message-part.vue +++ b/src/views/remote-manage/part/message-part.vue @@ -3,9 +3,9 @@
消息通知
-
+
- {{ item.title + ' ' + item.state }} @@ -24,17 +24,25 @@ import { dateFormater } from '@/utils/date-util' defineExpose({ setData, + scrollToBottom }) const remoteStore = useRemoteStore() -const currentRemote = ref({} as RemoteItem) -currentRemote.value = useRemoteStore().currentRemote +const listRef = ref() function setData(e: RemoteLogItem, index: number) { remoteStore.setRemoteLog(e, index) - remoteStore.setCurrentRemoteLog(e) remoteStore.$patch({currentRemote: remoteStore.remoteTasks[index]}) } + +function scrollToBottom() { + setTimeout(() => { + listRef.value.scrollTo({ + top: listRef.value.scrollHeight, + behavior: 'smooth' + }) + }, 0) +} + } + + .content-box { + width: 100%; + height: calc(100% - 195px); + min-height: 600px; + margin-top: 15px; + background: white; + padding: 20px 50px; + display: flex; + justify-content: space-between; + + .remote-box { + width: calc(100% - 370px); + flex-grow: 1; + height: 100%; + } + + .message-box { + width: 350px; + height: 100%; + margin-left: 20px; + } + } +}