远程控制两个列表字段调整

This commit is contained in:
GranceWang 2024-08-08 10:34:49 +08:00
parent dbb4bd5da2
commit 277ee0ff36

View File

@ -100,11 +100,12 @@
<!-- table1 --> <!-- table1 -->
<div class="table-box"> <div class="table-box">
<el-table :data="varTableData" height="100%" style="width: 100%"> <el-table :data="varTableData" height="100%" style="width: 100%">
<el-table-column prop="num" label="泵号" width="40" align="center"/> <el-table-column prop="linkNum" label="泵号" width="40" align="center"/>
<el-table-column prop="name" label="药物名称" align="center"/> <el-table-column prop="medicineName" label="药物名称" align="center"/>
<el-table-column prop="speed" label="速度(ml/h)" width="120"> <el-table-column prop="medicineRate" label="速度(ml/h)" width="120">
<template #header> <template #header>
<el-dropdown @command="table1SpeedCommand"> <span>速度(ml/h)</span>
<!-- <el-dropdown @command="table1SpeedCommand">
<span style="color: white;font-size: 14px;line-height: 20px;"> <span style="color: white;font-size: 14px;line-height: 20px;">
{{ table1SpeedVal || '请选择速度' }} {{ table1SpeedVal || '请选择速度' }}
</span> </span>
@ -115,11 +116,10 @@
<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="countMedicine" label="累计药量(ml)" width="100">
<template #default="scope"></template>
</el-table-column> </el-table-column>
<el-table-column prop="state" label="工作状态" width="70" align="center"/> <el-table-column prop="state" label="工作状态" width="70" align="center"/>
<el-table-column label="特殊情况人为干预" align="center"> <el-table-column label="特殊情况人为干预" align="center">
@ -151,11 +151,10 @@
<!-- table2 --> <!-- table2 -->
<div class="table-box"> <div class="table-box">
<el-table :data="fixedTableData" height="100%" style="width: 100%"> <el-table :data="fixedTableData" height="100%" style="width: 100%">
<el-table-column prop="num" label="泵号" width="40" align="center"/> <el-table-column prop="linkNum" label="泵号" width="40" align="center"/>
<el-table-column prop="name" label="药物名称" align="center"/> <el-table-column prop="medicineName" label="药物名称" align="center"/>
<el-table-column prop="speed" label="速度(ml/h)" width="100"/> <el-table-column prop="medicineRate" label="剂量(ml)" width="100"/>
<el-table-column prop="total" label="累计药量(ml)" width="100"> <el-table-column prop="countMedicine" label="累计药量(ml)" width="100">
<template #default="scope"></template>
</el-table-column> </el-table-column>
<el-table-column prop="state" label="工作状态" width="70" align="center"/> <el-table-column prop="state" label="工作状态" width="70" align="center"/>
<el-table-column label="特殊情况人为干预" align="center"> <el-table-column label="特殊情况人为干预" align="center">
@ -256,7 +255,7 @@ const featureTable = ref([] as any[]);
let chartNowData = reactive({ID: 0}); let chartNowData = reactive({ID: 0});
const lungAlarm = ref(false); // const lungAlarm = ref(false); //
const heartAlarm = ref(false); // const heartAlarm = ref(false); //
const isAIDose = ref(false); // AI const isAIDose = ref(0); // AI
const isVideoPlay = ref(false); // const isVideoPlay = ref(false); //
const videoSrc = ref('https://www.runoob.com/try/demo_source/mov_bbb.mp4'); const videoSrc = ref('https://www.runoob.com/try/demo_source/mov_bbb.mp4');
const mssageList = ref([] as any); const mssageList = ref([] as any);
@ -265,7 +264,7 @@ const unusual = ref([] as any);
const fixedTableData = ref([] as any[]); const fixedTableData = ref([] as any[]);
const varTableData = ref([] as any[]); const varTableData = ref([] as any[]);
const table1SpeedVal = ref(''); const table1SpeedVal = ref('');
const whetherControl =ref(false); const whetherControl =ref(true);
const subscribeMedicineData=ref(null); const subscribeMedicineData=ref(null);
const intervalFun=ref(null); const intervalFun=ref(null);
const timeDiffPing=ref(0); const timeDiffPing=ref(0);
@ -273,6 +272,7 @@ let currentAIMedicine: any;
let currentDocMedicine: any; let currentDocMedicine: any;
const medicineSpeedTemp: any = {}; const medicineSpeedTemp: any = {};
const connectionUnityLoading=ref(false); const connectionUnityLoading=ref(false);
const lastAddMedicineTime=ref(null);
onMounted(() => { onMounted(() => {
if (!(currentRemote.value&&currentRemote.value.isRemote)) { if (!(currentRemote.value&&currentRemote.value.isRemote)) {
router.push('/remote-manage/remote-manage'); router.push('/remote-manage/remote-manage');
@ -394,13 +394,19 @@ const subscribeVital = () => {
onVitalClose() onVitalClose()
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
(res: any) => { (res: any) => {
console.log(res);
if (res.status != 2) { if (res.status != 2) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
chartDom1.value.updateChartData(data.vitalSignsList[0]); chartDom1.value.updateChartData(data.vitalSignsList[0]);
chartDom2.value.updateChartData(data.vitalSignsList[0]); chartDom2.value.updateChartData(data.vitalSignsList[0]);
chartDom3.value.updateChartData(data.vitalSignsList[0]); chartDom3.value.updateChartData(data.vitalSignsList[0]);
chartDom4.value.updateChartData(data.vitalSignsList[0]); chartDom4.value.updateChartData(data.vitalSignsList[0]);
updateMedicineTable(data.aiMedicineList[0], data.docMedicineList); isAIDose.value=data.flags.aiFlag
if (lastAddMedicineTime.value!==data.rateModTime) {
lastAddMedicineTime.value=data.rateModTime
updateMedicineTable(data.medicineList);
}
} }
}) })
} }
@ -486,7 +492,7 @@ const onMedicineClose = () => {
function initData() { function initData() {
lungAlarm.value = false; lungAlarm.value = false;
heartAlarm.value = false; heartAlarm.value = false;
isAIDose.value = false; isAIDose.value = 0;
unusual.value = []; unusual.value = [];
mssageList.value = []; mssageList.value = [];
fixedTableData.value = []; fixedTableData.value = [];
@ -498,87 +504,9 @@ function initData() {
} }
} }
function updateMedicineTable(aiMedicine: any, doctorMedicine: any) { function updateMedicineTable(doctorMedicine: any) {
if (aiMedicine) { varTableData.value = doctorMedicine.slice(0,4)
delete aiMedicine._id; fixedTableData.value = doctorMedicine.slice(4,8)
delete aiMedicine.Time;
if (currentAIMedicine && currentAIMedicine.Time == aiMedicine.Time) {
} else {
currentAIMedicine = aiMedicine;
const keys = Object.keys(aiMedicine);
keys.forEach(key => {
medicineSpeedTemp[key] = aiMedicine[key];
})
if (varTableData.value.length > 0) {
varTableData.value.forEach((medicine: any) => {
medicine.speed = aiMedicine[medicine.name];
})
fixedTableData.value.forEach((medicine: any) => {
medicine.speed = aiMedicine[medicine.name];
})
} else {
const varTable: any = [];
const fixedTable: any = [];
keys.forEach(key => {
const medicine = {
Phase: 0,
name: key,
speed: aiMedicine[key],
total: 0,
state: "正常"
}
if (remoteWsStore.varMedicine.includes(key)) {
varTable.push(medicine);
} else {
fixedTable.push(medicine);
}
})
varTableData.value = varTable;
fixedTableData.value = fixedTable;
}
}
}
if (doctorMedicine) {
delete doctorMedicine._id;
delete doctorMedicine.Time;
if (currentDocMedicine && currentDocMedicine.Time == doctorMedicine.Time) {
} else {
currentDocMedicine = doctorMedicine;
const keys = Object.keys(doctorMedicine);
keys.forEach(key => {
medicineSpeedTemp[key] = doctorMedicine[key];
})
if (varTableData.value.length > 0) {
varTableData.value.forEach((medicine: any) => {
medicine.speed = doctorMedicine[medicine.name];
});
fixedTableData.value.forEach((medicine: any) => {
medicine.speed = doctorMedicine[medicine.name];
})
} else {
const varTable: any = [];
const fixedTable: any = [];
keys.forEach(key => {
const medicine = {
Phase: 0,
name: key,
speed: aiMedicine[key],
total: 0,
state: "正常"
}
if (remoteWsStore.varMedicine.includes(key)) {
varTable.push(medicine);
} else {
fixedTable.push(medicine);
}
})
varTableData.value = varTable;
fixedTableData.value = fixedTable;
}
}
}
} }
function vitalExcepEvent(data: any) { function vitalExcepEvent(data: any) {
@ -693,17 +621,25 @@ function msgLogScrollBottom() {
} }
const tableItemPlus = (e: any) => { const tableItemPlus = (e: any) => {
const obj = medicineCustom.find(item => item.name === e.row.name) || {plus: 1}; const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1};
e.row.speed += obj.plus; if (e.row.medicineRate >=obj.total) {
e.row.speed = Number(e.row.speed.toFixed(2)); e.row.medicineRate =obj.total
return
};
let rate= Number(e.row.medicineRate);
if (isNaN(rate)) {
return
}
rate += obj.plus;
e.row.medicineRate = rate.toFixed(2);
} }
const tableItemMinus = (e: any) => { const tableItemMinus = (e: any) => {
const obj = medicineCustom.find(item => item.name === e.row.name) || {plus: 1}; const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1};
if (!isAIDose.value && e.row.speed - obj.plus <= 0) return; if (!isAIDose.value && e.row.medicineRate - obj.plus <= 0) return;
e.row.speed -= obj.plus; e.row.medicineRate -= obj.plus;
if (e.row.speed < 0) e.row.speed = 0; if (e.row.medicineRate < 0) e.row.medicineRate = 0;
else e.row.speed = Number(e.row.speed.toFixed(2)); else e.row.medicineRate = Number(e.row.medicineRate).toFixed(2);
} }
const tableItemConfirm = (e: any, tableData: any) => { const tableItemConfirm = (e: any, tableData: any) => {
@ -721,8 +657,8 @@ const tableItemConfirm = (e: any, tableData: any) => {
id: currentRemote.value.patientId, id: currentRemote.value.patientId,
date: currentRemote.value.date, date: currentRemote.value.date,
flag: "1", flag: "1",
medicine: e.row.name, medicine: e.row.medicineName,
value: e.row.speed, value: e.row.medicineRate,
index: currentRemote.value.index index: currentRemote.value.index
} }
remoteWsStore.sendMedicine(params, function () { remoteWsStore.sendMedicine(params, function () {
@ -730,11 +666,11 @@ const tableItemConfirm = (e: any, tableData: any) => {
}) })
.catch(() => { .catch(() => {
// //
e.row.speed = medicineSpeedTemp[e.row.name]; // e.row.speed = medicineSpeedTemp[e.row.name];
}); });
} }
const tableItemCancel = (e: any) => { const tableItemCancel = (e: any) => {
e.row.speed = medicineSpeedTemp[e.row.name]; // e.row.speed = medicineSpeedTemp[e.row.name];
} }
function startAI() { function startAI() {