From d8662fba10c3aab8366f46a216b9c2fc615901d2 Mon Sep 17 00:00:00 2001
From: jihongshun <1151753686@qq.com>
Date: 星期五, 18 七月 2025 10:00:23 +0800
Subject: [PATCH] 设备增加海拔字段

---
 src/views/system/project/components/addPorjectDialog.vue |    3 ++-
 src/views/system/device/components/deviceDialog.vue      |   18 +++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/views/system/device/components/deviceDialog.vue b/src/views/system/device/components/deviceDialog.vue
index ee4c403..659407b 100644
--- a/src/views/system/device/components/deviceDialog.vue
+++ b/src/views/system/device/components/deviceDialog.vue
@@ -20,6 +20,9 @@
             <el-input v-model="form.face" placeholder="璇疯緭鍏ユ湞鍚�"  style="width:90%;"/>
             <i class="el-icon-map-location" @click="gettiles3dCam" title="棰勮"></i>
           </el-form-item>
+          <el-form-item label="娴锋嫈楂樺害" prop="altitude">
+            <el-input v-model="form.altitude" placeholder="璇疯緭鍏ユ捣鎷旈珮搴�" />
+          </el-form-item>
         </el-form>
       </template>
       <template slot="cesium">
@@ -85,13 +88,13 @@
             this.$refs.cesiumMapSelctPoint.showPickPoint({
               longitude: +this.form.longitude,
               latitude: +this.form.latitude,
-              height: +this.form.height,
+              deviceHeight: +this.form.deviceHeight,
             })
             console.log(this.modelListData)
             let url = this.modelListData.filter(item=>item.id == this.form.modelId)[0].modelRoute
             console.log(url)
             this.modelUrl = url
-            const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.height);
+            const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.deviceHeight);
             console.log(position)
             // 璁剧疆妯″瀷鏂瑰悜锛堝彲閫夛級
             let model = viewer.entities.getById("MyModel");
@@ -131,18 +134,19 @@
       console.log(data)
       this.$set(this.form, 'longitude', data.longitude)
       this.$set(this.form, 'latitude', data.latitude)
-      this.$set(this.form, 'height', data.altitude)
+      this.$set(this.form, 'deviceHeight', data.altitude)
       this.$refs.form.validateField('longitude')
       this.$refs.form.validateField('latitude')
-      this.$refs.form.validateField('height')
+      this.$refs.form.validateField('deviceHeight')
     },
     submitForm() {
       this.$refs["form"].validate(valid => {
         console.log(this.form)
         this.form.longitude = Number(this.form.longitude)
         this.form.latitude = Number(this.form.latitude)
-        this.form.height = Number(this.form.height)
+        this.form.deviceHeight = Number(this.form.deviceHeight)
         this.form.face = Number(this.form.face)
+        this.form.altitude = Number(this.form.altitude) || 0
         if (valid) {
           this.$api.save('tower/device/', 'id', Object.assign({}, this.form)).then(res => {
             this.form = {}
@@ -185,13 +189,13 @@
         this.$message.error("璇疯緭鍏ョ含搴�");
         return;
       }
-      if (!this.form.height) {
+      if (!this.form.deviceHeight) {
         this.$message.error("璇疯緭鍏ラ珮搴�");
         return;
       }
       //鍔ㄦ�佺粡绾害鏈濆悜 鍔犺浇妯″瀷浣嶇疆棰勮
       // const position = Cesium.Cartesian3.fromDegrees(0, 0, 0);
-      const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.height);
+      const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.deviceHeight);
       // 璁剧疆妯″瀷鏂瑰悜锛堝彲閫夛級
       // const heading = Cesium.Math.toRadians(135); // 鏈濅笢鍗楁柟鍚�
       let model = viewer.entities.getById("MyModel");
diff --git a/src/views/system/project/components/addPorjectDialog.vue b/src/views/system/project/components/addPorjectDialog.vue
index b0fafb8..d7fdb06 100644
--- a/src/views/system/project/components/addPorjectDialog.vue
+++ b/src/views/system/project/components/addPorjectDialog.vue
@@ -100,7 +100,7 @@
     },
     flyToLocal(row){
       console.log(row)
-       const position = Cesium.Cartesian3.fromDegrees(row.longitude,row.latitude, row.altitude);
+       const position = Cesium.Cartesian3.fromDegrees(row.longitude,row.latitude, row.deviceHeight);
 
       // 璁剧疆妯″瀷鏂瑰悜锛堝彲閫夛級
       const heading = Cesium.Math.toRadians(row.face); // 鏈濅笢鍗楁柟鍚�
@@ -412,6 +412,7 @@
             routePointIndex: routePointList.length,
             longitude: airPoint.longitude,
             latitude: airPoint.latitude,
+            height: airPoint.height,
             isStartAndEndPoint: false,
           });
         });

--
Gitblit v1.9.3