1
mayisheng
2022-08-15 81f54040c2cb65537c6c6e1db8358a39a57dea0d
src/components/searchDetails/index.vue
@@ -1,12 +1,12 @@
<template>
    <div class="search-nav-bar" ref="searchNavBar">
        <div class="container">
            <div class="header" @mousedown="move" :class="{'move': moveFlag}">
            <div class="header" @mousedown="move" :class="{ move: moveFlag }">
                <div class="title">
                    <img class="icon deblurring" src="/img/icon/search.png" alt />
                    <span>查询结果</span>
                </div>
                <img class="close" src="/img/navicon/close.png" alt @click="closeModel" />
                <img class="close deblurring" src="/img/navicon/close.png" alt @click="closeModel" />
            </div>
            <div class="content">
                <ul>
@@ -16,7 +16,7 @@
                        @click="mapPopup(item)"
                    >
                        <img src="/img/navicon/tag.png" alt />
                        <span>{{item.mechanismname}}</span>
                        <span>{{ item.mechanismname }}</span>
                    </li>
                </ul>
            </div>
@@ -31,16 +31,13 @@
    name: 'searchDetails',
    data () {
        return {
            moveFlag: false,
            DC: null
            moveFlag: false
        }
    },
    created () {
        this.DC = global.DC
    },
    computed: {
        ...mapGetters([
            'viewer',
            'popupBgUrl',
            'pupupQRUrl',
            // 点信息
@@ -53,10 +50,20 @@
            'introduceText',
            // 全景地址
            'panoramaUrl',
            'searchPopupList'
            'searchPopupList',
            'twoOrThree'
        ])
    },
    methods: {
        coordinate (item) {
            const arr = item.split(',')
            return {
                lng: arr[0],
                lat: arr[1]
            }
        },
        move (e) {
            const that = this
            const odiv = this.$refs.searchNavBar // 获取目标元素
@@ -93,8 +100,8 @@
                }
                // 移动当前元素
                odiv.style.left = (left) + 'px'
                odiv.style.top = (top) + 'px'
                odiv.style.left = left + 'px'
                odiv.style.top = top + 'px'
                odiv.style.bottom = 'auto'
            }
            document.onmouseup = (e) => {
@@ -105,13 +112,25 @@
        },
        mapPopup (item) {
            let obj = {}
            if (item.x && item.x != '') {
                const position = this.coordinate(item.x)
                obj = {
                    lng: position.lng, lat: position.lat
                }
            } else {
                obj = {
                    lng: item.longitude, lat: item.latitude
                }
            }
            this.$store.commit('CLEAR_ALL', null)
            var imgArr = item.tpurl.split(',')
            this.$store.commit('SET_POPUPBGURL', imgArr[0])
            this.$store.commit('SET_POPUPQRURL', item.codeurl)
            this.$store.commit('SET_POINTPOSITION', [Number(item.jd), Number(item.wd), Number(item.gd), Number(item.heading), Number(item.pitch), Number(item.roll)])
            this.$store.commit('SET_STATENAME', item.mechanismname)
            this.$store.commit('SET_SITENAME', item.address)
            this.$store.commit('SET_TELEPHONE', item.telephone)
@@ -135,23 +154,76 @@
                this.$store.commit('SET_LIVELIST', [])
            }
            this.newPopup(item)
            this.viewer.flyToPosition(
                new this.DC.Position(Number(item.jd), Number(item.wd), Number(300), Number(item.heading), Number(item.pitch), Number(item.roll)),
                function () {
                },
                3
            )
            this.newPopup(item, obj)
            if (this.twoOrThree == '三 维') {
                this.$store.commit('SET_POINTPOSITION', [
                    Number(obj.lng),
                    Number(obj.lat),
                    Number(item.gd),
                    Number(item.heading),
                    Number(item.pitch),
                    Number(item.roll)
                ])
                global.viewer.flyToPosition(
                    new global.DC.Position(
                        Number(obj.lng),
                        Number(obj.lat),
                        300,
                        Number(item.heading),
                        Number(item.pitch),
                        Number(item.roll)
                    ),
                    function () { },
                    3
                )
            } else {
                this.$store.commit('SET_POINTPOSITION', [
                    Number(item.jd),
                    Number(item.wd),
                    Number(50),
                    Number(item.heading),
                    Number(item.pitch),
                    Number(item.roll)
                ])
                global.viewer.flyToPosition(
                    new global.DC.Position(
                        Number(item.jd),
                        Number(item.wd),
                        300,
                        Number(item.heading),
                        Number(item.pitch),
                        Number(item.roll)
                    ),
                    function () { },
                    3
                )
            }
        },
        newPopup (item) {
            const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd), Number(item.heading), Number(item.pitch), Number(item.roll)))
        newPopup (item, obj) {
            let position
            if (this.twoOrThree == '三 维') {
                position = global.DC.Transform.transformWGS84ToCartesian(
                    new global.DC.Position(
                        Number(obj.lng),
                        Number(obj.lat),
                        Number(item.gd)
                    )
                )
            } else {
                position = global.DC.Transform.transformWGS84ToCartesian(
                    new global.DC.Position(
                        Number(item.jd),
                        Number(item.wd),
                        Number(50)
                    )
                )
            }
            // eslint-disable-next-line no-unused-vars
            var popup = new this.DC.DivForms(this.viewer, {
            var popup = new global.DC.DivForms(global.viewer, {
                domId: 'divFormsDomBox',
                position: [
                    position
                ]
                position: [position]
            })
            this.$store.commit('SET_PANORAMAPOPUP', false)
@@ -160,15 +232,25 @@
        },
        closeModel () {
            this.$store.commit('SET_SEARCHPOPUPFLAG', false)
            var path = this.$route.path
            if (path.indexOf('/orgnav') != -1) {
                this.$store.dispatch('delVisitedViews', this.$route)
                this.$router.push('/pcLayout/default')
            }
            this.$store.commit('SET_SEARCHPOPUPLIST', [])
            this.$store.commit('SET_ORGNAVBARTITLE', '')
            this.$store.commit('SET_ORGNAVBARFLAG', false)
            this.$store.commit('SET_ORGNAVBARLIST', [])
            this.$store.commit('SET_DETAILSPOPUP', false)
            this.$store.commit('SET_PANORAMAPOPUP', false)
            this.$store.commit('SET_MONITORPOPUP', false)
        }
    }
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.search-nav-bar {
    position: fixed;
    width: 322px;
@@ -223,9 +305,9 @@
                left: auto;
                bottom: 0;
                margin: auto;
                width: 14px;
                height: 14px;
                cursor: pointer;
                width: 16px;
                height: 16px;
                cursor: poiner;
            }
        }