Ver código fonte

常规上传

Koishi 2 semanas atrás
pai
commit
cffa96fdbc

+ 108 - 1
src/components/modelUnpack.vue

@@ -99,6 +99,18 @@
         </template>
       </el-alert>
     </div>
+    <div class="zbBox" :class="bJTableData?.length > 0 ? 'show' : 'hide'">
+      <el-table
+        :data="bJTableData"
+        height="100%"
+        style="width: 100%; hieght: 100%"
+      >
+        <el-table-column label="部件指标详情" align="center">
+          <el-table-column prop="key" label="指标" align="center" />
+          <el-table-column prop="value" label="值" width="180" align="center" />
+        </el-table-column>
+      </el-table>
+    </div>
   </div>
 </template>
  
@@ -148,6 +160,8 @@ import { Color } from "../Three/Three.js";
 
 import WebGL from "../threeTool/WebGL";
 
+import zbJson from "./zb.json";
+
 import axios from "axios";
 
 THREE.Cache.enabled = true;
@@ -302,6 +316,7 @@ export default {
           },
         },
       },
+      bJTableData: [],
     };
   },
 
@@ -439,7 +454,11 @@ export default {
       this.basicModel.children.forEach((bj) => {
         if (bj.name === "变桨系统" || bj.name === "齿轮箱") {
           bj.name === "变桨系统"
-            ? yujingList.push({ name: bj.name, uuid: bj.uuid, desc: "三相电流不平衡度超过10%且持续120秒" })
+            ? yujingList.push({
+                name: bj.name,
+                uuid: bj.uuid,
+                desc: "三相电流不平衡度超过10%且持续120秒",
+              })
             : bj.name === "齿轮箱"
             ? baojingList.push({
                 name: bj.name,
@@ -540,6 +559,27 @@ export default {
         return !modelEle.isLight && !modelEle.isLineSegments;
       });
       if (uuid) {
+        // zbJson
+        const selectBj = this.basicModel.children.find((ele) => {
+          return ele.uuid === this.bj;
+        });
+
+        let bJTableData = [];
+
+        const bjZbArray = zbJson?.[this.modelUnpackType] || null;
+        if (bjZbArray?.length) {
+          let selectZb = bjZbArray.find((ele) => {
+            return ele.name === selectBj.name;
+          });
+          selectZb?.zb?.forEach((label) => {
+            bJTableData.push({
+              key: label,
+              value: 100,
+            });
+          });
+        }
+
+        this.bJTableData = bJTableData;
         modelBjList.children.forEach((ele) => {
           if (ele.uuid === uuid) {
             this.focusOnPart(ele);
@@ -556,6 +596,7 @@ export default {
         modelBjList.children.forEach((ele) => {
           ele.visible = true;
         });
+        this.bJTableData = [];
       }
     },
 
@@ -1221,5 +1262,71 @@ export default {
       }
     }
   }
+
+  .zbBox {
+    position: absolute;
+    right: 1%;
+    top: 24px;
+    width: 40%;
+    height: calc(100% - 48px);
+
+    background: rgba(248, 249, 252, 0.35);
+    backdrop-filter: blur(25px);
+    -webkit-backdrop-filter: blur(25px);
+    border: 1px solid rgba(255, 255, 255, 0.2);
+    border-radius: 12px;
+    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
+    padding: 20px;
+
+    transition: 0.2s;
+
+    .el-table {
+      border-radius: 12px;
+
+      .el-table__row {
+        .cell:first-child {
+          color: #1890ff;
+        }
+        .cell:last-child {
+          color: #67c23a;
+        }
+      }
+    }
+
+    &.show {
+      right: 1%;
+      transition: 0.2s;
+    }
+
+    &.hide {
+      right: calc(1px - 40%);
+      transition: 0.2s;
+    }
+  }
+}
+</style>
+
+<style lang="less">
+.zbBox {
+  .el-table {
+    background: transparent !important;
+    tr,
+    th.el-table__cell,
+    .el-table__inner-wrapper {
+      background: transparent !important;
+    }
+
+    th.el-table__cell {
+      color: rgb(115, 118, 122);
+    }
+    .el-table__row {
+      td:first-child {
+        color: #1890ff;
+      }
+      td:last-child {
+        color: #67c23a;
+      }
+    }
+  }
 }
 </style>

+ 387 - 0
src/components/zb.json

@@ -0,0 +1,387 @@
+{
+    "fengji": [
+        {
+            "id": "CLX",
+            "name": "齿轮箱",
+            "zb": [
+                "齿箱油温",
+                "齿箱油压",
+                "齿箱油位",
+                "齿轮箱振动",
+                "齿轮箱转速",
+                "齿轮箱轴承温度",
+                "齿轮箱噪音",
+                "齿轮箱功率损失",
+                "齿轮箱油滤器状态",
+                "齿轮箱冷却器温度",
+                "齿轮箱齿轮磨损",
+                "齿轮箱润滑油品质",
+                "齿箱油温",
+                "齿箱油压",
+                "齿箱油位",
+                "齿轮箱振动",
+                "齿轮箱转速",
+                "齿轮箱轴承温度",
+                "齿轮箱噪音",
+                "齿轮箱功率损失",
+                "齿轮箱油滤器状态",
+                "齿轮箱冷却器温度",
+                "齿轮箱齿轮磨损",
+                "齿轮箱润滑油品质"
+            ]
+        },
+        {
+            "id": "BJ",
+            "name": "变桨系统",
+            "zb": [
+                "三相电流",
+                "变桨角度",
+                "变桨速度",
+                "变桨电机温度",
+                "变桨电池电压",
+                "变桨系统压力",
+                "变桨位置反馈",
+                "变桨故障代码",
+                "变桨控制器状态",
+                "变桨限位开关",
+                "变桨液压压力",
+                "变桨系统振动",
+                "三相电流",
+                "变桨角度",
+                "变桨速度",
+                "变桨电机温度",
+                "变桨电池电压",
+                "变桨系统压力",
+                "变桨位置反馈",
+                "变桨故障代码",
+                "变桨控制器状态",
+                "变桨限位开关",
+                "变桨液压压力",
+                "变桨系统振动"
+            ]
+        },
+        {
+            "id": "FDJ",
+            "name": "发电机",
+            "zb": [
+                "发电机转速",
+                "发电机温度",
+                "发电机电压",
+                "发电机电流",
+                "发电机功率",
+                "发电机频率",
+                "发电机振动",
+                "发电机绝缘电阻",
+                "发电机冷却液温度",
+                "发电机轴承温度",
+                "发电机输出频率",
+                "发电机效率",
+                "发电机绕组温度",
+                "发电机碳刷磨损",
+                "发电机转速",
+                "发电机温度",
+                "发电机电压",
+                "发电机电流",
+                "发电机功率",
+                "发电机频率",
+                "发电机振动",
+                "发电机绝缘电阻",
+                "发电机冷却液温度",
+                "发电机轴承温度",
+                "发电机输出频率",
+                "发电机效率",
+                "发电机绕组温度",
+                "发电机碳刷磨损"
+            ]
+        },
+        {
+            "id": "YP",
+            "name": "叶片",
+            "zb": [
+                "叶片角度",
+                "叶片振动",
+                "叶片结冰状态",
+                "叶片表面温度",
+                "叶片裂纹检测",
+                "叶片桨距角",
+                "叶片载荷",
+                "叶片变形监测",
+                "叶片清洁状态",
+                "叶片雷击记录",
+                "叶片材料疲劳",
+                "叶片角度",
+                "叶片振动",
+                "叶片结冰状态",
+                "叶片表面温度",
+                "叶片裂纹检测",
+                "叶片桨距角",
+                "叶片载荷",
+                "叶片变形监测",
+                "叶片清洁状态",
+                "叶片雷击记录",
+                "叶片材料疲劳"
+            ]
+        },
+        {
+            "id": "TT",
+            "name": "塔筒",
+            "zb": [
+                "塔筒振动",
+                "塔筒倾斜度",
+                "塔筒温度",
+                "塔筒应力",
+                "塔筒基础沉降",
+                "塔筒腐蚀状态",
+                "塔筒螺栓紧固力",
+                "塔筒风速",
+                "塔筒照明状态",
+                "塔筒门状态",
+                "塔筒振动",
+                "塔筒倾斜度",
+                "塔筒温度",
+                "塔筒应力",
+                "塔筒基础沉降",
+                "塔筒腐蚀状态",
+                "塔筒螺栓紧固力",
+                "塔筒风速",
+                "塔筒照明状态",
+                "塔筒门状态"
+            ]
+        },
+        {
+            "id": "JC",
+            "name": "机舱",
+            "zb": [
+                "机舱温度",
+                "机舱振动",
+                "机舱风向",
+                "机舱风速",
+                "机舱位置",
+                "机舱火灾报警",
+                "机舱湿度",
+                "机舱压力",
+                "机舱门状态",
+                "机舱照明状态",
+                "机舱摄像头状态",
+                "机舱温度",
+                "机舱振动",
+                "机舱风向",
+                "机舱风速",
+                "机舱位置",
+                "机舱火灾报警",
+                "机舱湿度",
+                "机舱压力",
+                "机舱门状态",
+                "机舱照明状态",
+                "机舱摄像头状态"
+            ]
+        },
+        {
+            "id": "KZ",
+            "name": "控制系统",
+            "zb": [
+                "控制器温度",
+                "控制器电压",
+                "控制器电流",
+                "控制信号状态",
+                "故障日志",
+                "运行模式",
+                "风速仪数据",
+                "风向仪数据",
+                "PLC状态",
+                "通信状态",
+                "软件版本",
+                "系统时间",
+                "安全链状态",
+                "功率设定值",
+                "控制器温度",
+                "控制器电压",
+                "控制器电流",
+                "控制信号状态",
+                "故障日志",
+                "运行模式",
+                "风速仪数据",
+                "风向仪数据",
+                "PLC状态",
+                "通信状态",
+                "软件版本",
+                "系统时间",
+                "安全链状态",
+                "功率设定值"
+            ]
+        },
+        {
+            "id": "PY",
+            "name": "偏航系统",
+            "zb": [
+                "偏航角度",
+                "偏航速度",
+                "偏航电机电流",
+                "偏航刹车状态",
+                "偏航系统压力",
+                "偏航故障代码",
+                "偏航编码器反馈",
+                "偏航齿轮油温",
+                "偏航限位开关",
+                "偏航系统振动",
+                "偏航对风误差",
+                "偏航角度",
+                "偏航速度",
+                "偏航电机电流",
+                "偏航刹车状态",
+                "偏航系统压力",
+                "偏航故障代码",
+                "偏航编码器反馈",
+                "偏航齿轮油温",
+                "偏航限位开关",
+                "偏航系统振动",
+                "偏航对风误差"
+            ]
+        },
+        {
+            "id": "SC",
+            "name": "刹车系统",
+            "zb": [
+                "刹车片温度",
+                "刹车压力",
+                "刹车盘磨损",
+                "刹车状态",
+                "刹车液位",
+                "刹车液压压力",
+                "刹车电磁阀状态",
+                "刹车故障代码",
+                "刹车操作次数",
+                "刹车响应时间",
+                "刹车片温度",
+                "刹车压力",
+                "刹车盘磨损",
+                "刹车状态",
+                "刹车液位",
+                "刹车液压压力",
+                "刹车电磁阀状态",
+                "刹车故障代码",
+                "刹车操作次数",
+                "刹车响应时间"
+            ]
+        },
+        {
+            "id": "LQ",
+            "name": "冷却系统",
+            "zb": [
+                "冷却液温度",
+                "冷却液压力",
+                "冷却液流量",
+                "冷却风扇状态",
+                "散热器温度",
+                "冷却泵状态",
+                "冷却液品质",
+                "冷却系统泄漏",
+                "冷却过滤器状态",
+                "冷却系统功耗",
+                "冷却液温度",
+                "冷却液压力",
+                "冷却液流量",
+                "冷却风扇状态",
+                "散热器温度",
+                "冷却泵状态",
+                "冷却液品质",
+                "冷却系统泄漏",
+                "冷却过滤器状态",
+                "冷却系统功耗"
+            ]
+        },
+        {
+            "id": "CG",
+            "name": "传感器系统",
+            "zb": [
+                "风速传感器",
+                "风向传感器",
+                "温度传感器",
+                "振动传感器",
+                "压力传感器",
+                "位移传感器",
+                "转速传感器",
+                "电流传感器",
+                "电压传感器",
+                "湿度传感器",
+                "位置传感器",
+                "光照传感器",
+                "风速传感器",
+                "风向传感器",
+                "温度传感器",
+                "振动传感器",
+                "压力传感器",
+                "位移传感器",
+                "转速传感器",
+                "电流传感器",
+                "电压传感器",
+                "湿度传感器",
+                "位置传感器",
+                "光照传感器"
+            ]
+        },
+        {
+            "id": "DL",
+            "name": "电力系统",
+            "zb": [
+                "电网电压",
+                "电网频率",
+                "功率因数",
+                "有功功率",
+                "无功功率",
+                "电流谐波",
+                "电压波动",
+                "断路器状态",
+                "变压器温度",
+                "电缆温度",
+                "接地电阻",
+                "绝缘监测",
+                "电网电压",
+                "电网频率",
+                "功率因数",
+                "有功功率",
+                "无功功率",
+                "电流谐波",
+                "电压波动",
+                "断路器状态",
+                "变压器温度",
+                "电缆温度",
+                "接地电阻",
+                "绝缘监测"
+            ]
+        },
+        {
+            "id": "AQ",
+            "name": "安全系统",
+            "zb": [
+                "紧急停机状态",
+                "火灾报警",
+                "雷击保护",
+                "门禁状态",
+                "视频监控",
+                "环境监测",
+                "安全链状态",
+                "报警历史",
+                "人员进入记录",
+                "紧急停机状态",
+                "火灾报警",
+                "雷击保护",
+                "门禁状态",
+                "视频监控",
+                "环境监测",
+                "安全链状态",
+                "报警历史",
+                "人员进入记录",
+                "紧急停机状态",
+                "火灾报警",
+                "雷击保护",
+                "门禁状态",
+                "视频监控",
+                "环境监测",
+                "安全链状态",
+                "报警历史",
+                "人员进入记录"
+            ]
+        }
+    ]
+}

+ 245 - 66
src/views/cesiumComponents/windMap3D.vue

@@ -106,6 +106,141 @@ import ModelUnpack from "@/components/modelUnpack.vue";
 import { WindLayer } from "cesium-wind";
 import windGridData from "./windGridData.json";
 import { HeightReference } from "cesium";
+
+class AdvancedBillboardGenerator {
+  constructor() {
+    this.cache = new Map();
+  }
+
+  // 生成高级灯牌
+  generateAdvancedBillboard(data) {
+    const {
+      title,
+      statusItems = [],
+      width = 120,
+      backgroundColor = "rgba(13, 38, 77, 0.95)",
+      borderGradient = ["#00e5ff", "#0077ff"],
+      titleColor = "#4fc3f7",
+      valueColor = "#00ff88",
+      labelColor = "#b3e5fc",
+    } = data;
+
+    const cacheKey = JSON.stringify(data);
+    if (this.cache.has(cacheKey)) {
+      return this.cache.get(cacheKey);
+    }
+
+    const canvas = document.createElement("canvas");
+    const ctx = canvas.getContext("2d");
+    canvas.width = width;
+
+    // 计算高度
+    const titleHeight = 30;
+    const itemHeight = 25;
+    const padding = 8;
+    const height = titleHeight + statusItems.length * itemHeight + padding * 2;
+    canvas.height = height;
+
+    // 绘制背景
+    this.drawAdvancedBackground(
+      ctx,
+      width,
+      height,
+      backgroundColor,
+      borderGradient
+    );
+
+    // 绘制标题
+    ctx.fillStyle = titleColor;
+    ctx.font = "bold 14px sans-serif";
+    ctx.textAlign = "center";
+    ctx.fillText(title, width / 2, padding + 14);
+
+    // 绘制状态项
+    statusItems.forEach((item, index) => {
+      const y = titleHeight + padding + index * itemHeight;
+
+      // 标签
+      ctx.fillStyle = labelColor;
+      ctx.font = "12px sans-serif";
+      ctx.textAlign = "left";
+      ctx.fillText(item.label + ":", padding, y + 12);
+
+      // 值
+      ctx.fillStyle = valueColor;
+      ctx.font = "bold 12px sans-serif";
+      ctx.textAlign = "right";
+      ctx.fillText(item.value, width - padding, y + 12);
+    });
+
+    const dataURL = canvas.toDataURL();
+    this.cache.set(cacheKey, dataURL);
+
+    return dataURL;
+  }
+
+  drawAdvancedBackground(ctx, width, height, bgColor, borderGradient) {
+    const borderRadius = 12;
+
+    // 主背景
+    this.drawRoundedRect(ctx, 0, 0, width, height, borderRadius, bgColor);
+
+    // 边框渐变
+    const gradient = ctx.createLinearGradient(0, 0, width, height);
+    gradient.addColorStop(0, borderGradient[0]);
+    gradient.addColorStop(1, borderGradient[1]);
+
+    this.drawRoundedRect(
+      ctx,
+      2,
+      2,
+      width - 4,
+      height - 4,
+      borderRadius - 2,
+      gradient,
+      2
+    );
+
+    // 内发光效果
+    ctx.shadowColor = borderGradient[0];
+    ctx.shadowBlur = 10;
+    this.drawRoundedRect(
+      ctx,
+      4,
+      4,
+      width - 8,
+      height - 8,
+      borderRadius - 4,
+      "transparent",
+      1
+    );
+    ctx.shadowBlur = 0;
+  }
+
+  drawRoundedRect(ctx, x, y, width, height, radius, color, lineWidth = 0) {
+    ctx.beginPath();
+    ctx.moveTo(x + radius, y);
+    ctx.lineTo(x + width - radius, y);
+    ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
+    ctx.lineTo(x + width, y + height - radius);
+    ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
+    ctx.lineTo(x + radius, y + height);
+    ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
+    ctx.lineTo(x, y + radius);
+    ctx.quadraticCurveTo(x, y, x + radius, y);
+    ctx.closePath();
+
+    if (lineWidth > 0) {
+      ctx.strokeStyle = color;
+      ctx.lineWidth = lineWidth;
+      ctx.stroke();
+    } else {
+      ctx.fillStyle = color;
+      ctx.fill();
+    }
+  }
+}
+
 export default {
   name: "windMap3D",
   components: {
@@ -150,7 +285,7 @@ export default {
       verticalExaggeration: 1.0,
       dixingAdd: false,
       infoBoxes: [],
-      entityxy: {}
+      entityxy: {},
     };
   },
   mounted() {
@@ -401,11 +536,11 @@ export default {
     },
     // 展示所选风场的风机
     showWindFromStation(viewer) {
-        this.infoBoxes = [];
-        fjLonLatJson.data.forEach((e, index) => {
-            this.showStatuswind(viewer, e);
-        });
-        this.resetWindViewport();
+      this.infoBoxes = [];
+      fjLonLatJson.data.forEach((e, index) => {
+        this.showStatuswind(viewer, e);
+      });
+      this.resetWindViewport();
     },
     // 根据状态展示不同颜色风机贴图
     showStatuswind(viewer, e) {
@@ -460,17 +595,11 @@ export default {
         hpRoll
       );
 
-    //   const statueColor = this.getWtStatue(wtStatue);
-      const statueFJ = this.getWtStatue(status, 'en');
-      const statueZh = this.getWtStatue(status, 'zh');
+      //   const statueColor = this.getWtStatue(wtStatue);
+      const statueFJ = this.getWtStatue(status, "en");
+      const statueZh = this.getWtStatue(status, "zh");
 
-      // 获取这些位置的精确地形高度
-      Cesium.sampleTerrainMostDetailed(this.viewer.terrainProvider, position)
-        .then((pos) => {})
-        .catch(function (error) {
-          console.log("获取地形高度时发生错误:", error);
-        });
-        let that = this
+      let that = this;
       const entity = viewer.entities.add({
         name, // 模型名称
         position, // 模型位置
@@ -478,73 +607,111 @@ export default {
         animation: false,
         model: {
           uri: this.dixingAdd
-            // ? "/public/static/model/fjSolo/model.glb" 
-            // ? "/public/static/model/fjStatus/fj_anmation_bw.glb" 
-            ? `/public/static/model/fjStatus/fj_${statueFJ}.glb`
-            : "/public/static/model/dixing/model.glb", 
-            // : "/public/static/model/dixing/terrain.glb",
+            ? // ? "/public/static/model/fjSolo/model.glb"
+              // ? "/public/static/model/fjStatus/fj_anmation_bw.glb"
+              `/public/static/model/fjStatus/fj_${statueFJ}.glb`
+            : "/public/static/model/dixing/model.glb",
+          // : "/public/static/model/dixing/terrain.glb",
           scale: this.dixingAdd ? 20 : 10000,
           // 模型贴地
-        //   heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
-        //   heightReference: Cesium.HeightReference.NONE,
-        //   silhouetteSize: this.dixingAdd ? 2 : 0,
-        //   silhouetteColor: Cesium.Color.fromCssColorString(statueColor),
-        //   runAnimations: wtStatue !== 7 ? false : true,
+          //   heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+          //   heightReference: Cesium.HeightReference.NONE,
+          //   silhouetteSize: this.dixingAdd ? 2 : 0,
+          //   silhouetteColor: Cesium.Color.fromCssColorString(statueColor),
+          //   runAnimations: wtStatue !== 7 ? false : true,
         },
       });
+
+      // 使用高级灯牌生成器
+      const advancedGenerator = new AdvancedBillboardGenerator();
+
+      let statusItems = [];
+      const statusArray = [
+        { label: "风速", value: "10m/s" },
+        { label: "状态", value: statueZh },
+        { label: "转速", value: "1000p" },
+        { label: "功率", value: "50kW" },
+        { label: "其他参数A", value: "...." },
+        { label: "其他参数B", value: "...." },
+        { label: "其他参数C", value: "...." },
+        { label: "其他参数D", value: "...." },
+        { label: "其他参数E", value: "...." },
+        { label: "其他参数F", value: "...." },
+      ];
+
+      for (let i = 0; i <= this.randomNum(1, 9); i++) {
+        statusItems.push(statusArray[i]);
+      }
+
+      const billboardImage = advancedGenerator.generateAdvancedBillboard({
+        title: name,
+        statusItems,
+        borderGradient: ["#00e5ff", "#2979ff"],
+      });
+
       const entityxy = viewer.entities.add({
-        name, // 模型名称
-        position, // 模型位置
-        orientation, // 模型朝向
-        //添加标签
-        label: {
-          text: `${name}\n\n风速: 10m/s\n\n状态: ${statueZh}`,
-          font: "14px sans-serif",
-          fillColor: Cesium.Color.fromBytes(255, 255, 255),
-            pixelOffset: new Cesium.Cartesian2(-50, -20)
-        },
+        // name, // 模型名称
+        // position, // 模型位置
+        // orientation, // 模型朝向
+        // //添加标签
+        // label: {
+        //   text: `${name}\n\n风速: 10m/s\n\n状态: ${statueZh}`,
+        //   font: "14px sans-serif",
+        //   fillColor: Cesium.Color.fromBytes(255, 255, 255),
+        //   pixelOffset: new Cesium.Cartesian2(-50, -20),
+        // },
+        // billboard: {
+        //   image: backPng,
+        //   scale: 0.2,
+        //   verticalOrigin: Cesium.VerticalOrigin.CENTER,
+        //   pixelOffset: new Cesium.Cartesian2(-50, -20),
+        //   // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
+        // },
+        name,
+        position,
         billboard: {
-            image: backPng,
-            scale: 0.2,
-            verticalOrigin: Cesium.VerticalOrigin.CENTER,
-            pixelOffset: new Cesium.Cartesian2(-50, -20)
-            // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
+          image: billboardImage,
+          scale: 1,
+          verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 原来已经是CENTER,现在改为BOTTOM
+          pixelOffset: new Cesium.Cartesian2(80, -50), // 原来是-20,现在改为30,向上移动
+          eyeOffset: new Cesium.Cartesian3(0, 0, 0), // 保持固定大小
+          heightReference: Cesium.HeightReference.NONE,
         },
       });
 
       this.dixingAdd = true;
 
-        viewer.camera.moveEnd.addEventListener(() => {
-            // 获取相机的笛卡尔3D坐标
-            const position = viewer.camera.position;
-            
-            // 将笛卡尔坐标转换为地理坐标(弧度)
-            const cartographic = Cesium.Cartographic.fromCartesian(position);
-            
-            // 高度(以米为单位)
-            // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
-            const height = Cesium.Math.toDegrees(cartographic.height); 
-            if (height > 3000000) {
-                entityxy.show = false
-                console.log("entityxy false", entityxy.show);
-            }
-            if (height < 3000000) {
-                entityxy.show = true
-                console.log("entityxy true", entityxy.show);
-            }
-            // 强制请求一次场景重绘
-            if (viewer && viewer.scene) {
-            viewer.scene.requestRender();
-            }
-            console.log('相机高度 (椭球体高):', height, '米');
-        });
+      viewer.camera.moveEnd.addEventListener(() => {
+        // 获取相机的笛卡尔3D坐标
+        const position = viewer.camera.position;
+
+        // 将笛卡尔坐标转换为地理坐标(弧度)
+        const cartographic = Cesium.Cartographic.fromCartesian(position);
+
+        // 高度(以米为单位)
+        // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
+        const height = Cesium.Math.toDegrees(cartographic.height);
+        if (height > 3000000) {
+          entityxy.show = false;
+          console.log("entityxy false", entityxy.show);
+        }
+        if (height < 3000000) {
+          entityxy.show = true;
+          console.log("entityxy true", entityxy.show);
+        }
+        // 强制请求一次场景重绘
+        if (viewer && viewer.scene) {
+          viewer.scene.requestRender();
+        }
+        console.log("相机高度 (椭球体高):", height, "米");
+      });
 
       // 创建事件处理器
       const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
       handler.setInputAction(function (movement) {
         var position = movement.position;
         var pickedObject = viewer.scene.pick(position);
-        if (pickedObject && pickedObject.id === entity) { 
+        if (pickedObject && pickedObject.id === entity) {
           console.log("你点击了标签或模型!", entity);
           // console.log("标签或模型数据!", val);
           that.modelVal = model;
@@ -727,6 +894,18 @@ export default {
       this.showcomModelDia = val;
       this.modelVal = null;
     },
+
+    randomNum(minNum, maxNum) {
+      switch (arguments.length) {
+        case 1:
+          return parseInt(Math.random() * minNum + 1, 10);
+        case 2:
+          return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
+        default:
+          return 0;
+      }
+    },
+
     csceneElliposid(viewer) {
       let that = this;
       // 获取 scene 和 ellipsoid