jihongshun
6 天以前 01686fa18ef51e970ccd17d199e26a5ccfa9e074
src/views/system/shootPoint/components/shootPointDialog.vue
@@ -56,7 +56,7 @@
                                class="el-icon-success" 
                              ></i>
                              <div class="waypoint-contnet">
                                <span class="waypoint-index">{{ wp.label + wp.children[0].label }}</span>
                                <span class="waypoint-index">{{ wp.label +'----'  +wp.children[0].label }}</span>
                                <span v-for="(action, aIndex) in wp.children[0].actions" 
                                      :key="action.id" 
                                      class="action-icon"
@@ -102,6 +102,14 @@
let towerHeight = 45
//塔的朝向算法所用到的 旋转度数
let rotationAngle = Cesium.Math.toRadians(0)
const typeDictionary = {
  "拍照": "01",
  "变倍": "02",
  "开始录像": "03",
  '结束录像':'04',
  "悬停": "05",
}
export default{
  name:'shootPointDialog',
   components: {
@@ -261,7 +269,23 @@
        .filter(item => Array.isArray(item.children))
        .map(item => item.children)
        .reduce((acc, cur) => acc.concat(cur), []);
        //通过右点击 对比之前的动作的数组 把之前动作数组缓存 然后反赋值给新数据
      if(this.lastTableArr?.length >0){
        this.treeData = this.treeData.map(item2 => {
        const matchingItem1 = this.lastTableArr.find(item1 => item1.label === item2.label);
          if (matchingItem1) {
            item2.children = item2.children.map(child2 => {
              const matchingChild1 = matchingItem1.children.find(child1 => child1.label === child2.label);
              if (matchingChild1) {
                // 将 actions 从 array1 复制到 this.treeData
                child2.actions = [...matchingChild1.actions];
              }
              return child2;
            });
          }
          return item2;
        })
      }
      childrenArr?.forEach((ele)=>{
        if(ele.actions) {
        }else {
@@ -666,47 +690,73 @@
      console.log(this.$refs.initMap.preVideoScopePrimitiveArrTie)
      console.log(this.treeData)
      console.log(this.waypoints)
      // this.dialogVisible = false
      this.$refs.initMap.preVideoScopePrimitiveArrTie.forEach(point => {
          // 遍历原始数据
          this.treeData.forEach(item => {
              item.children.forEach(child => {
                  // 如果名称相同
                  if (child.label === point.name) {
                      // 向 actions 数组的第一项 push zoomRatio
                      console.log(child)
                      console.log(point.primitive)
                      child.actions.unshift({
                          "id": Date.now(), // 使用当前时间作为唯一ID
                          "type": "变倍",
                          "extra": {
                              "value": point.primitive.zoomRatio || 1
                          }
                      });
                  }
              });
          });
      })
      console.log(this.treeData)
      this.dialogVisible = false
      // const dealArr = this.submitDealData()
    //   const transformed = this.treeData.map((ground, index) => {
    //     const pointNumber = index + 1;
    //     const child = ground.children?.[0] || {};
      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,
    //   ardListWayPointsLS:transformed
    // }
    // addPoint(parmas).then(res=>{
    //   console.log(res)
    //   if(res.code == 200) {
    //     this.$message({
    //       message: '新增模板成功',
    //       type: 'success'
    //     })
    //     this.$emit('on-submit')
    //     this.$emit('close')
    //   }
    // })
    // console.log(parmas)
        return {
          altitude: child.height,
          ardGroundPoint: [
            {
              height: ground.height,
              latitude: ground.latitude,
              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
              }))
            }
          ],
          latitude: child.latitude,
          longitude: child.longitude,
          pointNumber: pointNumber,
          targetName: child.label
        };
    })
    console.log(transformed)
    let parmas = {
      templateName:this.form.templateName,
      modelId:this.chooseModelId,
      ardListWayPointsLS:transformed
    }
    addPoint(parmas).then(res=>{
      console.log(res)
      if(res.code == 200) {
        this.$message({
          message: '新增模板成功',
          type: 'success'
        })
        this.$emit('on-submit')
        this.$emit('close')
      }
    })
    console.log(parmas)
    },
    // 计算点A绕点B逆时针旋转指定角度后的新位置
    //  空中点或者地面点笛卡尔坐标 塔的笛卡尔坐标    塔的朝向值