jihongshun
4 天以前 0b906280ec163a3e80364e091550d8462db6b9f9
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: {
@@ -136,10 +144,6 @@
        form:{},
        deviceData:null,
        activeName: 'first',
        totalDistance: 3054.9,
        totalTime: '5m 56s',
        totalPoints: 11,
        totalPhotos: 3,
        waypoints:[],
        selectedIndex:null,
        chooseItem: null,
@@ -215,7 +219,7 @@
        Cesium.Matrix4.inverseTransformation(transform, new Cesium.Matrix4()),
        direction,
        new Cesium.Cartesian3()
      );
      );
      Cesium.Cartesian3.normalize(directionLocal, directionLocal);
      return Math.asin(directionLocal.z); // z轴向上
    },
@@ -261,7 +265,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 {
@@ -480,7 +500,7 @@
          const groundA = result[i];
          const raisedA = {
            id: this.generateId(),
            label: groundA.label+ "-加高111",
            label: groundA.label+ "-加高",
            longitude: groundA.longitude,
            latitude: groundA.latitude,
            height: groundA.height,
@@ -488,8 +508,9 @@
              {
                ...pointA,
                id: this.generateId(),
                label: pointA.label + "-加高2222",
                height: pointA.height + 50,
                label: pointA.label + "-加高",
                // height: pointA.height + 50,
                height: pointA.height  + (towerHeight  - pointA.height  +  20),
                actions:[]
              }
            ]
@@ -508,8 +529,8 @@
              {
                ...pointB,
                id: this.generateId(),
                label: pointB.label + "-加高3333",
                height: pointB.height + 50,
                label: pointB.label + "-加高",
                height: pointB.height  + (towerHeight  - pointB.height  +  20),
                actions:[]
              }
            ]
@@ -666,47 +687,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逆时针旋转指定角度后的新位置
    //  空中点或者地面点笛卡尔坐标 塔的笛卡尔坐标    塔的朝向值
@@ -927,13 +974,13 @@
  height: 36px;
  line-height: 36x;
  transition: transform 0.2s;
  font-size: 24px;
  font-size: 22px;
}
.waypoint-header .waypoint-index {
  font-size: 24px;
  font-size: 22x;
}
.rotated {
  transform: rotate(-90deg);