guanqb
2022-11-22 75c24c7a60d95b3b52726f2425dff977a7ddfcea
点击显示范围并定位
2 files modified
54 ■■■■■ changed files
src/components/map/index.vue 13 ●●●●● patch | view | raw | blame | history
src/views/video/region.vue 41 ●●●●● patch | view | raw | blame | history
src/components/map/index.vue
@@ -315,6 +315,10 @@
            that.removeMxTileset(params.titlesetName, params.incident)
        })
        this.$EventBus.$on('flytoLayer', (params) => {
            that.flytoLayer(params.layerName, params.duration)
        })
    },
    methods: {
@@ -581,6 +585,15 @@
        // sdTilesetLayer
        /**
        * 飞到指定图层
        * @param {*} layerName 图层名称
        * @param {*} duration 时间
        */
        flytoLayer (layerName, duration = 3) {
            global.viewer.flyTo(layersObjcect[layerName], duration)
        },
        /**
         * 添加模型
         * @param {*} titlesetName 图层名称
         * @param {*} titlesetUrl 模型地址
src/views/video/region.vue
@@ -53,6 +53,7 @@
                                        class="btn"
                                        @click="deleteRegionSaveList(scope.row.id)"
                                    >删除</button>
                                    <button class="btn" @click="flytoRange(scope.row)">定位</button>
                                </template>
                            </el-table-column>
                        </el-table>
@@ -142,16 +143,44 @@
        getRegionSaveList () {
            getRegionSaveList(1, 10).then(res => {
                console.log(4444, res.data.data.records)
                this.saveRangeList = res.data.data.records
            })
        },
        deleteRegionSaveList (id) {
            deleteRegionSaveList(id).then(res => {
                console.log(res)
                console.log('删除', res)
                this.getRegionSaveList()
            })
        },
        flytoRange (data) {
            let positionStr = data.positions
            positionStr = data.positions.slice(11, positionStr.length - 1)
            let positionArr = positionStr.split(",")
            positionArr = positionArr.slice(0, positionArr.length - 1)
            let positionNewStr = ''
            positionArr.forEach(item => {
                let lng = item.split(' ')[0]
                let lat = item.split(' ')[1]
                positionNewStr += lng + ',' + lat + ';'
            })
            this.$EventBus.$emit('mapRemoveLayer', {
                layerName: 'rangeLayer',
                type: 'VectorLayer'
            })
            this.$EventBus.$emit('layerPolygonAdd', {
                layerName: 'rangeLayer',
                positions: positionNewStr,
                material: global.DC.Namespace.Cesium.Color.fromBytes(
                    255, 0, 0, 100
                ),
            })
            this.$EventBus.$emit('flytoLayer', {
                layerName: 'rangeLayer',
                duration: 3
            })
        },
        async getDevices (id) {
@@ -194,7 +223,7 @@
            //     siteHeading: -3,
            //     sitePitch: -90
            // })
            console.log('暂无定位')
        },
        async siteClick (e) {
@@ -264,6 +293,11 @@
            type: 'VectorLayer'
        })
        this.$EventBus.$emit('mapRemoveLayer', {
            layerName: 'rangeLayer',
            type: 'VectorLayer'
        })
        graphicLayer.destroy()
        this.$parent.$parent.resize('0px')
@@ -275,6 +309,7 @@
            this.flvPlayer.destroy()
            this.flvPlayer = null
        }
    }
}
</script>