liuyg
2021-12-15 ae038d50b068a02c4fe53725095dc952bf75b797
src/components/arcNavBar/index.vue
@@ -21,12 +21,16 @@
            <div class="content">
                <div class="tab">
                    <ul>
                        <li :class="{'on': item.flag}" v-for="(item, index) in navList" :key="index" @click="topNavClick(index)">{{ item.title }}</li>
                        <li :class="{'on': item.flag}"
                            v-for="(item, index) in titleList"
                            :key="index"
                            @click="topNavClick(item, index)">{{ item.title }}</li>
                    </ul>
                </div>
                <ul>
                    <li v-for="(item, index) in itemNavList"
                        :key="index">
                        :key="index"
                        @click="mapPopup(item)">
                        <img :src="item.icon"
                             alt="">
                        <span>
@@ -40,24 +44,50 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { getList, getChildNavList, getChildNavDetail } from '@/api/pc/public/arc'
export default {
    name: 'ArcNavBar',
    data () {
        return {
            moveFlag: false,
            itemNavList: []
            itemNavList: [],
            DC: null
        }
    },
    props: {
        navList: {
            type: Array
        },
        title: {
            type: String
        },
        arcCode: {
            type: Number
        }
    },
    computed: {
        ...mapGetters([
            'viewer',
            'popupBgUrl',
            'pupupQRUrl',
            // 点信息
            'pointPosition',
            // 点名称
            'stateName'
        ])
    },
    created () {
        this.DC = global.DC
        this.titleList = []
        getList().then(res => {
            res.data.data.forEach(item => {
                this.titleList.push({ title: item.dictValue, flag: false, key: item.dictKey })
            })
            this.titleList[0].flag = true
            this.getChilsNavs(this.titleList[0].key)
        })
    },
    mounted () {
        this.itemNavList = this.navList[0].list
    },
    methods: {
        move (e) {
@@ -109,14 +139,59 @@
        closeModel () {
            this.$parent.closeModel()
        },
        topNavClick (index) {
            this.navList.forEach(item => {
        topNavClick (item, index) {
            this.titleList.forEach(item => {
                item.flag = false
            })
            this.navList[index].flag = true
            this.titleList[index].flag = true
            this.itemNavList = this.navList[index].list
            this.getChilsNavs(item.key)
        },
        getChilsNavs (campus) {
            this.itemNavList = []
            getChildNavList({ campus: campus, type: this.arcCode }).then(res => {
                res.data.data.forEach(item => {
                    this.itemNavList.push({
                        navTitle: item.mechanismName,
                        icon: '/img/navicon/tag.png',
                        id: item.id
                    })
                })
            })
        },
        mapPopup (param) {
            getChildNavDetail({ id: param.id }).then(res => {
                var result = res.data.data[0].list
                this.$store.commit('SET_POPUPBGURL', result.tpUrl)
                this.$store.commit('SET_POPUPQRURL', result.codeUrl)
                this.$store.commit('SET_POINTPOSITION', [result.jd, result.wd, result.gd, result.heading, result.pitch, result.roll])
                this.$store.commit('SET_STATENAME', result.mechanismName)
                var that = this
                // item.alt, item.heading, item.pitch, item.roll
                this.viewer.zoomToPosition(
                    new this.DC.Position(result.jd, result.wd, result.gd, result.heading, result.pitch, result.roll),
                    function () {
                        that.newPopup(result)
                    }
                )
                // res.data.data[0].jx
            })
        },
        newPopup (item) {
            const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(item.jd, item.wd, item.gd, item.heading, item.pitch, item.roll))
            // eslint-disable-next-line new-cap
            var popup = new this.DC.divForms(this.viewer, {
                domId: 'div1',
                title: item.mechanismName,
                className: 'divForms-dom',
                content: document.getElementById('mapChildContent'),
                position: [
                    position
                ]
            })
        }
    }
}
@@ -177,7 +252,7 @@
            text-align: center;
            overflow-y: auto;
            background: url(/img/bg/nav-bg.jpeg) no-repeat;
            background-size:  100% 100%;
            background-size: 100% 100%;
            .tab {
                height: 42px;
                border-bottom: 1px solid #ccc;