129 lines
3.8 KiB
Vue
Raw Normal View History

2025-03-31 18:24:37 +08:00
<template>
2025-04-10 13:33:38 +08:00
<div class="container">
2025-04-28 17:18:11 +08:00
<div class="el-row-left">
2025-05-09 11:39:26 +08:00
<DeviceModel @click="handleClickDevice" />
2025-04-28 17:18:11 +08:00
</div>
<div class="el-row-right scrollbar">
<MonitoringTop :funcList="funcList" />
<div class="el-row-right-content" v-if="deviceInfo?.mode == 0 || deviceInfo?.mode == 2">
<DeviceLocationMap :device-id="deviceInfo.deviceId" />
<el-row class="box" :gutter="20">
<el-col :span="12" :xs="24" :sm="24" :md="24" :lg="24" :xl="12" style="margin-bottom: 20px">
2025-05-09 11:39:26 +08:00
<DeviceHistory @change="handleRadio" ref="devHisRef" />
2025-04-28 17:18:11 +08:00
</el-col>
<el-col :span="12" :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
2025-04-25 18:23:20 +08:00
<DeviceRecord :deviceInfo="deviceInfo" />
2025-04-28 17:18:11 +08:00
</el-col>
</el-row>
</div>
<div class="el-row-right-content" v-else>
<el-row :gutter="20">
<el-col :span="24" style="margin-bottom: 20px">
2025-05-09 11:39:26 +08:00
<DeviceHistory @change="handleRadio" ref="devHisRef" />
2025-04-28 17:18:11 +08:00
</el-col>
<el-col :span="24">
<DeviceRecord :deviceInfo="deviceInfo" />
</el-col>
</el-row>
</div>
</div>
2025-03-31 18:24:37 +08:00
</div>
</template>
<script lang="ts" setup>
2025-05-06 18:33:53 +08:00
import DeviceModel from "./deviceModel.vue";
2025-03-31 18:24:37 +08:00
import MonitoringTop from "./monitoringTop.vue";
import DeviceHistory from "./deviceHistory.vue";
import DeviceRecord from "./deviceRecord.vue";
2025-04-28 17:18:11 +08:00
import DeviceLocationMap from "./deviceLocationMap.vue";
2025-05-06 18:33:53 +08:00
import { healthLatestData } from "@/api/index";
2025-04-10 13:33:38 +08:00
import { TDevice, THealthLatestData } from "@/api/index.d";
2025-05-06 18:33:53 +08:00
import { ref, onUnmounted } from "vue";
2025-04-10 13:33:38 +08:00
import heart from "@/assets/img/heart.png";
import temperature from "@/assets/img/temperature.png";
import blood from "@/assets/img/blood.png";
2025-04-24 10:12:03 +08:00
const devHisRef = ref(null);
2025-05-06 18:33:53 +08:00
2025-04-12 18:35:54 +08:00
let Interval = null;
2025-04-10 13:33:38 +08:00
let funcList = ref([
{ title: "当前心率", en: "DANGQIANXINLV", icon: heart, unit: "次/分", num: 0, color: "#FF0303" },
{ title: "当前血氧", en: "DANGQIANXUEYANG", icon: blood, unit: "%", num: 0, color: "#8B51FD" },
2025-04-22 18:31:46 +08:00
{ title: "当前体表温度", en: "DANGQIANTIBIAOWENDU", icon: temperature, unit: "℃", num: 0, color: "#FF6905" },
2025-04-10 13:33:38 +08:00
]);
2025-03-31 18:24:37 +08:00
2025-04-10 13:33:38 +08:00
const HealthData = ref<THealthLatestData.TRes>();
const deviceInfo = ref<TDevice.IListRes>();
2025-04-10 19:00:17 +08:00
2025-04-10 13:33:38 +08:00
const getHealthLatestData = () => {
healthLatestData({ deviceId: deviceInfo.value.deviceId }).then((res) => {
HealthData.value = res;
funcList.value[0].num = res.hr;
funcList.value[1].num = res.bo;
funcList.value[2].num = res.temp;
2025-05-09 11:39:26 +08:00
handleRadio(devHisRef.value.radio);
2025-04-10 13:33:38 +08:00
});
2025-03-31 18:24:37 +08:00
};
2025-05-09 11:39:26 +08:00
const handleRadio = (val: number) => {
2025-04-10 13:33:38 +08:00
if (val == 1) {
2025-04-28 17:18:11 +08:00
devHisRef.value?.getOptionsData(HealthData.value.hrArr, "心率", "#FF0303");
2025-04-10 13:33:38 +08:00
} else if (val == 2) {
2025-04-28 17:18:11 +08:00
devHisRef.value?.getOptionsData(HealthData.value.boArr, "血氧", "#983AFC");
2025-04-10 13:33:38 +08:00
} else if (val == 3) {
2025-04-28 17:18:11 +08:00
devHisRef.value?.getOptionsData(HealthData.value.tempArr, "体表温度", "#FFA91F");
2025-04-10 19:00:17 +08:00
}
2025-04-10 13:33:38 +08:00
};
2025-04-25 18:23:20 +08:00
2025-04-12 18:35:54 +08:00
const IntervalFn = () => {
Interval = setInterval(() => {
getHealthLatestData();
}, 60000);
};
2025-05-06 18:33:53 +08:00
2025-05-09 11:39:26 +08:00
const handleClickDevice = (val: TDevice.IListRes) => {
2025-04-24 10:12:03 +08:00
devHisRef.value.radio = "1";
2025-04-10 19:00:17 +08:00
deviceInfo.value = val;
getHealthLatestData();
2025-05-06 18:33:53 +08:00
if (!Interval) {
IntervalFn();
}
2025-04-10 19:00:17 +08:00
};
2025-04-28 17:18:11 +08:00
2025-04-12 18:35:54 +08:00
onUnmounted(() => {
clearInterval(Interval);
2025-04-01 18:07:18 +08:00
});
2025-03-31 18:24:37 +08:00
</script>
<style scoped lang="less">
2025-04-10 13:33:38 +08:00
.container {
overflow: hidden;
display: flex;
2025-04-28 17:18:11 +08:00
flex-direction: row;
.el-row-left {
width: 335px;
// height: 100%;
2025-04-10 13:33:38 +08:00
display: flex;
2025-04-28 17:18:11 +08:00
overflow: hidden;
flex-shrink: 0;
}
.el-row-right {
width: 100%;
overflow: auto;
margin-left: 20px;
.el-row-right-content {
2025-04-10 13:33:38 +08:00
overflow: hidden;
2025-04-28 17:18:11 +08:00
// height: 100%;
.box {
height: 100%;
flex-shrink: 0;
margin-top: 20px;
2025-04-25 18:23:20 +08:00
display: flex;
2025-04-28 17:18:11 +08:00
justify-content: space-between;
.el-col {
height: 100%;
2025-04-25 18:23:20 +08:00
}
}
2025-04-10 13:33:38 +08:00
}
}
}
2025-03-31 18:24:37 +08:00
</style>