From 521aeaee5f182fbea458b655cc7c4120348a61ae Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期一, 21 七月 2025 17:15:07 +0800
Subject: [PATCH] ID1625-修改未签到时抗凝剂

---
 src/views/deviceWindoes2.vue |  121 +++++++++++++++++++++++++++++++--------
 1 files changed, 95 insertions(+), 26 deletions(-)

diff --git a/src/views/deviceWindoes2.vue b/src/views/deviceWindoes2.vue
index 1731ec0..b29f928 100644
--- a/src/views/deviceWindoes2.vue
+++ b/src/views/deviceWindoes2.vue
@@ -641,12 +641,12 @@
       <div
         class="mowei"
         style="height: 39%"
-        v-if="Number(deviceData.透析状态) > 0"
+        v-show="Number(deviceData.透析状态) > 0"
       >
         <el-row style="height: 100%; padding: 0px 20px 10px 20px">
           <!-- 未签到 -->
           <div
-            v-if="Number(deviceData.透析状态) < 1"
+            v-show="Number(deviceData.透析状态) < 1"
             style="height: 70%; width: 100%"
           >
             <div class="container">
@@ -785,7 +785,7 @@
             </div>
           </div>
           <!-- 已签到 -->
-          <div v-else style="height: 80%; width: 100%; padding-right: 0px">
+          <div v-show="Number(deviceData.透析状态) >= 1" style="height: 80%; width: 100%; padding-right: 0px">
             <div style="height: 100%">
               <el-row
                 style="height: 30%; padding: 0px 0px 10px 0px"
@@ -901,10 +901,10 @@
                       padding-bottom: 10px; /* 设置所有方向的间距为10px */
                     "
                   >
-                    <div style="height: 100%">
+                    <div v-show="Number(deviceData.透析状态) > 1" class="zcc_test" style="height: 100%">
                       <div
-                        v-if="Number(deviceData.透析状态) > 1"
                         :ref="'echartsDiv' + deviceData.设备编号"
+                        :class="'echartsDiv-' + deviceData.设备编号"
                         style="height: 97%"
                       ></div>
                     </div>
@@ -951,7 +951,7 @@
       <div
         class="mowei"
         style="height: 39%"
-        v-if="Number(deviceData.透析状态) === 0"
+        v-show="Number(deviceData.透析状态) === 0"
       >
         <el-row gutter="20" style="height: 100%; padding: 10px 20px 20px 20px">
           <el-col :span="12" style="height: 100%">
@@ -1107,7 +1107,7 @@
       <el-carousel-item :style="{ height: pageHeight + 'px'}">
         <div class="toubu" style="height: 11%">
         <el-row
-          v-if="deviceData.患者姓名 !== ''"
+          v-show="deviceData.患者姓名 !== ''"
           style="
             font-weight: 900;
             color: #ffffff;
@@ -1793,6 +1793,7 @@
   watch,
   onUnmounted,
   onBeforeUnmount,
+  nextTick,
 } from "vue";
 import { Local } from "../utils/storage";
 import * as echarts from "echarts";
@@ -1888,6 +1889,10 @@
 const sseData = ref({});
 // sse状态
 const readyState = ref({ key: 0, value: "正在链接中" });
+
+// 血压的echart实例
+let bloodPressureEchart: echarts.ECharts | null = null
+let observer;
  
 const deviceCode = ref("");
 const shishiTime = ref(new Date());
@@ -2114,6 +2119,7 @@
     if (床旁血压计.value.zuihouTime > shishiTime.value) {
     } else {
       setTimeout(() => {
+        console.log("初始化血压图表222222");
         initTupiao();
       }, 500);
     }
@@ -2388,6 +2394,7 @@
   intervalId = setInterval(updateTime, 1000);
   const height = window.innerHeight;
   pageHeight.value = height;
+
 });
 // 在组件卸载前清除定时器,防止内存泄漏
 onBeforeUnmount(() => {
@@ -2457,6 +2464,7 @@
     console.log(deviceData.value.设备名称, "子组件变量");
     setTimeout(() => {
       if (!xiaoduzhuangti.value) {
+        console.log("初始化血压图表111111");
         initTupiao();
       }
     }, 500);
@@ -2530,6 +2538,7 @@
               zuihouTime: date,
             };
             setTimeout(() => {
+        console.log("初始化血压图表444444");
               initTupiao();
             }, 500);
           } else if (dataBody.推送类型 === "中央监控大屏信息") {
@@ -2586,6 +2595,8 @@
   };
   isinitXy.value = true;
   setTimeout(() => {
+        console.log("初始化血压图表333333");
+
     initTupiao();
   }, 500);
 };
@@ -2612,6 +2623,20 @@
 onBeforeMount(() => {
   closeSource();
 });
+
+
+const renderEcharts = (options: any) => {
+  const boxes = document.querySelectorAll(`.echartsDiv-${deviceData.value.设备编号}`);
+  boxes.forEach(box => {
+    if ((box as HTMLElement).dataset.initialized === 'true') return;
+    const chart = echarts.init(box as HTMLElement);
+    chart.setOption(options);
+    (box as HTMLElement).dataset.initialized = 'true';
+  });
+}
+
+
+
 const initTupiao = () => {
   if (deviceData.value.患者姓名 !== "") {
     const seriesData = [
@@ -2770,9 +2795,14 @@
         xAxisData.push(1);
       }
       try {
-        const myChart = echarts.init(
-          proxy.$refs["echartsDiv" + deviceData.value.设备编号]
-        );
+        // console.log('proxy.$refs["echartsDiv" + deviceData.value.设备编号]: ', proxy.$refs["echartsDiv" + deviceData.value.设备编号])
+        // if (!bloodPressureEchart) {
+        //     bloodPressureEchart = echarts.init(
+        //     proxy.$refs["echartsDiv" + deviceData.value.设备编号]
+        //   );
+        // }
+        // console.log('bloodPressureEchart: ', bloodPressureEchart)
+
         const option = {
           // backgroundColor: 床旁血压计.value.zuihouTime>shishiTime.value?'#ffffff':textcolor.value,
           backgroundColor: "#ffffff",
@@ -2809,15 +2839,43 @@
           },
           series: seriesData,
         };
-        myChart.setOption(option);
+        // console.log("渲染设备", deviceData.value.设备编号, option);
+        // console.log('deviceData.透析状态1: ', Number(deviceData.value.透析状态));
+        // nextTick(() => {
+        //     bloodPressureEchart.setOption(option);
+        //     bloodPressureEchart.resize();
+        //     setTimeout(() => {
+        //     // 方法1:检查容器内是否有canvas元素
+        //     const canvas = bloodPressureEchart.getDom().querySelector('canvas');
+        //     console.log('canvas: ', canvas);
+        //     if (!canvas) {
+        //       console.error('图表渲染失败:未生成canvas元素');
+        //       return;
+        //     }
+        //     // 方法2:检查canvas的宽高
+        //     if (canvas.width === 0 || canvas.height === 0) {
+        //       console.error('图表渲染失败:canvas宽高为0');
+        //       return;
+        //     }
+        //     // 方法3:检查图表实例的宽高
+        //     if (bloodPressureEchart.getWidth() === 0 || bloodPressureEchart.getHeight() === 0) {
+        //       console.error('图表渲染失败:图表实例宽高为0');
+        //       return;
+        //     }}, 1000);
+        // });
+        renderEcharts(option);
       } catch (e) {
-        console.log("图标渲染异常异常");
+        console.log("图标渲染异常异常:", e);
       }
     } else {
       try {
-        const myChart = echarts.init(
-          proxy.$refs["echartsDiv" + deviceData.value.设备编号]
-        );
+        // if (!bloodPressureEchart) { 
+        //     // @ts-ignore
+        //   bloodPressureEchart = echarts.init(
+        //     proxy.$refs["echartsDiv" + deviceData.value.设备编号]
+        //   );
+        // }
+
  
         const option = {
           backgroundColor:
@@ -2852,11 +2910,18 @@
           },
           series: [],
         };
-        myChart.setOption(option);
+        // console.log('deviceData.透析状态2: ', Number(deviceData.value.透析状态));
+        // // bloodPressureEchart.setOption(option);
+        // nextTick(() => {
+        //   // bloodPressureEchart.setOption(option);
+        //     bloodPressureEchart.setOption(option);
+        // });
+        renderEcharts(option);
       } catch (e) {
         console.log(
           "异常",
-          proxy.$refs["echartsDiv" + deviceData.value.设备编号]
+          proxy.$refs["echartsDiv" + deviceData.value.设备编号],
+          e
         );
       }
     }
@@ -3038,22 +3103,26 @@
     console.log(deviceData.value);
   }
 };
+
+
 const getItemName = (name: string) => {
   if (name) {
-    if (name === "血红蛋白测定") {
-      return "Hgb ";
+    if (name === "血红蛋白") {
+      return "HGB ";
     } else if (name === "铁蛋白") {
-      return "Fer ";
+      return "FER ";
     } else if (name === "白蛋白") {
-      return "Alb ";
-    } else if (name === "血清铁蛋白") {
-      return "SF ";
-    } else if (name === "钙") {
-      return "Ga ";
+      return "ALB ";
+    }
+    //  else if (name === "血清铁蛋白") {
+    //   return "SF ";
+    // }
+     else if (name === "钙") {
+      return "Ca ";
     } else if (name === "钾") {
       return "K ";
     } else if (name === "无机磷") {
-      return "pi ";
+      return "P ";
     } else if (name === "甲状旁腺激素") {
       return "PTH ";
     } else {

--
Gitblit v1.8.0