jihongshun
2025-09-11 bcb67f336c2b352177884b8db6decc3fcf382bb0
src/views/system/shootPoint/components/shootPointDialog.vue
@@ -55,6 +55,10 @@
                              <i 
                                class="el-icon-success" 
                              ></i>
                              <i
                                class="el-icon-delete"
                                @click.stop="deleteItem(wp)"
                              ></i>
                              <div class="waypoint-contnet">
                                <span class="waypoint-index">{{ wp.label +'----'  +wp.children[0].label }}</span>
                                <span v-for="(action, aIndex) in wp.children[0].actions" 
@@ -503,7 +507,7 @@
      console.log(this.treeData)
    },
    //数组 塔的精度 塔的纬度  塔的高度  半径
    insertRaisedPoints(data, centerLon, centerLat, centerHeight, radius = 10) {
    insertRaisedPoints(data, centerLon, centerLat, centerHeight, radius = 15) {
      const center = Cesium.Cartesian3.fromDegrees(centerLon, centerLat, centerHeight);
      const result = JSON.parse(JSON.stringify(data)); // 深拷贝避免污染原数据
      const inserts = []; // 用于存储插入项及其目标位置
@@ -516,7 +520,8 @@
        const cartA = Cesium.Cartesian3.fromDegrees(pointA.longitude, pointA.latitude, pointA.height);
        const cartB = Cesium.Cartesian3.fromDegrees(pointB.longitude, pointB.latitude, pointB.height);
        console.log(cartA)
        console.log(cartB)
        const closest = this.closestPointOnSegment(cartA, cartB, center);
        const distance = Cesium.Cartesian3.distance(closest, center);
        console.log(distance)
@@ -733,7 +738,6 @@
          });
      })
      console.log(this.treeData)
      this.dialogVisible = false
      // const dealArr = this.submitDealData()
      const transformed = this.treeData.map((ground, index) => {
        const pointNumber = index + 1;
@@ -748,11 +752,32 @@
              longitude: ground.longitude,
              pointNumber: 1,
              targetName: ground.label,
              actions:child.actions.map((item, index) => ({
                actionIndex: index.toString(),
                actionType: typeDictionary[item.type] || "", // 如果类型不存在字典中,默认空字符串
                actionValue: item.extra.value
              }))
              // actions:child.actions.map((item, index) => ({
              //   actionIndex: index.toString(),
              //   actionType: typeDictionary[item.type] || "", // 如果类型不存在字典中,默认空字符串
              //   actionValue: item.extra.value
              // }))
              actions:child.actions.map(action => {
                console.log(action)
                switch (action.type) {
                  case "悬停":
                    return { hoverTime: parseFloat(action.extra.value) };
                  case "变倍":
                    return { zoom: parseFloat(action.extra.value) };
                  case "开始录像":
                    return { startRecord: true };
                  case "结束录像":
                    return { stopRecord: true };
                  case "拍照":
                    // const [takePhotoType, useGlobalImageFormat] = action.actionValue.split('-');
                    return {
                      takePhotoType: 0,
                      useGlobalImageFormat: 0
                    };
                  default:
                    return {};
                }
              })
            }
          ],
          latitude: child.latitude,
@@ -774,6 +799,7 @@
          message: '新增模板成功',
          type: 'success'
        })
        this.dialogVisible = false
        this.$emit('on-submit')
        this.$emit('close')
      }
@@ -800,6 +826,7 @@
      console.log(this.treeData)
      console.log(this.waypoints)
      console.log(data)
      console.log(this.lastTableArr)
      const byLabel = this.addOrUpdate(this.lastTableArr, data, 'label', this)
      this.waypoints  = this.lastTableArr
      console.log(byLabel)
@@ -822,6 +849,33 @@
    },
    clickItem(value){
        this.$refs.initMap.editAction(value);  
    },
    extractNumberFromLabel(label){
      const match = label.match(/(\d+)/); // 获取标签中的数字
      return match ? match[0] : null;
    },
    deleteItem(item){
      this.treeData = this.treeData.filter(obj=>obj.id != item.id)
      this.lastTableArr = this.lastTableArr.filter(obj=>obj.id != item.id)
      const data1LabelNumber = this.extractNumberFromLabel(item.label);
      // 创建一个新的EntityCollection,只保留不匹配的实体
      const filteredEntities = window.viewerM.entities.values.filter(entity => {
        const entityIdNumber =  this.extractNumberFromLabel(entity.id); // 提取实体的id中的数字
        return entityIdNumber !== data1LabelNumber; // 如果数字不一致,保留该实体
      });
      // 清空原来的entities集合并重新添加过滤后的实体
      window.viewerM.entities.removeAll(); // 清空所有实体
      filteredEntities.forEach(entity => window.viewerM.entities.add(entity))
      console.log(item)
      console.log(this.treeData)
       console.log(this.lastTableArr)
      console.log(window.viewerM.entities.values)
      // console.log(window.viewerM.entities.values[0].id)
      // console.log(window.viewerM.entities.values[1].id)
      // console.log(window.viewerM.entities.values[2].id)
      // console.log(window.viewerM.entities.values[3].id)
    }
  }
}