2024年10月17日17点31分: 修改折线图. 实时1S展示更新一次

This commit is contained in:
republicline 2024-10-17 17:31:20 +08:00
parent 33fcd07dde
commit d90d5e4eef
3 changed files with 886 additions and 868 deletions

View File

@ -2,10 +2,23 @@ import {defineStore} from "pinia";
import {Session} from "@/utils/storage"; import {Session} from "@/utils/storage";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
// 本地调试版本:
const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken() const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken() const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken() const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
// 服务器部署版本
// const vitalUrl = "wss://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
// const medicineUrl = "wss://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
// const chatUrl = "wss://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
// 测试echars
// const vitalUrl = "wss://" + "110.41.142.124" + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
// const medicineUrl = "wss://" + "110.41.142.124" + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
// const chatUrl = "wss://" + "110.41.142.124" + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
export const useRemoteWsStore = defineStore("remoteWs", { export const useRemoteWsStore = defineStore("remoteWs", {
state: () => { state: () => {
return { return {
@ -261,7 +274,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date, date: date,
msgType: "msg" msgType: "init"
})) }))
} }

View File

@ -34,13 +34,15 @@ onMounted(() => {
function updateChartData(data: any) { function updateChartData(data: any) {
if (data) { if (data) {
if (currentNode && currentNode.Time == data[0].Time) { // if (currentNode && currentNode.Time == data[0].Time) {
if (currentNode && currentNode.Time == data.Time) {
return; return;
} else { } else {
currentNode = data[0]; currentNode = data;
} }
for (let i = (data.length - 1); i >= 0; i--) { // for (let i = (data.length - 1); i >= 0; i--) {
const item = data[i] // const item = data[i];
const item = data;
if (xData.indexOf(dateFormater("HH:mm:ss", item.Time)) == -1) { if (xData.indexOf(dateFormater("HH:mm:ss", item.Time)) == -1) {
xData.shift(); xData.shift();
xData.push(dateFormater("HH:mm:ss", item.Time)); xData.push(dateFormater("HH:mm:ss", item.Time));
@ -58,7 +60,7 @@ function updateChartData(data: any) {
series, series,
}) })
} }
} // }
} }
} }

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"/>
<!-- <el-table-column prop="state" label="工作状态" width="150" align="center"/>--> <!-- <el-table-column prop="state" label="工作状态" width="150" align="center"/>-->
@ -302,12 +302,15 @@ const subscribeVital = () => {
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex, remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex,
function (res: any) { function (res: any) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
// 1 2 3
if (data.vitalSignsList != null) {
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);
// chartDom4.value.updateChartData(data.vitalSignsList); // chartDom4.value.updateChartData(data.vitalSignsList);
// updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]); // updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]);
updateMedicineTable(data.aiMedicineList[0], undefined); updateMedicineTable(data.aiMedicineList[0], undefined);
}
}) })
remoteWsStore.vitalOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex, () => { remoteWsStore.vitalOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentIndex, () => {
setTimeout(() => { setTimeout(() => {