GuLiMmo
2024-03-19 aec00ecc093be803860c8675cbe1c4c776a7cb4e
src/utils/cesium/use-kmz-tsa.ts
@@ -145,11 +145,21 @@
    template.value = tplXmlJson.Document
    return kmzRes
  }
  const create = (waylineBasicInfo) => {
  const create = async (waylineBasicInfo: { fileName: string; droneEnumValue: string; payloadEnumValue: string }) => {
    try {
      const { fileName, droneEnumValue, payloadEnumValue } = waylineBasicInfo
    const author = window.localStorage.getItem('username') || ''
    const createTime = new Date().getTime()
    // 模板
    const template = {
      const droneModel: { [key: string]: string } = {
        52: '0',
        53: '1',
        66: '0',
        67: '1',
        80: '0',
        81: '1',
      } as const
      const templateJson = {
      author,
      createTime,
      updateTime: createTime,
@@ -164,12 +174,12 @@
        globalTransitionalSpeed: 15,
        globalRTHHeight: 80,
        droneInfo: {
          droneEnumValue: 0,
          droneSubEnumValue: 0,
            droneEnumValue,
            droneSubEnumValue: droneModel[payloadEnumValue],
        },
        payloadInfo: {
          payloadEnumValue: 0,
          payloadSubEnumValue: 0,
            payloadEnumValue,
            payloadSubEnumValue: droneModel[payloadEnumValue],
          payloadPositionIndex: 0,
        },
      },
@@ -197,6 +207,11 @@
        globalUseStraightLine: 0,
        Placemark: [],
      },
      }
      template.value = templateJson
      return true
    } catch (error) {
      return error
    }
  }
  const save = () => {
@@ -246,6 +261,21 @@
          if (item === 'waylineId') {
            waylinesObj[key][item] = templateJson[key].templateId
          }
          if (item === 'Placemark') {
            const placemarks = _.cloneDeep(templateJson[key][item])
            placemarks.forEach(
              (placemark: {
                executeHeight: { '#text': string }
                ellipsoidHeight?: { [x: string]: string }
                height?: { [x: string]: string }
              }) => {
                placemark.executeHeight = { '#text': placemark.ellipsoidHeight?.['#text'] || '' }
                delete placemark.ellipsoidHeight
                delete placemark.height
              },
            )
            waylinesObj[key][item] = placemarks
          }
        })
      } else {
        waylinesObj[key] = templateJson[key]