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

# Conflicts:
#	src/views/remote-manage/remote-control.vue
This commit is contained in:
熊猫 2024-05-29 14:26:50 +08:00
commit 3876d93321
12 changed files with 238 additions and 202 deletions

View File

@ -1,6 +1,7 @@
import * as other from "@/utils/other"; import * as other from "@/utils/other";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import request, {CommonHeaderEnum, postData} from "@/utils/request"; import request, {CommonHeaderEnum, postData} from "@/utils/request";
import { Local, Session } from "@/utils/storage";
const registerUrl = "/admin/register/user" const registerUrl = "/admin/register/user"
@ -8,6 +9,9 @@ const logoutUrl = "/admin/token/logout"
export const login = (data: any) => { export const login = (data: any) => {
return new Promise(resolve => { return new Promise(resolve => {
Local.clear()
Session.clear()
const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_PASSWORD_CLIENT); const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_PASSWORD_CLIENT);
let encPassword = data.password; let encPassword = data.password;

View File

@ -66,7 +66,7 @@ export function userPage(data: any) {
}).then((res: any) => { }).then((res: any) => {
resolve(res.data) resolve(res.data)
}).catch(err => { }).catch(err => {
console.log(err) resolve(err)
}) })
}) })
} }
@ -77,7 +77,7 @@ export function userList(data: any): Promise<any> {
.then((res: any) => { .then((res: any) => {
resolve(res.data) resolve(res.data)
}).catch(err => { }).catch(err => {
console.log(err) resolve(err)
}) })
}) })
} }

View File

@ -1,5 +1,5 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { Local, Session } from "@/utils/storage"; import { 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()
@ -11,7 +11,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
patient: {} as any, patient: {} as any,
remoteTasks: [] as any, remoteTasks: [] as any,
remoteTasksCap: 10, remoteTasksCap: 10,
currentTaskIndex: 0, currentTaskIndex: -1,
varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"], varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"],
fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"], fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"],
exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"], exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"],
@ -24,26 +24,26 @@ export const useRemoteWsStore = defineStore("remoteWs", {
actions: { actions: {
setCurrentTaskIndex(i: number) { setCurrentTaskIndex(i: number) {
this.currentTaskIndex = i this.currentTaskIndex = i
Local.set("currentTaskIndex", i) Session.set("currentTaskIndex", i)
}, },
getCurrentTaskIndex() { getCurrentTaskIndex() {
if (Local.get("currentTaskIndex")) { if (Session.get("currentTaskIndex")) {
this.currentTaskIndex = Local.get("currentTaskIndex") this.currentTaskIndex = Session.get("currentTaskIndex")
} }
return this.currentTaskIndex return this.currentTaskIndex
}, },
setRemoteTask() { setRemoteTask() {
Local.set("remoteTasks", this.remoteTasks) Session.set("remoteTasks", this.remoteTasks)
}, },
getRemoteTask() { getRemoteTask() {
if (Local.get("remoteTasks")) { if (Session.get("remoteTasks")) {
this.remoteTasks = Local.get("remoteTasks") this.remoteTasks = Session.get("remoteTasks")
} }
return this.remoteTasks return this.remoteTasks
}, },
initRemoteTask() { initRemoteTask() {
if (Local.get("remoteTasks")) { if (Session.get("remoteTasks")) {
this.remoteTasks = Local.get("remoteTasks") this.remoteTasks = Session.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++) {
@ -79,7 +79,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
index: i, index: i,
message: [] message: []
}) })
Local.set("remoteTasks", this.remoteTasks) Session.set("remoteTasks", this.remoteTasks)
}, },
getActiveRemoteTask() { getActiveRemoteTask() {
for (let i = 0; i < this.remoteTasks.length; i++) { for (let i = 0; i < this.remoteTasks.length; i++) {
@ -89,8 +89,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
setRemoteLog(log: any, i: number) { setRemoteLog(log: any, i: number) {
this.remoteTasks[i].log.push(log) this.remoteTasks[i].log.push(log)
}, },
createConnect(name: string, id: string, date: string) { createConnect(name: string, id: string, date: string, index: number) {
if (!this.patient[name + id + date]) { if (!this.patient[name + id + date + index]) {
const vitalWS = new WebSocket(vitalUrl) const vitalWS = new WebSocket(vitalUrl)
const medicineWS = new WebSocket(medicineUrl) const medicineWS = new WebSocket(medicineUrl)
const chatWS = new WebSocket(chatUrl) const chatWS = new WebSocket(chatUrl)
@ -115,42 +115,42 @@ export const useRemoteWsStore = defineStore("remoteWs", {
date: date date: date
})) }))
} }
this.patient[name + id + date] = { this.patient[name + id + date + index] = {
vitalWS, vitalWS,
medicineWS, medicineWS,
chatWS chatWS
} }
} }
}, },
disconnect(name: string, id: string, date: string) { disconnect(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.vitalWS.close() patient.vitalWS.close()
patient.medicineWS.close() patient.medicineWS.close()
patient.chatWS.close() patient.chatWS.close()
delete this.patient[name + id + date] delete this.patient[name + id + date + index]
} }
}, },
subscribeVital(name: string, id: string, date: string, cb: any) { subscribeVital(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.vitalWS.onmessage = cb patient.vitalWS.onmessage = cb
patient.vitalCB = cb patient.vitalCB = cb
} else { } else {
this.createConnect(name, id, date) this.createConnect(name, id, date, index)
this.patient[name + id + date].vitalWS.onmessage = cb this.patient[name + id + date + index].vitalWS.onmessage = cb
this.patient[name + id + date].vitalCB = cb this.patient[name + id + date + index].vitalCB = cb
} }
}, },
unsubscribeVital(name: string, id: string, date: string) { unsubscribeVital(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
if (patient && patient.vitalWS) { if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = undefined; patient.vitalWS.onmessage = undefined;
patient.vitalCB = undefined; patient.vitalCB = undefined;
} }
}, },
sendMsg(name: string, id: string, date: string, msg: string, cb: any) { sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
const params = { const params = {
patientName: name, patientName: name,
@ -169,8 +169,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
subscribeChat(name: string, id: string, date: string, cb: any) { subscribeChat(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.chatCB = cb patient.chatCB = cb
patient.chatWS.onmessage = cb patient.chatWS.onmessage = cb
@ -181,8 +181,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
unsubscribeChat(name: string, id: string, date: string) { unsubscribeChat(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
patient.chatCB = undefined; patient.chatCB = undefined;
patient.chatWS.onmessage = undefined; patient.chatWS.onmessage = undefined;
}, },
@ -193,8 +193,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
flag: string, flag: string,
medicine: string, medicine: string,
value: string value: string
}, cb: any) { }, index: number, cb: any) {
const patient: any = this.patient[args.name + args.id + args.date] const patient: any = this.patient[args.name + args.id + args.date + index]
if (patient) { if (patient) {
const params = { const params = {
patientName: args.name, patientName: args.name,
@ -215,8 +215,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
subscribeMedicine(name: string, id: string, date: string, cb: any) { subscribeMedicine(name: string, id: string, date: string, index: number, cb: any) {
const patient = this.patient[name + id + date] const patient = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.medicineCB = cb patient.medicineCB = cb
patient.medicineWS.onmessage = cb patient.medicineWS.onmessage = cb
@ -227,8 +227,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
unsubscribeMedicine(name: string, id: string, date: string) { unsubscribeMedicine(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date + index]
patient.medicineCB = undefined; patient.medicineCB = undefined;
patient.medicineWS.onmessage = undefined; patient.medicineWS.onmessage = undefined;
} }

View File

@ -1,6 +1,6 @@
import {defineStore} from 'pinia' import {defineStore} from 'pinia'
import {getUserMenu} from "@/api/menu"; import {getUserMenu} from "@/api/menu";
import {Session} from "@/utils/storage"; import {Local, Session} from "@/utils/storage";
import router from "@/router"; import router from "@/router";
export const useUserStore = defineStore('login', { export const useUserStore = defineStore('login', {
@ -37,6 +37,7 @@ export const useUserStore = defineStore('login', {
}, },
logout() { logout() {
Session.clear(); Session.clear();
Local.clear();
router.removeRoute("root"); router.removeRoute("root");
router.addRoute({ router.addRoute({
name: "root", name: "root",

View File

@ -5,8 +5,8 @@
<div class="message-box"> <div class="message-box">
<el-carousel height="32px" direction="vertical" indicator-position="none" autoplay> <el-carousel height="32px" direction="vertical" indicator-position="none" autoplay>
<el-carousel-item v-for="(item, index) in messages" :key="'message-' + index"> <el-carousel-item v-for="(item, index) in messages" :key="'message-' + index">
<p class="text-row-1" style="line-height: 32px;" :class="{'is-link': item.href}" <p class="text-row-1" style="line-height: 32px;" :class="{ 'is-link': item.href }"
@click="userStore.showHomeMsg=true">{{ item.category }} {{ item.message }}</p> @click="userStore.showHomeMsg = true">{{ item.category }} {{ item.message }}</p>
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
</div> </div>
@ -17,7 +17,7 @@
</div> </div>
<div class="header-item"> <div class="header-item">
<el-icon class="text1-color" style="font-size: 26px;margin-right: 20px;"> <el-icon class="text1-color" style="font-size: 26px;margin-right: 20px;">
<Calendar/> <Calendar />
</el-icon> </el-icon>
<div> <div>
<p class="text1-color f14">待办任务</p> <p class="text1-color f14">待办任务</p>
@ -27,22 +27,22 @@
</div> </div>
<div class="echart-box"> <div class="echart-box">
<div class="echart-item"> <div class="echart-item">
<NumberChart/> <NumberChart />
</div> </div>
<div class="echart-item"> <div class="echart-item">
<NumberPieChart/> <NumberPieChart />
</div> </div>
<div class="echart-item"> <div class="echart-item">
<TimeChart/> <TimeChart />
</div> </div>
<div class="echart-item"> <div class="echart-item">
<TimeBarChart/> <TimeBarChart />
</div> </div>
</div> </div>
</div> </div>
<div class="right-content"> <div class="right-content">
<div class="week-calendar"> <div class="week-calendar">
<WeekCalendar/> <WeekCalendar />
</div> </div>
<div class="system-logs" v-if="showLogMod"> <div class="system-logs" v-if="showLogMod">
<div class="title"> <div class="title">
@ -50,51 +50,18 @@
<span class="f14" style="cursor: pointer;" @click="router.push('./logs-manage/logs-manage')">更多</span> <span class="f14" style="cursor: pointer;" @click="router.push('./logs-manage/logs-manage')">更多</span>
</div> </div>
<div class="content"> <div class="content">
<SystemLogs/> <SystemLogs />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import {onMounted, ref} from 'vue' import { onMounted, ref } from 'vue'
import {useRouter} from 'vue-router' import { useRouter } from 'vue-router'
import {useUserStore} from '@/stores/user-info-store' import { useUserStore } from '@/stores/user-info-store'
import NumberChart from "./number-chart.vue"; import NumberChart from "./number-chart.vue";
import NumberPieChart from "./number-pie-chart.vue"; import NumberPieChart from "./number-pie-chart.vue";
import TimeChart from "./time-chart.vue"; import TimeChart from "./time-chart.vue";
@ -102,7 +69,7 @@ import TimeBarChart from "./time-bar-chart.vue";
import WeekCalendar from "./week-calendar.vue"; import WeekCalendar from "./week-calendar.vue";
import SystemLogs from "@/components/system-logs.vue"; import SystemLogs from "@/components/system-logs.vue";
import * as dailyPlanApi from "@/api/daily-plan"; import * as dailyPlanApi from "@/api/daily-plan";
import {dateFormater} from "@/utils/date-util"; import { dateFormater } from "@/utils/date-util";
import * as msgApi from "@/api/sys-message"; import * as msgApi from "@/api/sys-message";
const router = useRouter() const router = useRouter()
@ -110,10 +77,6 @@ const userStore = useUserStore();
const userInfo = userStore.getlogin() const userInfo = userStore.getlogin()
const showLogMod = ref(false) const showLogMod = ref(false)
const messages = ref([] as any) const messages = ref([] as any)
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
const todoTotal = ref(0) // const todoTotal = ref(0) //
onMounted(() => { onMounted(() => {
@ -131,9 +94,6 @@ function init() {
}); });
getTodoCount(); getTodoCount();
messages.value = []; messages.value = [];
messageTable.value = [];
current.value = 1
total.value = 0
loadMsg(); loadMsg();
} }
@ -145,25 +105,11 @@ function getTodoCount() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() { async function loadMsg() {
const res = await msgApi.page(current.value, size.value) const res = await msgApi.page(0, 10)
if (res.code == 0) { if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => { res.data.records.forEach((row: any) => {
if (current.value == 1) { messages.value.push(row)
messages.value.push(row)
}
messageTable.value.push(row)
}) })
} }
} }
@ -224,7 +170,7 @@ async function loadMsg() {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
& ~ .header-item { &~.header-item {
width: 40%; width: 40%;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
@ -307,4 +253,5 @@ async function loadMsg() {
background: white; background: white;
} }
} }
}</style> }
</style>

View File

@ -56,6 +56,39 @@
<el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false"> <el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false">
<userInfoForm @close="isShowUserInfoDrawer = false"/> <userInfoForm @close="isShowUserInfoDrawer = false"/>
</el-drawer> </el-drawer>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
@ -67,6 +100,7 @@ import {useUserStore} from '@/stores/user-info-store'
import userInfoForm from '@/components/user-info.vue' import userInfoForm from '@/components/user-info.vue'
import {logout} from "@/api/login"; import {logout} from "@/api/login";
import * as hospitalApi from "@/api/hospital"; import * as hospitalApi from "@/api/hospital";
import * as msgApi from "@/api/sys-message";
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -78,6 +112,10 @@ const hospitals = ref([] as any)
const menus = ref([] as any) const menus = ref([] as any)
const isShowUserInfoDrawer = ref(false) const isShowUserInfoDrawer = ref(false)
const menuActive = ref('/') const menuActive = ref('/')
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
router.isReady().then(() => { router.isReady().then(() => {
menuActive.value = route.path menuActive.value = route.path
@ -94,6 +132,9 @@ onMounted(() => {
function init() { function init() {
getHospitalList(); getHospitalList();
handleMenu(); handleMenu();
messageTable.value = [];
current.value = 1
total.value = 0
} }
function handleMenu() { function handleMenu() {
@ -102,6 +143,26 @@ function handleMenu() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() {
const res = await msgApi.page(current.value, size.value)
if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => {
messageTable.value.push(row)
})
}
}
const menuToPath = (e: any) => { const menuToPath = (e: any) => {
menuActive.value = e.path menuActive.value = e.path
router.push(e.path) router.push(e.path)
@ -113,7 +174,7 @@ async function getHospitalList() {
hospitals.value = []; hospitals.value = [];
if (res.code == 0 && res.data.length > 0) { if (res.code == 0 && res.data.length > 0) {
hospitals.value = res.data; hospitals.value = res.data;
if (data.data) { if (data.data && data.data != 'null') {
hospital.value = data.data; hospital.value = data.data;
} }
preHospital.value = hospital.value preHospital.value = hospital.value

View File

@ -50,7 +50,8 @@ defineExpose({
}) })
function open(i: number) { function open(i: number) {
patientInfo.value = remoteWsStore.remoteTasks[i]; remoteWsStore.setCurrentTaskIndex(i)
patientInfo.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()];
patientInfo.value.date = new Date(); patientInfo.value.date = new Date();
dialogVisible.value = true; dialogVisible.value = true;
} }
@ -96,7 +97,7 @@ const unsubscribeLastTask = () => {
const lastTaskIndex = remoteWsStore.currentTaskIndex; const lastTaskIndex = remoteWsStore.currentTaskIndex;
const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex]; const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex];
if (lastTask) { if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date); remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTaskIndex);
} }
} }

View File

@ -77,7 +77,7 @@ onMounted(() => {
} }
}) })
onUnmounted(() => { onUnmounted(() => {
remoteWsStore.unsubscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date); remoteWsStore.unsubscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, props.index);
}) })
function initData() { function initData() {
@ -85,7 +85,7 @@ function initData() {
} }
function subscribeVital() { function subscribeVital() {
remoteWsStore.subscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, (res: any) => { remoteWsStore.subscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, props.index, (res: any) => {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
if (data.vitalSignsList && data.vitalSignsList.length > 0) { if (data.vitalSignsList && data.vitalSignsList.length > 0) {
Object.assign(patientInfo.value, data.vitalSignsList[0]); Object.assign(patientInfo.value, data.vitalSignsList[0]);

View File

@ -19,7 +19,7 @@
<div class="row-item"> <div class="row-item">
<span class="label">手术时间</span> <span class="label">手术时间</span>
<span class="input-value">{{ <span class="input-value">{{
remoteItem.date remoteItem?.date
}}</span> }}</span>
</div> </div>
<div class="row-item"> <div class="row-item">
@ -62,11 +62,11 @@
<div class="info-box"> <div class="info-box">
<div class="row-item"> <div class="row-item">
<span class="label">病人名称</span> <span class="label">病人名称</span>
<span class="input-value">{{ remoteItem.patient }}</span> <span class="input-value">{{ remoteItem?.patient }}</span>
</div> </div>
<div class="row-item"> <div class="row-item">
<span class="label">住院号</span> <span class="label">住院号</span>
<span class="input-value">{{ remoteItem.patientId }}</span> <span class="input-value">{{ remoteItem?.patientId }}</span>
</div> </div>
</div> </div>
<div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }"> <div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }">
@ -90,7 +90,7 @@
<div class="row-item"> <div class="row-item">
<span class="label">手术时间</span> <span class="label">手术时间</span>
<span class="input-value">{{ <span class="input-value">{{
remoteItem.date remoteItem?.date
}}</span> }}</span>
</div> </div>
<div class="row-item"> <div class="row-item">
@ -123,6 +123,7 @@ import { useRemoteWsStore } from "@/stores/remote-ws-store";
const emit = defineEmits(['addLogAfter', 'breakRemote']) const emit = defineEmits(['addLogAfter', 'breakRemote'])
const mediaMini800 = ref(false) const mediaMini800 = ref(false)
const remoteItem = ref({} as any) const remoteItem = ref({} as any)
let currentIndex = -1;
const patientInfo = ref({} as any) const patientInfo = ref({} as any)
const remoteWsStore = useRemoteWsStore() const remoteWsStore = useRemoteWsStore()
@ -139,43 +140,47 @@ onMounted(() => {
}) })
onUnmounted(() => { onUnmounted(() => {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date); remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
}) })
function showData(i: any) { function showData(i: any) {
const lastTaskIndex = remoteWsStore.currentTaskIndex; const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex]; const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
if (lastTask) { if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date); remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTaskIndex);
} }
remoteWsStore.currentTaskIndex = i remoteWsStore.setCurrentTaskIndex(i)
remoteItem.value = remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex] currentIndex = remoteWsStore.getCurrentTaskIndex()
remoteItem.value = remoteWsStore.getRemoteTask()[currentIndex]
getData() getData()
} }
function initData() { function initData() {
const remoteTasks = remoteWsStore.getRemoteTask(); const remoteTasks = remoteWsStore.getRemoteTask()
remoteItem.value = remoteTasks[remoteWsStore.getCurrentTaskIndex()] currentIndex = remoteWsStore.getCurrentTaskIndex()
if (remoteItem.value) { remoteItem.value = remoteTasks[currentIndex]
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date) if (remoteItem.value && remoteItem.value.patient) {
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
getData() getData()
} }
} }
function getData() { function getData() {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date); if (currentIndex > -1 && remoteItem.value.patient) {
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, (res: any) => { remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
if (res && res.data) { remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, (res: any) => {
const data = JSON.parse(res.data); if (res && res.data) {
if (data.vitalSignsList && data.vitalSignsList.length > 0) { const data = JSON.parse(res.data);
Object.assign(patientInfo.value, data.vitalSignsList[0]); if (data.vitalSignsList && data.vitalSignsList.length > 0) {
patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except || Object.assign(patientInfo.value, data.vitalSignsList[0]);
patientInfo.value.DBP_except || patientInfo.value.HR_except); patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except ||
setLog(patientInfo.value) patientInfo.value.DBP_except || patientInfo.value.HR_except);
emit('addLogAfter') setLog(patientInfo.value)
emit('addLogAfter')
}
} }
} })
}) }
} }
function setLog(data: any) { function setLog(data: any) {
@ -187,14 +192,15 @@ function setLog(data: any) {
taskName: remoteItem.value.taskName, taskName: remoteItem.value.taskName,
time: new Date(), time: new Date(),
type: "exception" type: "exception"
}, remoteWsStore.currentTaskIndex); }, currentIndex);
} }
}) })
} }
const breakRemote = () => { const breakRemote = () => {
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date) remoteWsStore.getRemoteTask()[currentIndex]
remoteWsStore.resetRemoteTask(remoteWsStore.currentTaskIndex) remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.resetRemoteTask(currentIndex)
if (remoteWsStore.getActiveRemoteTask()) { if (remoteWsStore.getActiveRemoteTask()) {
showData(remoteWsStore.getActiveRemoteTask()) showData(remoteWsStore.getActiveRemoteTask())
} }

View File

@ -106,8 +106,8 @@
<el-dropdown-item command="速度(ml/h)">速度(ml/h)</el-dropdown-item> <el-dropdown-item command="速度(ml/h)">速度(ml/h)</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column prop="total" label="累计药量(ml)" width="100"> <el-table-column prop="total" label="累计药量(ml)" width="100">
<template #default="scope"></template> <template #default="scope"></template>
@ -129,7 +129,7 @@
</el-button> </el-button>
<!--<el-button size="small" color="#006080" @click="tableItemConfirm(scope)" <!--<el-button size="small" color="#006080" @click="tableItemConfirm(scope)"
:disabled="tableDataStore[scope.$index].speed === scope.row.speed">确定--> :disabled="tableDataStore[scope.$index].speed === scope.row.speed">确定-->
<!--<el-button size="small" color="#006080" @click="tableItemConfirm(scope, varTableData)">确定 <!--<el-button size="small" color="#006080" @click="tableItemConfirm(scope, varTableData)">确定
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消 <el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消
</el-button> </el-button>
@ -269,13 +269,15 @@ onMounted(() => {
}); });
onUnmounted(() => { onUnmounted(() => {
remoteWsStore.unsubscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); const index = remoteWsStore.getCurrentTaskIndex()
remoteWsStore.unsubscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); remoteWsStore.unsubscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index);
remoteWsStore.unsubscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); remoteWsStore.unsubscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index);
remoteWsStore.unsubscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index);
}) })
function subscribeWS() { function subscribeWS() {
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, const index = remoteWsStore.getCurrentTaskIndex()
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index,
function (res: any) { function (res: any) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
chartDom1.value.updateChartData(data.vitalSignsList[0]); chartDom1.value.updateChartData(data.vitalSignsList[0]);
@ -285,12 +287,12 @@ function subscribeWS() {
updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]); updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]);
}) })
remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index,
function (res: any) { function (res: any) {
mssageList.value.push(JSON.parse(res.data)); mssageList.value.push(JSON.parse(res.data));
}) })
remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, index,
function (res: any) { function (res: any) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
if (data.status != 1) { if (data.status != 1) {
@ -487,8 +489,9 @@ const playPause = () => {
} }
const sendMsg = () => { const sendMsg = () => {
if (msgVal.value.trim() == '') return; if (msgVal.value.trim() == '') return;
const index = remoteWsStore.getCurrentTaskIndex()
remoteWsStore.sendMsg(currentRemote.value.patient, currentRemote.value.patientId, remoteWsStore.sendMsg(currentRemote.value.patient, currentRemote.value.patientId,
currentRemote.value.date, msgVal.value, function (res: any) { currentRemote.value.date, msgVal.value, index, function (res: any) {
if (res.code == 1) { if (res.code == 1) {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
@ -530,7 +533,8 @@ const tableItemConfirm = (e: any, tableData: any) => {
medicine: e.row.name, medicine: e.row.name,
value: e.row.speed value: e.row.speed
} }
remoteWsStore.sendMedicine(params, function () { const index = remoteWsStore.getCurrentTaskIndex()
remoteWsStore.sendMedicine(params, index, function () {
}); });
} }
@ -545,7 +549,8 @@ function startAI() {
date: currentRemote.value.date, date: currentRemote.value.date,
flag: "0", flag: "0",
} }
remoteWsStore.sendMedicine(params, function () { const index = remoteWsStore.getCurrentTaskIndex()
remoteWsStore.sendMedicine(params, index, function () {
}); });
} }

View File

@ -3,41 +3,40 @@
<div class="header-box"> <div class="header-box">
<div class="thumbnail" @click="viewThumbnail"> <div class="thumbnail" @click="viewThumbnail">
<el-icon> <el-icon>
<Menu/> <Menu />
</el-icon> </el-icon>
<span>缩略图</span> <span>缩略图</span>
</div> </div>
<div class="task-btn-item" v-for="(item, index) in remoteTask" :key="'task-' + index" <div class="task-btn-item" v-for="(item, index) in remoteWsStore.remoteTasks" :key="'task-' + index"
:class="{ 'connecting': item.patient || item.patientId, 'alarm': item.isException }" :class="{ 'connecting': item.patient || item.patientId, 'alarm': item.isException }"
@click="editTask(item)" @dblclick="toRemoteControl(item)"> @click="editTask(item)" @dblclick="toRemoteControl(item)">
<span>{{ item.taskName || ('新建任务' + (index + 1)) }}</span> <span>{{ item.taskName || ('新建任务' + (index + 1)) }}</span>
</div> </div>
</div> </div>
<div class="content-box"> <div class="content-box">
<div class="remote-box"> <div class="remote-box">
<RemotePart ref="remotePartRef" @addLogAfter="addLogAfter" @breakRemote="breakRemote"/> <RemotePart ref="remotePartRef" @addLogAfter="addLogAfter" @breakRemote="breakRemote" />
</div> </div>
<div class="message-box"> <div class="message-box">
<MessagePart ref="messagePartRef"/> <MessagePart ref="messagePartRef" />
</div> </div>
</div> </div>
</div> </div>
<RemoteDialog ref="remoteDialogRef" @confirmRemote="confirmRemote" @errorRemote="errorRemote"/> <RemoteDialog ref="remoteDialogRef" @confirmRemote="confirmRemote" @errorRemote="errorRemote" />
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import {onMounted, ref} from 'vue' import { onMounted, ref } from 'vue'
import {useRouter} from 'vue-router' import { useRouter } from 'vue-router'
import RemoteDialog from './part/remote-dialog.vue' import RemoteDialog from './part/remote-dialog.vue'
import RemotePart from './part/remote-part.vue' import RemotePart from './part/remote-part.vue'
import MessagePart from './part/message-part.vue' import MessagePart from './part/message-part.vue'
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import { useRemoteWsStore } from "@/stores/remote-ws-store";
const router = useRouter() const router = useRouter()
const remotePartRef = ref() const remotePartRef = ref()
const messagePartRef = ref() const messagePartRef = ref()
const remoteDialogRef = ref() const remoteDialogRef = ref()
const remoteTask = ref([] as Array<any>)
const remoteWsStore = useRemoteWsStore(); const remoteWsStore = useRemoteWsStore();
onMounted(() => { onMounted(() => {
@ -45,8 +44,8 @@ onMounted(() => {
}) })
function initRemoteTask() { function initRemoteTask() {
remoteTask.value = remoteWsStore.initRemoteTask() remoteWsStore.initRemoteTask()
remotePartRef.value.showData(remoteWsStore.currentTaskIndex); remotePartRef.value.showData(remoteWsStore.getCurrentTaskIndex());
} }
const viewThumbnail = () => { const viewThumbnail = () => {
@ -69,6 +68,7 @@ const editTask = (item: any) => {
const toRemoteControl = (item: any) => { const toRemoteControl = (item: any) => {
// //
if (item.isRemote) { if (item.isRemote) {
remoteWsStore.setCurrentTaskIndex(item.index)
router.push('/remote-manage/remote-control') router.push('/remote-manage/remote-control')
} else { } else {
remoteDialogRef.value.open(item.index) remoteDialogRef.value.open(item.index)
@ -133,7 +133,7 @@ const addLogAfter = () => {
font-size: 1.4em; font-size: 1.4em;
} }
& > span { &>span {
display: none; display: none;
margin-left: 5px; margin-left: 5px;
line-height: 1; line-height: 1;
@ -144,7 +144,7 @@ const addLogAfter = () => {
width: 160px; width: 160px;
transition: all .3s; transition: all .3s;
& > span { &>span {
display: block; display: block;
} }
} }
@ -214,4 +214,5 @@ const addLogAfter = () => {
margin-left: 20px; margin-left: 20px;
} }
} }
}</style> }
</style>

View File

@ -1,36 +1,36 @@
<template> <template>
<el-scrollbar style="width: 100%;height: 100%;"> <el-scrollbar style="width: 100%;height: 100%;">
<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" :index="item.index" <RemoteItemPart :ref="'remoteItemPartRef' + item.index" :index="item.index" @addLogAfter="addLogAfter">
@addLogAfter="addLogAfter"></RemoteItemPart> </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" :index="item.index" <RemoteItemPart :ref="'remoteItemPartRef' + item.index" :index="item.index" @addLogAfter="addLogAfter">
@addLogAfter="addLogAfter"></RemoteItemPart> </RemoteItemPart>
</div> </div>
</div> </div>
<div class="right-box"> <div class="right-box">
<div class="message-title">异常信息</div> <div class="message-title">异常信息</div>
<div class="message-item" v-for="item in remoteTask" :key="'message-item' + item"> <div class="message-item" v-for="item in remoteTask" :key="'message-item' + item">
<MessageItemPart ref="messageItemPartRef" :index="item.index"></MessageItemPart> <MessageItemPart ref="messageItemPartRef" :index="item.index"></MessageItemPart>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</el-scrollbar> </el-scrollbar>
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import {onMounted, ref} from 'vue'; import { onMounted, ref } from 'vue';
import {useRoute, useRouter} from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import RemoteItemPart from './part/remote-item-part.vue'; import RemoteItemPart from './part/remote-item-part.vue';
import MessageItemPart from './part/message-item-part.vue'; import MessageItemPart from './part/message-item-part.vue';
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import { useRemoteWsStore } from "@/stores/remote-ws-store";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -39,45 +39,53 @@ const remoteTask = ref([] as any);
const remoteWsStore = useRemoteWsStore(); const remoteWsStore = useRemoteWsStore();
onMounted(() => { onMounted(() => {
remoteTask.value = remoteWsStore.getRemoteTask(); remoteTask.value = remoteWsStore.getRemoteTask();
}) })
const openRemote = (params: any) => { const openRemote = (params: any) => {
router.push('/remote-manage/remote-manage'); remoteWsStore.setCurrentTaskIndex(params.index)
router.push('/remote-manage/remote-manage');
} }
const addLogAfter = (index: number) => { const addLogAfter = (index: number) => {
messageItemPartRef.value[index].scrollToBottom() messageItemPartRef.value[index].scrollToBottom()
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
$size: 20px; $size: 20px;
.remote-thumbnail-page { .remote-thumbnail-page {
width: 100%; width: 100%;
height: 1010px; height: 1010px;
overflow: auto; overflow: auto;
.remote-box { .remote-box {
width: 100%; width: 100%;
height: 33.33%; height: 33.33%;
display: flex; display: flex;
.remote-item { .remote-item {
width: 25%; width: 25%;
height: 100%; height: 100%;
padding: $size*0.2; padding: $size*0.2;
} }
&.row2 { &.row2 {
height: 66.67%; height: 66.67%;
.left-box { .left-box {
width: 75%; width: 75%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.remote-item { .remote-item {
width: 33.33%; width: 33.33%;
height: 50%; height: 50%;
} }
} }
.right-box { .right-box {
position: relative; position: relative;
width: 25%; width: 25%;
@ -86,6 +94,7 @@ $size: 20px;
padding-top: $size*0.2 + $size; padding-top: $size*0.2 + $size;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.message-title { .message-title {
position: absolute; position: absolute;
height: $size; height: $size;
@ -99,6 +108,7 @@ $size: 20px;
color: white; color: white;
font-weight: 600; font-weight: 600;
} }
.message-item { .message-item {
width: 50%; width: 50%;
height: 20%; height: 20%;