From 011376cf519e639f39c224461fc81095a3b10b79 Mon Sep 17 00:00:00 2001 From: JIANG Date: Mon, 20 Oct 2025 18:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B1=9E=E6=80=A7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=9D=A2=E6=9D=BF=E9=A3=8E=E6=A0=BC=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E5=88=86=E5=8C=BA=E5=B1=9E=E6=80=A7=E6=9F=A5=E8=AF=A2=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=A3=8E=E6=A0=BC=E4=B8=80=E8=87=B4=EF=BC=9B=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=AE=98=E7=BD=91=E4=BC=98=E5=8C=96=E5=88=86=E5=8C=BA?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network-partition-optimization/page.tsx | 2 +- src/app/OlMap/Controls/PropertyPanel.tsx | 152 +++++++++++++++--- src/components/olmap/ZonePropsPanel.tsx | 2 +- 3 files changed, 130 insertions(+), 26 deletions(-) diff --git a/src/app/(main)/network-partition-optimization/page.tsx b/src/app/(main)/network-partition-optimization/page.tsx index 77da850..ab64ace 100644 --- a/src/app/(main)/network-partition-optimization/page.tsx +++ b/src/app/(main)/network-partition-optimization/page.tsx @@ -7,7 +7,7 @@ export default function Home() { return (
- + {/* */}
diff --git a/src/app/OlMap/Controls/PropertyPanel.tsx b/src/app/OlMap/Controls/PropertyPanel.tsx index f96ccd3..a9c6243 100644 --- a/src/app/OlMap/Controls/PropertyPanel.tsx +++ b/src/app/OlMap/Controls/PropertyPanel.tsx @@ -18,15 +18,6 @@ const PropertyPanel: React.FC = ({ type = "未知类型", properties = [], }) => { - if (!id) { - return ( -
-

属性面板

-

请选择一个要素以查看其属性。

-
- ); - } - const formatValue = (property: BaseProperty) => { if (property.formatter) { return property.formatter(property.value); @@ -37,24 +28,137 @@ const PropertyPanel: React.FC = ({ return property.value; }; + const isImportantKeys = ["ID", "类型", "Name", "面积", "长度"]; + return ( -
-

属性面板

-
-
- ID: - {id} +
+ {/* 头部 */} +
+
+ + + +

属性面板

-
- 类型: - {type} -
- {properties.map((property, index) => ( -
- {property.label}: - {formatValue(property)} +
+ + {/* 内容区域 */} +
+ {!id ? ( +
+ + + +

暂无属性信息

+

请选择一个要素以查看其属性

- ))} + ) : ( +
+ {/* ID 属性 */} +
+
+ + ID + + + {id} + +
+
+ + {/* 类型属性 */} +
+
+ + 类型 + + + {type} + +
+
+ + {/* 其他属性 */} + {properties.map((property, index) => { + const isImportant = isImportantKeys.includes(property.label); + return ( +
+
+ + {property.label} + + + {formatValue(property)} + +
+
+ ); + })} +
+ )} +
+ + {/* 底部统计区域 */} +
+
+ + + + + 共 {id ? properties.length + 2 : 0} 个属性 + + {id && ( + + + 已选中 + + )} +
); diff --git a/src/components/olmap/ZonePropsPanel.tsx b/src/components/olmap/ZonePropsPanel.tsx index 86e0c9e..7da1cc1 100644 --- a/src/components/olmap/ZonePropsPanel.tsx +++ b/src/components/olmap/ZonePropsPanel.tsx @@ -282,7 +282,7 @@ const ZonePropsPanel: React.FC = ({ return (
{/* 头部 */} -
+