吉安感知网项目-前端
shuishen
2026-01-31 6629c5924aa1711988c2e51f7c4c00c24f8ec878
feat:增加地图初始化,跳转行政区逻辑
3 files modified
39 ■■■■■ changed files
applications/drone-command/src/components/map-container/common-cesium-map.vue 29 ●●●●● patch | view | raw | blame | history
applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue 6 ●●●● patch | view | raw | blame | history
applications/drone-command/src/views/areaManage/sceneManage/FormDiaLog.vue 4 ●●● patch | view | raw | blame | history
applications/drone-command/src/components/map-container/common-cesium-map.vue
@@ -3,6 +3,8 @@
</template>
<script setup>
import * as Cesium from 'cesium'
import { onBeforeUnmount, onMounted, watch } from 'vue'
import { PublicCesium } from '@/utils/cesium/publicCesium'
import { loadJaAdminBoundary, removeJaAdminBoundary } from '@/utils/cesium/adminBoundary'
@@ -172,11 +174,36 @@
    })
}
const zoomToAdminBoundary = async () => {
    if (!viewer) return
    const resolveSources = () => {
        if (adminBoundarySources) return adminBoundarySources
        const boundarySource = viewer.dataSources.getByName(ADMIN_BOUNDARY_NAMES.boundary)?.[0] ?? null
        const lineSource = viewer.dataSources.getByName(ADMIN_BOUNDARY_NAMES.line)?.[0] ?? null
        const labelSource = viewer.dataSources.getByName(ADMIN_BOUNDARY_NAMES.label)?.[0] ?? null
        if (boundarySource || lineSource || labelSource) {
            adminBoundarySources = { boundarySource, lineSource, labelSource }
        }
        return adminBoundarySources
    }
    let sources = resolveSources()
    if (!sources?.boundarySource) {
        sources = await loadJaAdminBoundary(viewer, { zoomTo: false })
        adminBoundarySources = sources
    }
    const target = sources?.boundarySource
    if (!target) return
    await viewer.flyTo(target, {
        duration: 0,
        offset: new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-75), 0),
    })
}
const getMap = () => ({ viewer, publicCesium: viewInstance })
const getViewer = () => viewer
const getPublicCesium = () => viewInstance
defineExpose({ getMap, getViewer, getPublicCesium, setAdminBoundaryVisible })
defineExpose({ getMap, getViewer, getPublicCesium, setAdminBoundaryVisible, zoomToAdminBoundary })
</script>
<style scoped lang="scss">
applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue
@@ -574,7 +574,11 @@
    await nextTick()
    initMap()
    await getAreaList()
    if (dialogMode.value !== 'add') {
    if (dialogMode.value === 'add') {
        console.log(111)
        mapRef.value?.zoomToAdminBoundary?.()
    } else {
        await loadDetail()
    }
    await nextTick()
applications/drone-command/src/views/areaManage/sceneManage/FormDiaLog.vue
@@ -610,7 +610,9 @@
    await nextTick()
    initMap()
    await getSceneConfigList()
    if (dialogMode.value !== 'add') {
    if (dialogMode.value === 'add') {
        mapRef.value?.zoomToAdminBoundary?.()
    } else {
        await loadDetail()
    }
    await nextTick()