Browse Source

三测单的问题解决一部分

LIJU 2 weeks ago
parent
commit
3d2ee729ee
1 changed files with 200 additions and 57 deletions
  1. 200 57
      src/components/medical-advice/temperature/graphics.vue

+ 200 - 57
src/components/medical-advice/temperature/graphics.vue

@@ -5,6 +5,7 @@
       class="container"
       :style="{
         marginTop: containerStyle.marginTop,
+        left: containerStyle.left
       }"
     >
       <svg width="100%" height="100%"></svg>
@@ -762,7 +763,8 @@ export default {
         marginTop: '476px'
       },
       containerStyle: {
-        marginTop: '-12px'
+        marginTop: '-12px',
+        left: '28px'
       }
     };
   },
@@ -1471,7 +1473,36 @@ export default {
        console.log('实际窗口尺寸:', window.innerWidth + 'x' + window.innerHeight);
        console.log('计算的marginTop:', this.marginTop);
        console.log('topTd元素高度:', this.$refs.topTd ? this.$refs.topTd[0].getBoundingClientRect().height : '未获取到');
-       
+       console.log('================');
+       console.log('屏幕总分辨率:', screen.width + 'x' + screen.height);
+       console.log('浏览器窗口尺寸:', window.innerWidth + 'x' + window.innerHeight);
+       console.log('可用屏幕空间:', screen.availWidth + 'x' + screen.availHeight);
+       console.log('文档尺寸:', document.documentElement.clientWidth + 'x' + document.documentElement.clientHeight);
+
+       // 计算被占用的空间
+       const taskbarWidth = screen.width - screen.availWidth;
+       const taskbarHeight = screen.height - screen.availHeight;
+       console.log('被占用的空间:', taskbarWidth + 'x' + taskbarHeight);
+
+      // 滚动条信息
+      const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
+      const scrollbarHeight = window.innerHeight - document.documentElement.clientHeight;
+      console.log('滚动条尺寸:', scrollbarWidth + 'x' + scrollbarHeight);  
+      
+      // 窗口外部尺寸
+      console.log('浏览器窗口外部尺寸:', window.outerWidth + 'x' + window.outerHeight);
+      console.log('窗口位置:', window.screenX + 'x' + window.screenY);  
+      
+      // 浏览器信息
+      console.log('用户代理:', navigator.userAgent);
+      console.log('平台:', navigator.platform);
+      console.log('语言:', navigator.language);
+      console.log('浏览器供应商:', navigator.vendor);
+
+      // 媒体查询检测
+      const isHighDPI = window.matchMedia('(-webkit-min-device-pixel-ratio: 2)').matches;
+      console.log('是否高DPI显示器:', isHighDPI);      
+       console.log('================');
        // DPI相关调试信息
        console.log('=== DPI调试信息 ===');
        console.log('devicePixelRatio (设备像素比):', window.devicePixelRatio);
@@ -1578,7 +1609,7 @@ export default {
     },
     // 设置刻度样式
     setScaleStyles(screenWidth, screenHeight) {
-      // this.applyConditionalPrintAdjustment()
+      this.applyConditionalPrintAdjustment()
       // 默认刻度样式
       let pulseStyle = {
         titleMarginTop: '0px',
@@ -1599,7 +1630,8 @@ export default {
       };
       
       let containerStyle = {
-        marginTop: '-12px'
+        marginTop: '-12px',
+        left: '28px'
       };
       
       // 可以根据不同分辨率设置不同样式
@@ -1624,11 +1656,13 @@ export default {
           if(window.devicePixelRatio > 1) {
             containerStyle = {
               marginTop:  this.marginTop + 'px',
+              left: '28px'
             };  
           }else {
             containerStyle = {
-              marginTop:  (this.marginTop + 14) + 'px',
-            };              
+              marginTop:  (this.marginTop + 14) + 'px', //2楼儿科01 /3楼左1 /3楼左4
+              left: '28px'
+            };    
           }
         }else {//marginTop:-2
           pulseStyle = {
@@ -1647,7 +1681,8 @@ export default {
             marginTop: '476px'
           };
           containerStyle = {
-            marginTop: '22px'
+            marginTop: '22px',
+            left: '28px'
           };
         }
       }
@@ -1670,13 +1705,22 @@ export default {
         };
         if(this.marginTop > 38) {
           if(this.marginTop < 58) {
-            containerStyle = {
-              marginTop:  (this.marginTop + 15) + 'px',
-            };
+            if((this.marginTop == 48) && (window.devicePixelRatio == 1) && (window.innerHeight == 657)){//十楼左➡️右第二台
+              containerStyle = {
+                marginTop:  this.marginTop + 'px',
+                left: '28px'
+              };
+            }else {
+              containerStyle = {
+                marginTop:  (this.marginTop + 15) + 'px',//5楼左2 
+                left: '28px'
+              };
+            }
           }else {
             if(window.devicePixelRatio < 1) {
               containerStyle = {
                 marginTop:  (this.marginTop + 5) + 'px',
+                left: '28px'
               };   
             }
           }
@@ -1686,15 +1730,19 @@ export default {
             if(this.marginTop > 18) {
               containerStyle = {
                 marginTop:  (this.marginTop + 10 + 14) + 'px',
+                left: '28px'
               };
             }else {
               containerStyle = {
                 marginTop:  (this.marginTop + 10 + 28) + 'px',
+                left: '28px'
               };
             }
-          }else {
+          }else { //6楼左1 /3楼左2  /5楼左1 /9楼左一
+            this.applyConditionalPrintAdjustment(42)
             containerStyle = {
-              marginTop:  (this.marginTop + 10) + 'px',
+              marginTop:  (this.marginTop + 10 + 14) + 'px',
+              left: '35px'
             };
           }
           console.log("this.marginTop <= 38",containerStyle.marginTop)
@@ -1704,6 +1752,7 @@ export default {
       }
       // 例如:1536x864
       else if (screenWidth === 1536 && screenHeight === 864) {
+        this.removeConditionalPrintCSS()
         pulseStyle = {
           titleMarginTop: '0px',
           firstRowMarginTop: '40px',
@@ -1720,7 +1769,8 @@ export default {
           marginTop: '476px'
         };
         containerStyle = {
-          marginTop: '23px'
+          marginTop: '23px',
+          left: '28px'
         };
 
       }
@@ -1742,13 +1792,50 @@ export default {
           marginTop: '476px'
         };
         containerStyle = {
-          marginTop: '22px'
+          marginTop: '22px',
+          left: '28px'
         };        
       }   
+      // 例如:1600x900
+      else if (screenWidth === 1600 && screenHeight === 900) {
+        pulseStyle = {
+          titleMarginTop: '0px',
+          firstRowMarginTop: '32px',
+          normalRowMarginTop: '55px',
+          lastRowMarginTop: '56px'
+        };
+        temperatureStyle = {
+          titleMarginTop: '0px',
+          firstRowMarginTop: '32px',
+          normalRowMarginTop: '55px',
+          lastRowMarginTop: '56px'
+        };
+        legendStyle = {
+          marginTop: '476px'
+        };
+        if((this.marginTop == 48) && (window.devicePixelRatio == 1) && (window.innerHeight == 789)) {//2楼左2 /7楼左2
+          containerStyle = {
+            marginTop:  (this.marginTop + 14)  + 'px',
+            left: '28px'
+          };
+        }else {
+          containerStyle = {
+            marginTop:  this.marginTop  + 'px',
+            left: '28px'
+          };
+        }
+        console.log('1600x900分辨率','marginTop:',this.marginTop,'window.devicePixelRatio',window.devicePixelRatio,'window.innerHeight',window.innerHeight)
+      }   
       // 例如:1440x900
       else if (screenWidth === 1440 && screenHeight === 900) {
         if(this.marginTop > 38) {
           if(this.marginTop < 58) {
+              if(window.innerHeight == 712) {//九楼左2 (打印偏右半格)
+                this.removeConditionalPrintCSS()
+              }              
+              if(window.innerHeight == 789) {//6楼左2  /3楼左3 /3楼左5
+                // this.removeConditionalPrintCSS() //6楼左2
+              }
               pulseStyle = {
                 titleMarginTop: '0px',
                 firstRowMarginTop: '32px',
@@ -1766,7 +1853,9 @@ export default {
               };
               containerStyle = {
                 marginTop:  (this.marginTop + 14) + 'px',
+                left: '28px'
               };
+              console.log("window.innerHeight2222222222",window.innerHeight);
           }else {
               pulseStyle = {
                 titleMarginTop: '0px',
@@ -1785,10 +1874,32 @@ export default {
               };
               containerStyle = {
                 marginTop:  this.marginTop + 'px',
+                left: '28px'
               };            
           }
         }else {
           if(window.devicePixelRatio < 1) {
+            if(window.innerHeight == 876) {//十楼左第一台
+              pulseStyle = {
+                titleMarginTop: '0px',
+                firstRowMarginTop: '32px',
+                normalRowMarginTop: '55px',
+                lastRowMarginTop: '56px'
+              };
+              temperatureStyle = {
+                titleMarginTop: '0px',
+                firstRowMarginTop: '32px',
+                normalRowMarginTop: '55px',
+                lastRowMarginTop: '56px'
+              };
+              legendStyle = {
+                marginTop: '476px'
+              };
+              containerStyle = {
+                marginTop:  (this.marginTop + 10) + 'px',
+                left: '28px'
+              };
+            }else {
               pulseStyle = {
                 titleMarginTop: '0px',
                 firstRowMarginTop: '32px',
@@ -1806,26 +1917,51 @@ export default {
               };
               containerStyle = {
                 marginTop:  (this.marginTop + 7) + 'px',
+                left: '28px'
               };
+            }
           }else {
-            pulseStyle = {
-              titleMarginTop: '0px',
-              firstRowMarginTop: '32px',
-              normalRowMarginTop: '55px',
-              lastRowMarginTop: '56px'
-            };
-            temperatureStyle = {
-              titleMarginTop: '0px',
-              firstRowMarginTop: '32px',
-              normalRowMarginTop: '55px',
-              lastRowMarginTop: '56px'
-            };
-            legendStyle = {
-              marginTop: '476px'
-            };
-            containerStyle = {
-              marginTop:  this.marginTop + 'px',
-            };
+            if(window.innerHeight == 757) {//7楼左1
+                pulseStyle = {
+                  titleMarginTop: '0px',
+                  firstRowMarginTop: '32px',
+                  normalRowMarginTop: '55px',
+                  lastRowMarginTop: '56px'
+                };
+                temperatureStyle = {
+                  titleMarginTop: '0px',
+                  firstRowMarginTop: '32px',
+                  normalRowMarginTop: '55px',
+                  lastRowMarginTop: '56px'
+                };
+                legendStyle = {
+                  marginTop: '476px'
+                };
+                containerStyle = {
+                  marginTop:  (this.marginTop + 28) + 'px',
+                  left: '28px'
+                };
+            }else {
+              pulseStyle = {
+                titleMarginTop: '0px',
+                firstRowMarginTop: '32px',
+                normalRowMarginTop: '55px',
+                lastRowMarginTop: '56px'
+              };
+              temperatureStyle = {
+                titleMarginTop: '0px',
+                firstRowMarginTop: '32px',
+                normalRowMarginTop: '55px',
+                lastRowMarginTop: '56px'
+              };
+              legendStyle = {
+                marginTop: '476px'
+              };
+              containerStyle = {
+                marginTop:  this.marginTop + 'px',
+                left: '28px'
+              };
+            }
           }
         }
       }            
@@ -1848,6 +1984,7 @@ export default {
         };
         containerStyle = {
           marginTop:  this.marginTop + 'px',
+          left: '28px'
         };
       }
       console.log("this.marginTop11111111111111111111",this.marginTop)
@@ -1859,32 +1996,38 @@ export default {
     // 打印位置调整已通过CSS媒体查询处理,无需JavaScript逻辑
      
      // 条件化打印位置调整方法 - 可在需要时调用
-     applyConditionalPrintAdjustment() {
-       try {
-         console.log('🔧 应用条件化打印位置调整');
-         
-         // 移除之前的条件化打印样式(如果存在)
-         this.removeConditionalPrintCSS();
-         
-         // 创建新的样式元素
-         const style = document.createElement('style');
-         style.id = 'conditional-print-adjustment';
-         style.textContent = `
-           @media print {
-             .container {
-               left: 35px !important;
-             }
-           }
-         `;
-         
-         // 添加到页面头部
-         document.head.appendChild(style);
-         console.log('✅ 条件化打印CSS样式已添加');
+      applyConditionalPrintAdjustment(leftOffset) {
+        try {
+          console.log('🔧 应用条件化打印位置调整');
+
+          // 解析参数:支持 35 / '35' / '35px',默认 35px
+          const parsed = leftOffset == null
+            ? 35
+            : Number(String(leftOffset).replace(/px$/i, ''));
+          const leftPx = Number.isFinite(parsed) ? `${parsed}px` : '35px';
+
+          // 先移除旧样式
+          this.removeConditionalPrintCSS();
+
+          // 创建并注入新样式
+          const style = document.createElement('style');
+          style.id = 'conditional-print-adjustment';
+          style.textContent = `
+            @media print {
+              .container {
+                left: ${leftPx} !important;
+              }
+            }
+          `;
          
-       } catch (error) {
-         console.error('❌ 条件化打印位置调整失败:', error);
-       }
-     },
+          // 添加到页面头部
+          document.head.appendChild(style);
+          console.log('✅ 条件化打印CSS样式已添加,left =', leftPx);
+
+        } catch (error) {
+          console.error('❌ 条件化打印位置调整失败:', error);
+        }
+      },
      
      // 移除条件化打印CSS样式
      removeConditionalPrintCSS() {