| | |
| | | </div> |
| | | </template> |
| | | <script lang="ts" setup name="UnderTreatment"> |
| | | import { computed, ref, onMounted, onBeforeUnmount } from "vue"; |
| | | import { computed, ref, onMounted, onBeforeUnmount, watch } from "vue"; |
| | | import * as echarts from "echarts"; |
| | | import dayjs from "dayjs"; |
| | | |
| | |
| | | ); |
| | | }); |
| | | |
| | | // const; |
| | | watch( |
| | | () => pageData.value.ktvList, |
| | | (newVal) => { |
| | | generateKtvListEchart(newVal); |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | watch( |
| | | () => pageData.value.monitoringRecord, |
| | | (newVal) => { |
| | | generatBloodPressureAndPulseEchart(newVal); |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | watch( |
| | | () => props.height, |
| | | () => { |
| | | generateKtvListEchart(pageData.value.ktvList); |
| | | generatBloodPressureAndPulseEchart(pageData.value.monitoringRecord); |
| | | } |
| | | ); |
| | | |
| | | /** 生成ktv趋势图 */ |
| | | const generateKtvListEchart = (ktvList: KtvItem[]) => { |
| | |
| | | color: "#70CAAE", |
| | | }, |
| | | itemStyle: { |
| | | color: "#70CAAE", |
| | | color: (params: any) => getColor(params.value), |
| | | }, |
| | | }, |
| | | ], |
| | |
| | | }; |
| | | |
| | | chart.setOption(option, true); // 第二个参数为 true 表示全量更新 |
| | | }; |
| | | |
| | | const getColor = (val: number) => { |
| | | if (val < 1.2) return "#FE0201"; // 红色 |
| | | if (val <= 1.6) return "#70CAAE"; // 绿色 |
| | | return "#FE6500"; // 橙色 |
| | | }; |
| | | |
| | | /** 生成血压脉搏趋势图 */ |
| | |
| | | |
| | | const option = { |
| | | grid: [ |
| | | { top: "20%", height: "27%", left: 30, right: 20 }, // 伸缩压 |
| | | { top: "45%", height: "27%", left: 30, right: 20 }, // 舒张压 |
| | | { top: "67%", height: "27%", left: 30, right: 20 }, // 脉搏 |
| | | { top: "5%", height: "28%", left: 40, right: 20, containLabel: true }, |
| | | { top: "35%", height: "28%", left: 40, right: 20, containLabel: true }, |
| | | { top: "65%", height: "28%", left: 40, right: 20, containLabel: true }, |
| | | ], |
| | | tooltip: { |
| | | trigger: "axis", |
| | |
| | | axisLabel: { show: false }, |
| | | splitLine: { show: false }, |
| | | gridIndex: 0, |
| | | show: false, |
| | | }, |
| | | { |
| | | type: "category", |
| | |
| | | axisLabel: { show: false }, |
| | | splitLine: { show: false }, |
| | | gridIndex: 1, |
| | | show: false, |
| | | }, |
| | | { |
| | | type: "category", |
| | |
| | | axisLabel: { show: true }, // 最下面一层显示时间轴 |
| | | splitLine: { show: false }, |
| | | gridIndex: 2, |
| | | show: false, |
| | | }, |
| | | ], |
| | | yAxis: [ |
| | |
| | | axisTick: { show: false }, |
| | | axisLabel: { show: false }, |
| | | splitLine: { show: false }, |
| | | min: 80, |
| | | max: 180, |
| | | interval: 20, |
| | | min: 0, |
| | | max: 300, |
| | | interval: 2, |
| | | gridIndex: 0, |
| | | }, |
| | | { |
| | |
| | | axisTick: { show: false }, |
| | | axisLabel: { show: false }, |
| | | splitLine: { show: false }, |
| | | min: 40, |
| | | max: 120, |
| | | interval: 20, |
| | | min: 0, |
| | | max: 300, |
| | | interval: 2, |
| | | gridIndex: 1, |
| | | }, |
| | | { |
| | |
| | | axisTick: { show: false }, |
| | | axisLabel: { show: false }, |
| | | splitLine: { show: false }, |
| | | min: 40, |
| | | max: 140, |
| | | interval: 20, |
| | | min: 0, |
| | | max: 300, |
| | | interval: 2, |
| | | gridIndex: 2, |
| | | }, |
| | | ], |