jihongshun
2025-07-12 b498685e9c29c9c4b56f24f1ee1c9db9fd109ad9
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 transformed = this.treeData.map((ground, index) => {
      const pointNumber = index + 1;
      const airPoints = groundPoint.children.map(child => ({
        const child = ground.children?.[0] || {};
        return {
        altitude: child.height,
        flightTemplateId: "",
          ardGroundPoint: [
            {
              height: ground.height,
              latitude: ground.latitude,
              longitude: ground.longitude,
              pointNumber: 1,
              targetName: ground.label
            }
          ],
        latitude: child.latitude,
        longitude: child.longitude,
        pointNumber: 1, // 可根据需要改为 child 编号
          pointNumber: pointNumber,
        targetName:child.label
      }));
      return {
        ardAirPointLs: airPoints,
        ardGroundPoint: {
          flightTemplateId: "",
          height: groundPoint.height,
          latitude: groundPoint.latitude,
          longitude: groundPoint.longitude,
          pointNumber: 1,
          targetName: groundPoint.label
        },
        pointNumber: pointNumber
      };
    });
    })
    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{