Forráskód Böngészése

场景页面的绘制功能,如果参数类型中包含pointZ、polylineZ、polygonZ,那么用户在绘制的时候需要绘制三维坐标,高程默认是0。
运行中心添加字典中文转义

DESKTOP-6LTVLN7\Liumouren 3 hete
szülő
commit
19564a380e

+ 70 - 23
src/components/wgn/controlPanel.vue

@@ -560,6 +560,34 @@ export default {
       }
       return aliases;
     },
+    /**
+     * 当前场景在指定几何槽位是否声明了 Z 型参数(如 pointZ、polylineZ、polygonZ 及别名 lineZ 等)。
+     * 仅该槽位绘制出的坐标使用 [lon, lat, z]。
+     */
+    elementTypesHasZVariant(geometryCanon) {
+      if (
+        !this.dmsServerItem ||
+        !Array.isArray(this.dmsServerItem.elementTypes) ||
+        !geometryCanon
+      ) {
+        return false;
+      }
+      const zCandidates = this.expandParameterTypeAliases(geometryCanon).filter((a) =>
+        String(a).toLowerCase().endsWith("z")
+      );
+      if (zCandidates.length === 0) {
+        return false;
+      }
+      const declared = this.dmsServerItem.elementTypes.map((t) => String(t).toLowerCase());
+      return zCandidates.some((c) => declared.includes(String(c).toLowerCase()));
+    },
+    /** 按几何槽位(point / polyline / polygon)生成 GeoJSON 坐标:含 Z 型参数时为 [lon, lat, z] */
+    lonLatToGeoJsonCoord(lon, lat, geometryCanon, z = 0) {
+      if (geometryCanon && this.elementTypesHasZVariant(geometryCanon)) {
+        return [lon, lat, z];
+      }
+      return [lon, lat];
+    },
     ifHasType(type) {
       if (
         !this.dmsServerItem ||
@@ -2820,7 +2848,7 @@ export default {
           // 转换为geometry格式并保存
           const geometry = {
             type: "Point",
-            coordinates: [longitude, latitude],
+            coordinates: that.lonLatToGeoJsonCoord(longitude, latitude, "point"),
           };
           that.geometries.push(geometry);
           that.changeGeometries();
@@ -2924,10 +2952,13 @@ export default {
           const coordinates = [];
           that.currentPositions.forEach((pos) => {
             const cartographic = SkyScenery.Cartographic.fromCartesian(pos);
-            coordinates.push([
-              SkyScenery.Math.toDegrees(cartographic.longitude),
-              SkyScenery.Math.toDegrees(cartographic.latitude),
-            ]);
+            coordinates.push(
+              that.lonLatToGeoJsonCoord(
+                SkyScenery.Math.toDegrees(cartographic.longitude),
+                SkyScenery.Math.toDegrees(cartographic.latitude),
+                "polyline"
+              )
+            );
           });
 
           const geometry = {
@@ -3100,16 +3131,22 @@ export default {
       const mainRing = [];
       for (let i = 0; i < closedPositions.length; i++) {
         const cartographic = SkyScenery.Cartographic.fromCartesian(closedPositions[i]);
-        mainRing.push([
-          SkyScenery.Math.toDegrees(cartographic.longitude),
-          SkyScenery.Math.toDegrees(cartographic.latitude),
-        ]);
+        mainRing.push(
+          this.lonLatToGeoJsonCoord(
+            SkyScenery.Math.toDegrees(cartographic.longitude),
+            SkyScenery.Math.toDegrees(cartographic.latitude),
+            "polygon"
+          )
+        );
       }
       const cartographic = SkyScenery.Cartographic.fromCartesian(closedPositions[0]);
-      mainRing.push([
-        SkyScenery.Math.toDegrees(cartographic.longitude),
-        SkyScenery.Math.toDegrees(cartographic.latitude),
-      ]);
+      mainRing.push(
+        this.lonLatToGeoJsonCoord(
+          SkyScenery.Math.toDegrees(cartographic.longitude),
+          SkyScenery.Math.toDegrees(cartographic.latitude),
+          "polygon"
+        )
+      );
       coordinates.push(mainRing);
 
       const geometry = {
@@ -3255,17 +3292,23 @@ export default {
       const holeCoordinates = [];
       for (let i = 0; i < closedPositions.length; i++) {
         const cartographic = SkyScenery.Cartographic.fromCartesian(closedPositions[i]);
-        holeCoordinates.push([
-          SkyScenery.Math.toDegrees(cartographic.longitude),
-          SkyScenery.Math.toDegrees(cartographic.latitude),
-        ]);
+        holeCoordinates.push(
+          this.lonLatToGeoJsonCoord(
+            SkyScenery.Math.toDegrees(cartographic.longitude),
+            SkyScenery.Math.toDegrees(cartographic.latitude),
+            "polygon"
+          )
+        );
       }
 
       const cartographic = SkyScenery.Cartographic.fromCartesian(closedPositions[0]);
-      holeCoordinates.push([
-        SkyScenery.Math.toDegrees(cartographic.longitude),
-        SkyScenery.Math.toDegrees(cartographic.latitude),
-      ]);
+      holeCoordinates.push(
+        this.lonLatToGeoJsonCoord(
+          SkyScenery.Math.toDegrees(cartographic.longitude),
+          SkyScenery.Math.toDegrees(cartographic.latitude),
+          "polygon"
+        )
+      );
       // 添加到几何对象的镂空数组
       if (!this.currentPolygonGeometry.holes) {
         this.currentPolygonGeometry.holes = [];
@@ -3299,7 +3342,9 @@ export default {
       // 将外部环转换为Cartesian3数组
       const outerRingPositions = [];
       outerRing.forEach((coord) => {
-        const cartesian = SkyScenery.Cartesian3.fromDegrees(coord[0], coord[1]);
+        const z =
+          coord.length > 2 && typeof coord[2] === "number" ? coord[2] : 0;
+        const cartesian = SkyScenery.Cartesian3.fromDegrees(coord[0], coord[1], z);
         outerRingPositions.push(cartesian);
       });
       // 闭合外部环
@@ -3313,7 +3358,9 @@ export default {
         hierarchy.holes = holes.map((hole) => {
           const holePositions = [];
           hole.forEach((coord) => {
-            const cartesian = SkyScenery.Cartesian3.fromDegrees(coord[0], coord[1]);
+            const z =
+              coord.length > 2 && typeof coord[2] === "number" ? coord[2] : 0;
+            const cartesian = SkyScenery.Cartesian3.fromDegrees(coord[0], coord[1], z);
             holePositions.push(cartesian);
           });
           // 闭合镂空环

+ 8 - 1
src/components/yxgl/table.vue

@@ -14,13 +14,19 @@
       <!-- 添加序号列 -->
       <el-table-column type="index" label="序号" width="100" align="center" />
       <el-table-column prop="path_comment" label="服务名称" />
-      <el-table-column prop="type" label="类别" width="600" />
+      <el-table-column label="类别" width="600">
+        <template #default="{ row }">
+          {{ formatYxglServiceCategory(row.type, row.type) }}
+        </template>
+      </el-table-column>
       <el-table-column prop="count" label="调用次数" width="280" />
     </el-table>
   </div>
 </template>
 
 <script>
+import { formatYxglServiceCategory } from "@/utils/yxglServiceCategoryLabels.js";
+
 export default {
   name: "Table",
   props: {
@@ -66,6 +72,7 @@ export default {
     },
   },
   methods: {
+    formatYxglServiceCategory,
     handleSizeChange(val) {
       this.pageSize = val;
     },

+ 27 - 0
src/utils/yxglServiceCategoryLabels.js

@@ -0,0 +1,27 @@
+/**
+ * 运行管理 / 服务统计:服务类别 code → 中文(与后台返回的 type 字段对应)
+ */
+export const YXGL_SERVICE_CATEGORY_LABELS = {
+  pro: "proxy代理服务",
+  api: "一张图鉴权系统",
+  icon: "一张图符号精灵",
+  dms: "一张图数据中台",
+  oauth: "一张图服务共享",
+  proxy: "转发服务",
+};
+
+/**
+ * @param {string} type 后台返回的类别 code
+ * @param {string} [unmappedAs='其它'] 未命中字典时的展示文案(表格可传入 type 以保留原 code)
+ */
+export function formatYxglServiceCategory(type, unmappedAs = "其它") {
+  if (type == null || type === "") {
+    return "未知";
+  }
+  const raw = String(type).trim();
+  if (raw === "未知") {
+    return raw;
+  }
+  const key = raw.toLowerCase();
+  return YXGL_SERVICE_CATEGORY_LABELS[key] ?? unmappedAs;
+}

+ 9 - 13
src/views/yxgl/StatisticalAnalysis.vue

@@ -151,7 +151,11 @@
           <el-table-column prop="application" label="应用名称" />
           <el-table-column prop="path_comment" label="服务名称" />
           <el-table-column prop="unit" label="委办单位" width="200" />
-          <el-table-column prop="type" label="服务类别" width="120" />
+          <el-table-column label="服务类别" width="120">
+            <template #default="{ row }">
+              {{ formatYxglServiceCategory(row.type, row.type) }}
+            </template>
+          </el-table-column>
           <el-table-column prop="count" label="调用次数" width="100" />
           <el-table-column prop="date" label="调用时间" width="120" />
         </el-table>
@@ -260,6 +264,7 @@ import EchartsDome from "@/components/yxgl/EchartsDome.vue";
 import Table from "@/components/yxgl/table.vue";
 import appCenter from "@/api/appCenter";
 import { countlmType } from "@/api/count";
+import { formatYxglServiceCategory } from "@/utils/yxglServiceCategoryLabels.js";
 import HomePage_Demo from "@/views/HomePage_Demo.vue";
 
 export default {
@@ -397,6 +402,7 @@ export default {
     });
   },
   methods: {
+    formatYxglServiceCategory,
     getColumnListDate(){
       let that = this;
       that.columnList = [];
@@ -612,19 +618,9 @@ export default {
                 }
               });
             }
-            let serverObj = {};
-            serverObj["proxy"] = 'proxy代理服务';
-            serverObj["api"] = '一张图鉴权系统';
-            serverObj["icon"] = '一张图符号精灵';
-            serverObj["dms"] = '一张图数据中台';
-            serverObj["oauth"] = '一张图鉴权系统';
-            serverObj["proxy"] = '转发服务';
             serviceCountType.forEach((item) => {
-              item.name = serverObj[item.type];
-              if (!item.name) {
-                item.name = "其它";
-              }
-            })
+              item.name = formatYxglServiceCategory(item.type);
+            });
             // 初始化服务类别分布,这个地方需要先根据serviceType进行groupBy统计调用次数
             this.dataToOption("服务类别分布", "pie", serviceCountType, {
               pieKey: { value: "count", name: "name" },