From b498685e9c29c9c4b56f24f1ee1c9db9fd109ad9 Mon Sep 17 00:00:00 2001
From: jihongshun <1151753686@qq.com>
Date: 星期六, 12 七月 2025 17:23:02 +0800
Subject: [PATCH] 算法优化

---
 src/views/system/shootPoint/components/shootPointDialog.vue |   78 +++++++++++++++++++++++----------------
 1 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/src/views/system/shootPoint/components/shootPointDialog.vue b/src/views/system/shootPoint/components/shootPointDialog.vue
index 92d54c7..c33bac6 100644
--- a/src/views/system/shootPoint/components/shootPointDialog.vue
+++ b/src/views/system/shootPoint/components/shootPointDialog.vue
@@ -12,11 +12,16 @@
                 <div class="chooseModel">
                   <el-button type="primary" @click='chooseModel'>閫夋嫨妯″瀷</el-button>
                   <div class="modelType">
-                    妯″瀷鍚嶇О锛歿{ templateName }}
+                    妯″瀷鍚嶇О锛歿{ modelName }}
                   </div>
                   <div>
                     妯″瀷绫诲瀷锛歿{ templateType }}
                   </div>
+                  <el-form label-width="70px" :model="form">
+                    <el-form-item label="妯℃澘鍚嶇О">
+                      <el-input v-model="form.templateName"></el-input>
+                    </el-form-item>
+                  </el-form>
                 </div>
                 <div class="modelTree">
                   <div class='modelTreeTitle'>宸℃鐐圭洰褰�</div>
@@ -52,8 +57,9 @@
 import { addPoint} from "@/api/system/template"
  let globalon  = 0
 let globalat = 0
+let towerHeight = 47.47
 const centerCartesian = Cesium.Cartesian3.fromDegrees(globalon,globalat , 0)
-let rotationAngle = Cesium.Math.toRadians(60)
+let rotationAngle = Cesium.Math.toRadians(0)
 let relativeData 
 export default{
   name:'shootPointDialog',
@@ -78,8 +84,9 @@
         showMap:false,
         towerUrl:null,
         chooseModelId:null,
-        templateName:null,
-        templateType:null
+        modelName:null,
+        templateType:null,
+        form:{}
     }
   },
   mounted(){
@@ -167,7 +174,7 @@
       this.treeData = arr
       const result = this.replaceCloseChildrenWithHighestPoint(this.treeData,mergeNumber);
       // const updated = this.insertRaisedPoints(result, 0,0, 236, 130);
-      const updated = this.insertRaisedPoints(result, globalon, globalat, 236, 130);
+      const updated = this.insertRaisedPoints(result, globalon, globalat, towerHeight);
       this.treeData = updated
       const airPoints = []
       this.treeData.forEach(item => {
@@ -204,7 +211,7 @@
       console.log(this.treeData)
     },
     //鏁扮粍 濉旂殑绮惧害 濉旂殑绾害  濉旂殑楂樺害  鍗婂緞
-    insertRaisedPoints(data, centerLon, centerLat, centerHeight, radius = 130) {
+    insertRaisedPoints(data, centerLon, centerLat, centerHeight, radius = 10) {
       const center = Cesium.Cartesian3.fromDegrees(centerLon, centerLat, centerHeight);
       const result = JSON.parse(JSON.stringify(data)); // 娣辨嫹璐濋伩鍏嶆薄鏌撳師鏁版嵁
       const inserts = []; // 鐢ㄤ簬瀛樺偍鎻掑叆椤瑰強鍏剁洰鏍囦綅缃�
@@ -350,9 +357,10 @@
     },
     getRowData(row){
       console.log(row)
-      this.templateName = row.modelName
+      this.modelName = row.modelName
       this.templateType = row.modelType
       this.chooseModelId = row.id
+      towerHeight = row.towerHeight || 47.47
       this.showMap =false
       this.$nextTick(()=>{
         this.towerUrl = row.modelRoute
@@ -392,34 +400,40 @@
       console.log('鎷栨嫿瀹屾垚', { draggingNode, dropNode, dropType })
     },
     submit(){
+      if(!this.form.templateName){
+        return  this.$message({
+          message: '璇峰厛杈撳叆妯℃澘鍚嶇О鍐嶄繚瀛�',
+          type: 'warning'
+        })
+      }
       // this.dialogVisible = false
       // const dealArr = this.submitDealData()
-      const transformed = this.treeData.map((groundPoint, index) => {
-      const pointNumber = index + 1;
-      const airPoints = groundPoint.children.map(child => ({
-        altitude: child.height,
-        flightTemplateId: "",
-        latitude: child.latitude,
-        longitude: child.longitude,
-        pointNumber: 1, // 鍙牴鎹渶瑕佹敼涓� child 缂栧彿
-        targetName:child.label
-      }));
-      return {
-        ardAirPointLs: airPoints,
-        ardGroundPoint: {
-          flightTemplateId: "",
-          height: groundPoint.height,
-          latitude: groundPoint.latitude,
-          longitude: groundPoint.longitude,
-          pointNumber: 1,
-          targetName: groundPoint.label
-        },
-        pointNumber: pointNumber
-      };
-    });
+      const transformed = this.treeData.map((ground, index) => {
+        const pointNumber = index + 1;
+        const child = ground.children?.[0] || {};
+
+        return {
+          altitude: child.height,
+          ardGroundPoint: [
+            {
+              height: ground.height,
+              latitude: ground.latitude,
+              longitude: ground.longitude,
+              pointNumber: 1,
+              targetName: ground.label
+            }
+          ],
+          latitude: child.latitude,
+          longitude: child.longitude,
+          pointNumber: pointNumber,
+          targetName: child.label
+        };
+    })
+    console.log(transformed)
     let parmas = {
+      templateName:this.form.templateName,
       modelId:this.chooseModelId,
-      ard3DCoordinateSystemLs:transformed
+      ardListWayPointsLS:transformed
     }
     addPoint(parmas).then(res=>{
       console.log(res)
@@ -466,7 +480,7 @@
   text-align: center;
 }
 .chooseModel{
-  height: 100px;
+  height: 120px;
   /* border: 1px solid #dddddd; */
 }
 .cameraView{

--
Gitblit v1.9.3