mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 04:54:58 +08:00
Compare commits
2 Commits
b5e110081c
...
f959c6bcc4
Author | SHA1 | Date | |
---|---|---|---|
|
f959c6bcc4 | ||
|
0c2000064f |
|
@ -48,7 +48,7 @@ export const constantRoute = [
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/patients-manage/patients-manage',
|
path: '/patients-manage/patients-manage',
|
||||||
name: '患者管理',
|
name: '患者管理2',
|
||||||
component: () => import('@/views/patients-manage/patients-manage.vue'),
|
component: () => import('@/views/patients-manage/patients-manage.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,7 +249,21 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
||||||
patient.vitalWS.onmessage = undefined;
|
patient.vitalWS.onmessage = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
createChatConnect(name: string, id: string, date: string, index: number) {
|
||||||
|
if (!this.patient[name + id + date + index]) this.patient[name + id + date + index] = {}
|
||||||
|
const patient = this.patient[name + id + date + index]
|
||||||
|
if (!patient['chatWS']) {
|
||||||
|
patient['chatWS'] = new WebSocket(chatUrl)
|
||||||
|
patient.chatWS.onopen = function () {
|
||||||
|
patient.chatWS.send(JSON.stringify({
|
||||||
|
patientName: name,
|
||||||
|
idNum: id,
|
||||||
|
date: date,
|
||||||
|
msgType: "init"
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
|
sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
|
||||||
const patient: any = this.patient[name + id + date + index]
|
const patient: any = this.patient[name + id + date + index]
|
||||||
if (patient) {
|
if (patient) {
|
||||||
|
|
|
@ -47,14 +47,15 @@
|
||||||
<!-- :value="item.value"/>-->
|
<!-- :value="item.value"/>-->
|
||||||
<!-- </el-select>-->
|
<!-- </el-select>-->
|
||||||
<el-button color="#C77000" style="width: 200px;" @click="viewPatientInfo">患者信息</el-button>
|
<el-button color="#C77000" style="width: 200px;" @click="viewPatientInfo">患者信息</el-button>
|
||||||
<!-- <el-button color="#C77000" style="width: 150px;">已连接</el-button>-->
|
<!-- 远程控制 -->
|
||||||
<!-- <el-button color="#C77000" >机器人运行正常</el-button>-->
|
|
||||||
<el-button color="#C77000" @click="connectionUnity('1')" v-if="!whetherControl">连接远程控制
|
<el-button color="#C77000" @click="connectionUnity('1')" v-if="!whetherControl">连接远程控制
|
||||||
</el-button>
|
</el-button>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-button color="#C77000">已控制</el-button>
|
<el-button color="#C77000">已控制</el-button>
|
||||||
<el-button color="#C77000" @click="connectionUnity('0')">断开远程控制</el-button>
|
<el-button color="#C77000" @click="connectionUnity('0')">断开远程控制</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <el-button color="#C77000" style="width: 150px;">已连接</el-button>-->
|
||||||
|
<!-- <el-button color="#C77000" >机器人运行正常</el-button>-->
|
||||||
</div>
|
</div>
|
||||||
<el-button color="#e0e0e0" @click="backRemote">
|
<el-button color="#e0e0e0" @click="backRemote">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
|
@ -131,46 +132,34 @@
|
||||||
<el-table :data="varTableData" height="100%" style="width: 100%">
|
<el-table :data="varTableData" height="100%" style="width: 100%">
|
||||||
<el-table-column type="index" label="泵号" width="80" align="center"/>
|
<el-table-column type="index" label="泵号" width="80" align="center"/>
|
||||||
<el-table-column prop="name" label="药物名称" align="center"/>
|
<el-table-column prop="name" label="药物名称" align="center"/>
|
||||||
<el-table-column prop="speed" label="速度(mL/h)" width="120">
|
<el-table-column prop="speed" label="速度(mL/h)" width="100"/>
|
||||||
<!-- <template #header>
|
<el-table-column prop="total" label="累计药量(ml)" width="100"></el-table-column>
|
||||||
<el-dropdown @command="table1SpeedCommand">
|
<el-table-column prop="state" label="工作状态" width="70" align="center"/>
|
||||||
<span style="color: white;font-size: 14px;line-height: 20px;">
|
<el-table-column label="特殊情况人为干预" align="center">
|
||||||
{{ table1SpeedVal || '请选择速度' }}
|
|
||||||
</span>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item command="速度(ug/kg/min)">速度(ug/kg/min)</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="速度(ml/h)">速度(ml/h)</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</template> -->
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="total" label="累计药量(mL)" width="100"/>
|
|
||||||
<!-- <el-table-column prop="state" label="工作状态" width="150" align="center"/>-->
|
|
||||||
<!-- <el-table-column label="特殊情况人为干预" align="center">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="table-btn-box">
|
<div class="table-btn-box">
|
||||||
<el-button size="small" color="#006080" @click="tableItemPlus(scope)">
|
<el-button size="small" color="#006080" @click="tableItemPlus(scope)"
|
||||||
|
:disabled="!whetherControl">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Plus/>
|
<Plus/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" color="#006080" :disabled="scope.row.speed <= 0"
|
<el-button size="small" color="#006080" :disabled="!whetherControl"
|
||||||
@click="tableItemMinus(scope)">
|
@click="tableItemMinus(scope)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Minus/>
|
<Minus/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<!– <el-button size="small" color="#006080" @click="tableItemConfirm(scope)"
|
<el-button size="small" color="#006080"
|
||||||
:disabled="tableDataStore[scope.$index].speed === scope.row.speed">确定–>-->
|
@click="tableItemConfirm(scope, varTableData)"
|
||||||
<!--<el-button size="small" color="#006080" @click="tableItemConfirm(scope, varTableData)">确定
|
:disabled="!whetherControl">确定
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消
|
<el-button size="small" color="#006080" @click="tableItemCancel(scope)"
|
||||||
|
:disabled="!whetherControl">取消
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<!-- table2 -->
|
<!-- table2 -->
|
||||||
|
@ -180,28 +169,31 @@
|
||||||
<el-table-column prop="name" label="药物名称" align="center"/>
|
<el-table-column prop="name" label="药物名称" align="center"/>
|
||||||
<el-table-column prop="speed" label="速度(mL/h)" width="100"/>
|
<el-table-column prop="speed" label="速度(mL/h)" width="100"/>
|
||||||
<el-table-column prop="total" label="累计药量(mL)" width="100"/>
|
<el-table-column prop="total" label="累计药量(mL)" width="100"/>
|
||||||
<!-- <el-table-column prop="state" label="工作状态" width="150" align="center"/>-->
|
<el-table-column label="特殊情况人为干预" align="center">
|
||||||
<!-- <el-table-column label="特殊情况人为干预" align="center">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="table-btn-box">
|
<div class="table-btn-box">
|
||||||
<el-button size="small" color="#006080" @click="tableItemPlus(scope)">
|
<el-button size="small" color="#006080" @click="tableItemPlus(scope)"
|
||||||
|
:disabled="!whetherControl">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Plus/>
|
<Plus/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" color="#006080" :disabled="scope.row.speed <= 0"
|
<el-button size="small" color="#006080" :disabled="!whetherControl"
|
||||||
@click="tableItemMinus(scope)">
|
@click="tableItemMinus(scope)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Minus/>
|
<Minus/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" color="#006080" @click="tableItemConfirm(scope, fixedTableData)">确定
|
<el-button size="small" color="#006080"
|
||||||
|
@click="tableItemConfirm(scope, fixedTableData)"
|
||||||
|
:disabled="!whetherControl">确定
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消
|
<el-button size="small" color="#006080" @click="tableItemCancel(scope)"
|
||||||
|
:disabled="!whetherControl">取消
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -225,7 +217,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {onMounted, onUnmounted, onUpdated, reactive, ref, watch} from 'vue';
|
import {onMounted, onUnmounted, onUpdated, reactive, ref} from 'vue';
|
||||||
import {useRouter} from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||||
import {dateFormater} from '@/utils/date-util';
|
import {dateFormater} from '@/utils/date-util';
|
||||||
|
@ -341,6 +333,32 @@ function subscribeWS() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onMedicineClose = () => {
|
||||||
|
remoteWsStore.medicineOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, () => {
|
||||||
|
ElMessage.info('远程控制' + (currentRemote.value.index + 1) + ', 给药连接断开,正在尝试重连……')
|
||||||
|
setTimeout(() => {
|
||||||
|
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||||
|
subscribeMedicine()
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const subscribeMedicine = () => {
|
||||||
|
onMedicineClose()
|
||||||
|
remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
|
||||||
|
(res: any) => {
|
||||||
|
const data = JSON.parse(res.data);
|
||||||
|
if (data.status != 1) {
|
||||||
|
if (data.medicine) {
|
||||||
|
if (varTableData.value[data.medicine]) varTableData.value[data.medicine] = medicineSpeedTemp[data.medicine];
|
||||||
|
if (fixedTableData.value[data.medicine]) fixedTableData.value[data.medicine] = medicineSpeedTemp[data.medicine];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const subscribeVital = () => {
|
const subscribeVital = () => {
|
||||||
remoteWsStore.createVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex)
|
remoteWsStore.createVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex)
|
||||||
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex,
|
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex,
|
||||||
|
@ -348,7 +366,7 @@ const subscribeVital = () => {
|
||||||
const data = JSON.parse(res.data);
|
const data = JSON.parse(res.data);
|
||||||
// 1 2 3 4
|
// 1 2 3 4
|
||||||
if (data.vitalSignsList != null) {
|
if (data.vitalSignsList != null) {
|
||||||
updateMedicineTable(data.aiMedicineList[0], undefined);
|
updateMedicineTable(data.aiMedicine, undefined);
|
||||||
chartDom1.value.updateChartData(data.vitalSignsList);
|
chartDom1.value.updateChartData(data.vitalSignsList);
|
||||||
chartDom2.value.updateChartData(data.vitalSignsList);
|
chartDom2.value.updateChartData(data.vitalSignsList);
|
||||||
chartDom3.value.updateChartData(data.vitalSignsList);
|
chartDom3.value.updateChartData(data.vitalSignsList);
|
||||||
|
@ -415,30 +433,22 @@ function initData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
|
|
||||||
if (aiMedicine) {
|
if (aiMedicine) {
|
||||||
delete aiMedicine._id;
|
delete aiMedicine._id;
|
||||||
delete aiMedicine.Time;
|
delete aiMedicine.Time;
|
||||||
|
|
||||||
currentAIMedicine = aiMedicine;
|
currentAIMedicine = aiMedicine;
|
||||||
// 变更
|
|
||||||
if (varTableData.value.length > 0) {
|
if (varTableData.value.length > 0) {
|
||||||
|
|
||||||
// todo 鬼屎代码
|
|
||||||
// varTableData.value = varTableData.value.filter(medicine => {
|
|
||||||
// return medicine.name in aiMedicine; // 只保留存在于 aiMedicine 中的 medicine
|
|
||||||
// });
|
|
||||||
|
|
||||||
varTableData.value.forEach((medicine: any) => {
|
varTableData.value.forEach((medicine: any) => {
|
||||||
medicine.speed = aiMedicine[medicine.name] ? Number(aiMedicine[medicine.name]).toFixed(2) : '0.0'
|
medicine.speed = aiMedicine[medicine.name] ? Number(aiMedicine[medicine.name]).toFixed(2) : '0.0';
|
||||||
medicine.total = aiMedicine[medicine.name + "sum"] ? Number(aiMedicine[medicine.name + "sum"]).toFixed(2) : '0.0'
|
medicine.total = aiMedicine[medicine.name + "sum"] ? Number(aiMedicine[medicine.name + "sum"]).toFixed(2) : '0.0';
|
||||||
})
|
});
|
||||||
fixedTableData.value.forEach((medicine: any) => {
|
fixedTableData.value.forEach((medicine: any) => {
|
||||||
medicine.speed = aiMedicine[medicine.name] ? Number(aiMedicine[medicine.name]).toFixed(2) : '0.0'
|
medicine.speed = aiMedicine[medicine.name] ? Number(aiMedicine[medicine.name]).toFixed(2) : '0.0';
|
||||||
medicine.total = aiMedicine[medicine.name + "sum"] ? Number(aiMedicine[medicine.name + "sum"]).toFixed(2) : '0.0'
|
medicine.total = aiMedicine[medicine.name + "sum"] ? Number(aiMedicine[medicine.name + "sum"]).toFixed(2) : '0.0';
|
||||||
})
|
});
|
||||||
|
|
||||||
// console.log(varTableData.value)
|
|
||||||
// console.log(fixedTableData.value)
|
|
||||||
} else { // 第一次
|
} else { // 第一次
|
||||||
const varTable: any = [];
|
const varTable: any = [];
|
||||||
const fixedTable: any = [];
|
const fixedTable: any = [];
|
||||||
|
@ -449,9 +459,9 @@ function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
speed: aiMedicine[key] ? Number(aiMedicine[key]).toFixed(2) : '0.0',
|
speed: aiMedicine[key] ? Number(aiMedicine[key]).toFixed(2) : '0.0',
|
||||||
total: aiMedicine[key + "sum"] ? Number(aiMedicine[key + "sum"]).toFixed(2) : '0.0',
|
total: aiMedicine[key + "sum"] ? Number(aiMedicine[key + "sum"]).toFixed(2) : '0.0',
|
||||||
state: "正常"
|
state: "正常"
|
||||||
}
|
};
|
||||||
varTable.push(medicine);
|
varTable.push(medicine);
|
||||||
})
|
});
|
||||||
remoteWsStore.fixedMedicine.forEach(key => {
|
remoteWsStore.fixedMedicine.forEach(key => {
|
||||||
const medicine = {
|
const medicine = {
|
||||||
Phase: 0,
|
Phase: 0,
|
||||||
|
@ -459,9 +469,9 @@ function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
speed: aiMedicine[key] ? Number(aiMedicine[key]).toFixed(2) : '0.0',
|
speed: aiMedicine[key] ? Number(aiMedicine[key]).toFixed(2) : '0.0',
|
||||||
total: aiMedicine[key + "sum"] ? Number(aiMedicine[key + "sum"]).toFixed(2) : '0.0',
|
total: aiMedicine[key + "sum"] ? Number(aiMedicine[key + "sum"]).toFixed(2) : '0.0',
|
||||||
state: "正常"
|
state: "正常"
|
||||||
}
|
};
|
||||||
fixedTable.push(medicine);
|
fixedTable.push(medicine);
|
||||||
})
|
});
|
||||||
varTableData.value = varTable;
|
varTableData.value = varTable;
|
||||||
fixedTableData.value = fixedTable;
|
fixedTableData.value = fixedTable;
|
||||||
}
|
}
|
||||||
|
@ -474,8 +484,8 @@ function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
currentDocMedicine = doctorMedicine;
|
currentDocMedicine = doctorMedicine;
|
||||||
const keys = Object.keys(doctorMedicine);
|
const keys = Object.keys(doctorMedicine);
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
medicineSpeedTemp[key] = doctorMedicine[key];
|
medicineSpeedTemp.value[key] = doctorMedicine[key];
|
||||||
})
|
});
|
||||||
|
|
||||||
if (varTableData.value.length > 0) {
|
if (varTableData.value.length > 0) {
|
||||||
varTableData.value.forEach((medicine: any) => {
|
varTableData.value.forEach((medicine: any) => {
|
||||||
|
@ -485,7 +495,7 @@ function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
fixedTableData.value.forEach((medicine: any) => {
|
fixedTableData.value.forEach((medicine: any) => {
|
||||||
medicine.speed = (Number(doctorMedicine[medicine.name]) + Number(aiMedicine[medicine.name])).toFixed(2);
|
medicine.speed = (Number(doctorMedicine[medicine.name]) + Number(aiMedicine[medicine.name])).toFixed(2);
|
||||||
medicine.total = (Number(doctorMedicine[medicine.name + "sum"]) + Number(aiMedicine[medicine.name + "sum"])).toFixed(2);
|
medicine.total = (Number(doctorMedicine[medicine.name + "sum"]) + Number(aiMedicine[medicine.name + "sum"])).toFixed(2);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
const varTable: any = [];
|
const varTable: any = [];
|
||||||
const fixedTable: any = [];
|
const fixedTable: any = [];
|
||||||
|
@ -496,13 +506,13 @@ function updateMedicineTable(aiMedicine: any, doctorMedicine: any) {
|
||||||
speed: Number(doctorMedicine[key]) + Number(aiMedicine[key]),
|
speed: Number(doctorMedicine[key]) + Number(aiMedicine[key]),
|
||||||
total: Number(doctorMedicine[key + "sum"]) + Number(aiMedicine[key + "sum"]),
|
total: Number(doctorMedicine[key + "sum"]) + Number(aiMedicine[key + "sum"]),
|
||||||
state: "正常"
|
state: "正常"
|
||||||
}
|
};
|
||||||
if (remoteWsStore.varMedicine.includes(key)) {
|
if (remoteWsStore.varMedicine.includes(key)) {
|
||||||
varTable.push(medicine);
|
varTable.push(medicine);
|
||||||
} else {
|
} else {
|
||||||
fixedTable.push(medicine);
|
fixedTable.push(medicine);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
varTableData.value = varTable;
|
varTableData.value = varTable;
|
||||||
fixedTableData.value = fixedTable;
|
fixedTableData.value = fixedTable;
|
||||||
}
|
}
|
||||||
|
@ -663,13 +673,11 @@ function startAI() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 远程控制
|
// 远程控制
|
||||||
*/
|
|
||||||
const whetherControl = ref(false);
|
const whetherControl = ref(false);
|
||||||
const connectionUnityLoading = ref(false);
|
const connectionUnityLoading = ref(false);
|
||||||
const subscribeMedicineData = ref(null);
|
// 连接远程控制
|
||||||
|
|
||||||
function connectionUnity(flag: string) {
|
function connectionUnity(flag: string) {
|
||||||
if (flag === "1") {
|
if (flag === "1") {
|
||||||
console.log("连接远程控制");
|
console.log("连接远程控制");
|
||||||
|
@ -681,7 +689,7 @@ function connectionUnity(flag: string) {
|
||||||
const params: any = {
|
const params: any = {
|
||||||
name: currentRemote.value.patient,
|
name: currentRemote.value.patient,
|
||||||
id: currentRemote.value.patientId,
|
id: currentRemote.value.patientId,
|
||||||
// date: currentRemote.value.date,
|
date: currentRemote.value.date,
|
||||||
index: currentRemote.value.index,
|
index: currentRemote.value.index,
|
||||||
msgType: "webRequestConnection",
|
msgType: "webRequestConnection",
|
||||||
flag
|
flag
|
||||||
|
@ -697,86 +705,6 @@ function connectionUnity(flag: string) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
const onMedicineClose = () => {
|
|
||||||
remoteWsStore.medicineOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, () => {
|
|
||||||
ElMessage.info('远程控制' + (currentRemote.value.index + 1) + ', 给药连接断开,正在尝试重连……')
|
|
||||||
setTimeout(() => {
|
|
||||||
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.index)
|
|
||||||
subscribeMedicine()
|
|
||||||
}, 3000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const subscribeMedicine = () => {
|
|
||||||
onMedicineClose()
|
|
||||||
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.index)
|
|
||||||
remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
|
|
||||||
(res: any) => {
|
|
||||||
const data = JSON.parse(res.data);
|
|
||||||
subscribeMedicineData.value = data;
|
|
||||||
if (data.status != 1) {
|
|
||||||
if (data.medicine) {
|
|
||||||
if (varTableData.value[data.medicine]) varTableData.value[data.medicine] = medicineSpeedTemp[data.medicine];
|
|
||||||
if (fixedTableData.value[data.medicine]) fixedTableData.value[data.medicine] = medicineSpeedTemp[data.medicine];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.error(data.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
watch(subscribeMedicineData, (newValue: any, oldValue: any) => {
|
|
||||||
if (newValue) {
|
|
||||||
const {msgType, unityConnectionFlag, msg} = newValue;
|
|
||||||
switch (msgType) {
|
|
||||||
case 'unityRequestConnection':
|
|
||||||
const params: any = {
|
|
||||||
name: currentRemote.value.patient,
|
|
||||||
id: currentRemote.value.patientId,
|
|
||||||
date: currentRemote.value.date,
|
|
||||||
index: currentRemote.value.index,
|
|
||||||
msgType: "webResponseConnection",
|
|
||||||
flag: "1"
|
|
||||||
}
|
|
||||||
ElMessageBox.confirm('确定接受远程控制', '确认提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '拒绝',
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
whetherControl.value = unityConnectionFlag === '1';
|
|
||||||
remoteWsStore.reqMedicineConnect({...params, flag: unityConnectionFlag}, (res: any) => {
|
|
||||||
console.log('res >>>>>', res);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// 点击取消按钮后的逻辑
|
|
||||||
whetherControl.value = false;
|
|
||||||
remoteWsStore.reqMedicineConnect({...params, flag: '0'}, (res: any) => {
|
|
||||||
console.log('res >>>>>', res);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'unityResponseConnection':
|
|
||||||
connectionUnityLoading.value = false
|
|
||||||
whetherControl.value = unityConnectionFlag === '1';
|
|
||||||
if (unityConnectionFlag === '1') {
|
|
||||||
ElMessage.success('连接成功')
|
|
||||||
} else {
|
|
||||||
ElMessage.info('连接断开')
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'getMedicine':
|
|
||||||
ElMessage.success('给药成功')
|
|
||||||
break;
|
|
||||||
case 'pong':
|
|
||||||
// timeDiffPing.value = newValue.msg;
|
|
||||||
break;
|
|
||||||
case 'connectionMsg':
|
|
||||||
ElMessage.info(msg)
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -26,15 +26,15 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
// target: 'http://127.0.0.1:6379', // 目标服务器地址
|
target: 'http://127.0.0.1:6379', // 目标服务器地址
|
||||||
target: 'http://110.41.142.124:6379', // 目标服务器地址
|
// target: 'http://110.41.142.124:6379', // 目标服务器地址
|
||||||
ws: true, // 是否启用 WebSocket
|
ws: true, // 是否启用 WebSocket
|
||||||
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
||||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||||
},
|
},
|
||||||
'/socket.io': {
|
'/socket.io': {
|
||||||
// target: 'ws://127.0.0.1:6379',
|
target: 'ws://127.0.0.1:6379',
|
||||||
target: 'ws://110.41.142.124:6379',
|
// target: 'ws://110.41.142.124:6379',
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/socket.io/, ''),
|
rewrite: (path) => path.replace(/^\/socket.io/, ''),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user