1
mayisheng
2022-08-15 81f54040c2cb65537c6c6e1db8358a39a57dea0d
src/components/map/components/campusBuildingSearch copy.vue
@@ -1,41 +1,33 @@
<template>
    <div>
        <div class="map-campus-search"
             id="CampusSearchPanel">
            <el-input class="search-input"
                      placeholder="社区搜索…"
                      v-model="searchInput"
                      @input="searchValueChange"
                      @focus="shortcutFlag = true">
            </el-input>
        <div class="map-campus-search" id="CampusSearchPanel">
            <el-input
                class="search-input"
                placeholder="校区搜索…"
                v-model="searchInput"
                @input="searchValueChange"
                @focus="shortcutFlag = true"
            ></el-input>
            <el-button-group>
                <el-button @click="navigationShow"
                           class="deblurring"
                           icon="el-icon-my-path"></el-button>
                <el-button class="deblurring"
                           type="primary"
                           icon="el-icon-my-search"></el-button>
                <el-button @click="navigationShow" class="deblurring" icon="el-icon-my-path"></el-button>
                <el-button class="deblurring" type="primary" icon="el-icon-my-search"></el-button>
            </el-button-group>
            <div v-show="searchValShow"
                 class="search-value-box">
            <div v-show="searchValShow" class="search-value-box">
                <ul>
                    <li v-for="(item, index) in searchValList"
                    <li
                        v-for="(item, index) in searchValList"
                        :key="index"
                        @click="loadPopup(item)">
                        {{item.name}}
                    </li>
                        @click="loadPopup(item)"
                    >{{ item.name }}</li>
                </ul>
            </div>
            <div class="map-campus-shortcut"
                 v-show="shortcutFlag">
            <div class="map-campus-shortcut" v-show="shortcutFlag">
                <div class="shortcut-box">
                    <ul>
                        <li v-for="(item, index) in shortcutList"
                            :key="index">
                        <li v-for="(item, index) in shortcutList" :key="index">
                            <el-button @click="openModelPopup(item)">
                                <img :src="item.bgimg"
                                     alt="">
                                <span>{{item.title}}</span>
                                <img :src="item.bgimg" alt />
                                <span>{{ item.title }}</span>
                            </el-button>
                        </li>
                    </ul>
@@ -46,7 +38,6 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { getList } from '@/api/pc/orgnav/index'
@@ -56,11 +47,10 @@
    name: 'campusBuildingSearch',
    data () {
        return {
            DC: null,
            shortcutList: [
                // {
                //     bgimg: '/img/search/org.png',
                //     title: '党群机构',
                //     title: '党政机构',
                //     type: 'orgnav',
                //     path: '/pcLayout/default/orgnav/masses',
                //     code: 1
@@ -81,14 +71,14 @@
                // },
                {
                    bgimg: '/img/search/venue.png',
                    title: '社区场馆',
                    title: '校区场馆',
                    type: 'arc',
                    path: '/pcLayout/default/arc/venue',
                    code: 3
                }
                // {
                //     bgimg: '/img/search/dorm.png',
                //     title: '社区宿舍',
                //     title: '校区宿舍',
                //     type: 'arc',
                //     path: '/pcLayout/default/arc/dorm',
                //     code: 4
@@ -109,15 +99,13 @@
    },
    computed: {
        ...mapGetters([
            'viewer',
            // 社区内导航的显示关闭
            // 校区内导航的显示关闭
            'campusNavFlag',
            'orgNavBarFlag',
            'arcNavBarFlag'
        ])
    },
    created () {
        this.DC = global.DC
    },
    methods: {
        searchValueChange () {
@@ -126,7 +114,7 @@
                this.searchValShow = false
                return
            }
            getSearchList({ mechanismName: this.searchInput }).then(res => {
            getSearchList({ mechanismName: this.searchInput }).then((res) => {
                if (res.data.data.length > 0) {
                    this.searchValList = res.data.data
                    this.searchValShow = true
@@ -168,8 +156,8 @@
                this.$store.commit('SET_ORGNAVBARFLAG', true)
                getList({ type: param.code }).then(res => {
                    res.data.data.records.forEach(item => {
                getList({ type: param.code }).then((res) => {
                    res.data.data.records.forEach((item) => {
                        list.push({
                            navTitle: item.mechanismname,
                            icon: '/img/navicon/tag.png',
@@ -215,7 +203,8 @@
            var sp = document.getElementById('CampusSearchPanel')
            if (sp) {
                if (!sp.contains(event.target)) { // 这句是说如果我们点击到了id为myPanel以外的区域
                if (!sp.contains(event.target)) {
                    // 这句是说如果我们点击到了id为myPanel以外的区域
                    this.shortcutFlag = false
                }
            }
@@ -236,7 +225,14 @@
            this.$store.commit('SET_POPUPBGURL', imgArr[0])
            this.$store.commit('SET_POPUPQRURL', result.codeurl)
            this.$store.commit('SET_POINTPOSITION', [Number(result.jd), Number(result.wd), Number(result.gd), Number(result.heading), Number(result.pitch), Number(result.roll)])
            this.$store.commit('SET_POINTPOSITION', [
                Number(result.jd),
                Number(result.wd),
                Number(result.gd),
                Number(result.heading),
                Number(result.pitch),
                Number(result.roll)
            ])
            this.$store.commit('SET_STATENAME', result.mechanismname)
            this.$store.commit('SET_SITENAME', result.address)
            this.$store.commit('SET_TELEPHONE', result.telephone)
@@ -263,23 +259,28 @@
            }
            this.newPopup(result)
            this.viewer.flyToPosition(
                new this.DC.Position(Number(result.jd), Number(result.wd), 300, Number(result.heading), Number(result.pitch), Number(result.roll)),
                () => {
                },
            global.viewer.flyToPosition(
                new global.DC.Position(
                    Number(result.jd),
                    Number(result.wd),
                    300,
                    Number(result.heading),
                    Number(result.pitch),
                    Number(result.roll)
                ),
                () => { },
                3
            )
        },
        newPopup (item) {
            const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd)))
            const position = global.DC.Transform.transformWGS84ToCartesian(
                new global.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
            )
            // 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)
@@ -287,11 +288,10 @@
            this.$store.commit('SET_DETAILSPOPUP', true)
        }
    }
}
</script>
<style lang='scss' scope>
<style lang="scss" scope>
.map-campus-search {
    position: fixed;
    top: 100px;