From 9f12001fd99053772afcbab291dbe24146f97f5a Mon Sep 17 00:00:00 2001 From: zhang1106 <849185023@qq.com> Date: Sat, 20 Dec 2025 13:31:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=9C=BA=E6=9F=9C?= =?UTF-8?q?=E5=8F=AF=E8=A7=86=E5=8C=96=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=83=8C=E6=99=AF=E5=9B=BE=E7=89=87=E7=AD=89=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=BD=8D=E7=BD=AE=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/RackVisualization.jsx | 385 +++++++++++++++-------- 1 file changed, 254 insertions(+), 131 deletions(-) diff --git a/frontend/src/pages/RackVisualization.jsx b/frontend/src/pages/RackVisualization.jsx index 1a95d5f..369d77b 100644 --- a/frontend/src/pages/RackVisualization.jsx +++ b/frontend/src/pages/RackVisualization.jsx @@ -23,13 +23,57 @@ style.textContent = ` @keyframes slideIn { from { opacity: 0; - transform: translateY(-50%) translateX(20px); + transform: translateY(-50%) translateX(20px) scale(0.95); } to { opacity: 1; - transform: translateY(-50%) translateX(0); + transform: translateY(-50%) translateX(0) scale(1); } } + + /* 强制设备详情面板在最顶层,超越所有3D空间 */ + .device-detail-panel { + z-index: 2147483647 !important; /* 使用最大z-index值 */ + position: fixed !important; + transform: translateY(-50%) !important; /* 强制2D变换 */ + backface-visibility: hidden !important; + -webkit-backface-visibility: hidden !important; + perspective: none !important; + transform-style: flat !important; + isolation: isolate !important; + will-change: transform !important; + contain: layout style paint !important; + overflow: visible !important; + pointer-events: auto !important; + /* 强制独立层 */ + -webkit-transform: translateY(-50%) !important; + -moz-transform: translateY(-50%) !important; + -ms-transform: translateY(-50%) !important; + -o-transform: translateY(-50%) !important; + /* 强制最高优先级 */ + filter: drop-shadow(0 0 0 transparent) !important; + box-sizing: border-box !important; + max-width: none !important; + min-width: auto !important; + } + + /* 防止页面3D空间影响设备详情面板 */ + .rack-visualization-container { + perspective: none !important; + transform-style: flat !important; + contain: layout !important; + overflow: hidden !important; + } + + /* 确保页面所有元素都不会覆盖设备详情面板 */ + html, body { + overflow-x: hidden !important; + } + + /* 强制提升页面所有容器的层级 */ + .ant-layout, .ant-card, .ant-card-head, .ant-card-body { + contain: none !important; + } `; document.head.appendChild(style); @@ -98,6 +142,9 @@ function RackVisualization() { const [error, setError] = useState(null); const [hoveredDevice, setHoveredDevice] = useState(null); const [hoverTimeout, setHoverTimeout] = useState(null); + const [backgroundImage, setBackgroundImage] = useState(null); + const [backgroundType, setBackgroundType] = useState('gradient'); // gradient or image + const [backgroundSize, setBackgroundSize] = useState('contain'); // cover, contain, auto // 获取所有机柜 const fetchRacks = async () => { @@ -416,107 +463,93 @@ function RackVisualization() { return marks; }; - // 生成左侧U数标记(从实际范围开始显示) + // 生成左侧U数标记(从U1开始显示) const generateLeftUMarks = (height) => { const marks = []; const uHeight = 18; + const rackContentHeight = height * uHeight; // 机柜内容总高度 + const containerPadding = 6; // 前面板上下padding总和 - // 从实际U位范围开始(通常是4-42U或类似范围) - const startU = Math.max(1, height - 40); // 假设机柜有40U左右,从较高位置开始显示 - - for (let i = 1; i <= height; i++) { - const actualU = startU + i - 1; - if (actualU <= 42) { // 只显示到42U - marks.push( -