From e73f1a0bcc36ada8043ea67c1daebf1de88f49b1 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期一, 12 一月 2026 11:24:14 +0800
Subject: [PATCH] 君泰BI大屏提交

---
 src/views/reportAnalysis/dataDashboard/index.vue |  110 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 83 insertions(+), 27 deletions(-)

diff --git a/src/views/reportAnalysis/dataDashboard/index.vue b/src/views/reportAnalysis/dataDashboard/index.vue
index 75fbf34..6bdd658 100644
--- a/src/views/reportAnalysis/dataDashboard/index.vue
+++ b/src/views/reportAnalysis/dataDashboard/index.vue
@@ -1,5 +1,6 @@
 <template>
-    <div class="data-dashboard">
+		<div class="scale-container">
+			<div class="data-dashboard" :style="{ transform: `scale(${scaleRatio})` }">
       <!-- 鍏ㄥ睆鎸夐挳 - 绉诲姩鍒板乏涓婅 -->
       <button class="fullscreen-btn" @click="toggleFullscreen" :title="isFullscreen ? '閫�鍑哄叏灞�' : '鍏ㄥ睆鏄剧ず'">
         <svg v-if="!isFullscreen" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -234,12 +235,13 @@
 				</div>
       </div>
       </div>
+      </div>
     </div>
 </template>
 
 <script setup>
 import * as echarts from 'echarts'
-import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
+import { ref, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue'
 import autofit from 'autofit.js'
 import Echarts from "@/components/Echarts/echarts.vue";
 import useUserStore from '@/store/modules/user'
@@ -260,6 +262,12 @@
 
 // 鍏ㄥ睆鐩稿叧鐘舵��
 const isFullscreen = ref(false);
+
+// 缂╂斁姣斾緥
+const scaleRatio = ref(1)
+// 璁捐灏哄锛堝熀鍑嗗昂瀵革級- 鏍规嵁瀹為檯璁捐绋胯皟鏁�
+const designWidth = 1920
+const designHeight = 1080
 
 // 鐢ㄦ埛store
 const userStore = useUserStore()
@@ -595,13 +603,35 @@
 // 寰呭姙浜嬮」
 const todoList = ref([])
 
-// 绐楀彛澶у皬鍙樺寲澶勭悊
-const handleResize = () => {
+// 璁$畻缂╂斁姣斾緥
+const calculateScale = () => {
+  const container = document.querySelector('.scale-container')
+  if (!container) return
+  
+  // 鑾峰彇瀹瑰櫒鐨勫疄闄呭昂瀵�
+	const rect = container.getBoundingClientRect?.()
+	const containerWidth = container.clientWidth || rect?.width || window.innerWidth
+	const containerHeight = container.clientHeight || rect?.height || window.innerHeight
+  
+  // 璁$畻瀹介珮缂╂斁姣斾緥锛屽彇杈冨皬鍊间互淇濊瘉鍐呭瀹屾暣鏄剧ず锛堢瓑姣旂缉鏀撅級
+  const scaleX = containerWidth / designWidth
+  const scaleY = containerHeight / designHeight
+  scaleRatio.value = Math.min(scaleX, scaleY)
+  
+  // 瑙﹀彂鍥捐〃resize
   charts.value.forEach(chart => {
     if (chart && chart.resize) {
       chart.resize()
     }
   })
+}
+
+// 绐楀彛澶у皬鍙樺寲澶勭悊
+const handleResize = () => {
+  // 寤惰繜鎵ц锛岀‘淇滵OM鏇存柊瀹屾垚
+  setTimeout(() => {
+    calculateScale()
+  }, 100)
 }
 
 // 閿�姣佸浘琛ㄥ疄渚�
@@ -881,9 +911,9 @@
   updateTime()
   timer.value = setInterval(updateTime, 1000)
 }
-// 鍏ㄥ睆鍔熻兘瀹炵幇 - 閽堝data-dashboard鍏冪礌
+// 鍏ㄥ睆鍔熻兘瀹炵幇 - 閽堝scale-container鍏冪礌
 const toggleFullscreen = () => {
-	const element = document.querySelector('.data-dashboard')
+	const element = document.querySelector('.scale-container')
 	
 	if (!element) return
 	
@@ -911,7 +941,12 @@
   const fullscreenElement = document.fullscreenElement || 
                            document.webkitFullscreenElement || 
                            document.msFullscreenElement
-  isFullscreen.value = fullscreenElement && fullscreenElement.classList.contains('data-dashboard')
+  isFullscreen.value = fullscreenElement && fullscreenElement.classList.contains('scale-container')
+  
+  // 鍏ㄥ睆鐘舵�佸彉鍖栨椂锛屽欢杩熼噸鏂拌绠楃缉鏀炬瘮渚嬶紙纭繚DOM鏇存柊瀹屾垚锛�
+  setTimeout(() => {
+    calculateScale()
+  }, 200)
 }
 
 // 鐢熷懡鍛ㄦ湡閽╁瓙
@@ -919,8 +954,11 @@
   initTime()
   // 浣跨敤nextTick纭繚DOM瀹屽叏娓叉煋鍚庡啀鍒濆鍖栧浘琛�
   nextTick(() => {
-    // 鍒濆鍖朼utofit鑷�傚簲
-    autofit.init({ dh: 800, dw: 1280, el: '.data-dashboard', resize: true }, false)
+    // 璁$畻鍒濆缂╂斁姣斾緥
+    calculateScale()
+    
+    // 鍒濆鍖朼utofit鑷�傚簲锛堝鏋滈渶瑕佷繚鐣檃utofit锛屽彲浠ヤ繚鐣欙紝浣嗕富瑕佺缉鏀剧敱scale-container鎺у埗锛�
+    // autofit.init({ dh: 800, dw: 1280, el: '.data-dashboard', resize: true }, false)
     
     // 娣诲姞鑷姩婊氬姩鍔ㄧ敾鏁堟灉 - 瀹㈡埛淇℃伅鍒楄〃
     const contractList = refContractList.value
@@ -980,6 +1018,9 @@
   })
   
   window.addEventListener('resize', handleResize)
+  window.addEventListener('fullscreenchange', handleFullscreenChange)
+  window.addEventListener('webkitfullscreenchange', handleFullscreenChange)
+  window.addEventListener('MSFullscreenChange', handleFullscreenChange)
   analysisCustomer()
   qualityStatisticsInfo()
 	accountStatisticsInfo()
@@ -1045,43 +1086,58 @@
 </script>
 
 <style scoped>
+/* 澶栭儴缂╂斁瀹瑰櫒 - 鍗犳嵁鏁翠釜瑙嗗彛 */
+.scale-container {
+  position: relative;
+	width: 100%;
+	/* 椤甸潰鍦ㄥ父瑙勫竷灞�涓嬶紙鏈夐《鏍忥級榛樿鍑忓幓 84px锛岄伩鍏嶅唴瀹硅瑁佸垏 */
+	height: calc(100vh - 84px);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background-color: #000;
+	overflow: hidden;
+}
+
+/* 鍐呴儴鍐呭鍖哄煙 - 鍥哄畾璁捐灏哄 */
 .data-dashboard {
   position: relative;
-  width: 100%;
-	height: 100%;
+  width: 1920px;
+  height: 1080px;
 	background-image: url("@/assets/BI/backImage@2x.png");
 	background-size: cover;
 	background-position: center;
 	background-repeat: no-repeat;
+	transform-origin: center center;
 }
 
-/* 鍏ㄥ睆鐘舵�佺殑鏍峰紡 */
-.data-dashboard:fullscreen {
-  width: 100%;
-  height: 100%;
+/* 鍏ㄥ睆鐘舵�佺殑鏍峰紡 - 浣滅敤浜巗cale-container */
+.scale-container:fullscreen {
+	width: 100vw;
+	height: 100vh;
   margin: 0;
   padding: 0;
-  background-color: inherit;
+  background-color: #000;
   z-index: 9999;
 }
 
 /* Webkit娴忚鍣ㄥ墠缂� */
-.data-dashboard:-webkit-full-screen {
-  width: 100%;
-  height: 100%;
+.scale-container:-webkit-full-screen {
+  width: 100vw;
+  height: 100vh;
   margin: 0;
   padding: 0;
-  background-color: inherit;
+  background-color: #000;
   z-index: 9999;
 }
 
 /* MS娴忚鍣ㄥ墠缂� */
-.data-dashboard:-ms-fullscreen {
-  width: 100%;
-  height: 100%;
+.scale-container:-ms-fullscreen {
+  width: 100vw;
+  height: 100vh;
   margin: 0;
   padding: 0;
-  background-color: inherit;
+  background-color: #000;
   z-index: 9999;
 }
 
@@ -1089,7 +1145,7 @@
 .dashboard-header {
   position: relative;
   z-index: 1;
-  height: 170px;
+	height: 86px;
 	background-image: url("@/assets/BI/biaoti.png");
 	background-size: cover;
 	background-position: center;
@@ -1103,7 +1159,7 @@
   font-weight: 600;
 font-size: 52px;
 color: #FFFFFF;
-top: 32px;
+top: 16px;
 position: absolute;
 }
 
@@ -1136,7 +1192,7 @@
   display: flex;
   gap: 30px;
   padding: 0 30px;
-  height: calc(100% - 120px);
+	height: calc(100% - 86px);
   overflow: hidden;
 }
 

--
Gitblit v1.9.3