src/components/map/components/campusBuildingSearch.vue
@@ -3,13 +3,17 @@
        <div class="map-campus-search" id="CampusSearchPanel">
            <el-input
                class="search-input"
                placeholder="社区搜索…"
        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
          @click="navigationShow"
          class="deblurring"
          icon="el-icon-my-path"
        ></el-button>
                <el-button
                    @click="fuzzyQuery"
                    class="deblurring"
@@ -23,7 +27,9 @@
                        v-for="(item, index) in searchValList"
                        :key="index"
                        @click="loadPopup(item)"
                    >{{item.mechanismname}}</li>
          >
            {{ item.mechanismname }}
          </li>
                </ul>
            </div>
            <div class="map-campus-shortcut" v-show="shortcutFlag">
@@ -43,24 +49,23 @@
</template>
<script>
import { mapGetters } from "vuex";
import { mapGetters } from 'vuex'
import { getList } from '@/api/pc/orgnav/index'
import { getSearchList } from '@/api/pc/public/search'
import { getList } from "@/api/pc/orgnav/index";
import { getSearchList } from "@/api/pc/public/search";
export default {
    name: 'campusBuildingSearch',
  name: "campusBuildingSearch",
    data () {
        return {
            DC: null,
            shortcutList: [
                {
                    bgimg: '/img/search/org.png',
                    title: '其他机构',
                    type: 'orgnav',
                    path: '/pcLayout/default/orgnav/rest',
                    code: 5
          bgimg: "/img/search/org.png",
          title: "其他机构",
          type: "orgnav",
          path: "/pcLayout/default/orgnav/rest",
          code: 5,
                },
                // {
                //     bgimg: '/img/search/ofc.png',
@@ -77,26 +82,27 @@
                //     code: 2
                // },
                {
                    bgimg: '/img/search/venue.png',
                    title: '社区场馆',
                    type: 'arc',
                    path: '/pcLayout/default/arc/venue',
                    code: 3
          bgimg: "/img/search/venue.png",
          title: "校区场馆",
          type: "arc",
          path: "/pcLayout/default/arc/venue",
          code: 3,
                },
                {
                    bgimg: '/img/search/floor.png',
                    title: '主要场馆',
                    type: 'arc',
                    path: '/pcLayout/default/arc/rest',
                    code: 7
                }
          bgimg: "/img/search/floor.png",
          title: "主要场馆",
          type: "arc",
          path: "/pcLayout/default/arc/rest",
          code: 7,
        },
                // {
                //     bgimg: '/img/search/dorm.png',
                //     title: '社区宿舍',
                //     type: 'arc',
                //     path: '/pcLayout/default/arc/dorm',
                //     code: 4
        //   bgimg: "/img/search/dorm.png",
        //   title: "校区宿舍",
        //   type: "arc",
        //   path: "/pcLayout/default/arc/dorm",
        //   code: 4,
                // },
                // {
                //     bgimg: '/img/search/scenery.png',
                //     title: '文化风景',
@@ -106,80 +112,80 @@
                // }
            ],
            shortcutFlag: false,
            searchInput: '',
      searchInput: "",
            searchValShow: false,
            searchValList: []
        }
      searchValList: [],
    };
    },
    computed: {
        ...mapGetters([
            'viewer',
            // 社区内导航的显示关闭
            'campusNavFlag',
            'orgNavBarFlag',
            'arcNavBarFlag'
        ])
      "viewer",
      // 校区内导航的显示关闭
      "campusNavFlag",
      "orgNavBarFlag",
      "arcNavBarFlag",
    ]),
    },
    created () {
        this.DC = global.DC
    this.DC = global.DC;
    },
    methods: {
        searchValueChange () {
            if (this.searchInput == '') {
                this.searchValList = []
                this.searchValShow = false
                return
      if (this.searchInput == "") {
        this.searchValList = [];
        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
          this.searchValList = res.data.data;
          this.searchValShow = true;
                }
            })
      });
        },
        navigationShow () {
            if (this.campusNavFlag == false) {
                this.$store.commit('SET_CAMPUSNAVFLAG', true)
        this.$store.commit("SET_CAMPUSNAVFLAG", true);
            }
        },
        fuzzyQuery () {
            if (this.searchInput == '') {
                this.searchValList = []
                this.searchValShow = false
      if (this.searchInput == "") {
        this.searchValList = [];
        this.searchValShow = false;
                this.$message({
                    message: '请输入关键字',
                    type: 'warning',
                    duration: 1000
                })
                return
          message: "请输入关键字",
          type: "warning",
          duration: 1000,
        });
        return;
            }
            getSearchList({ mechanismName: this.searchInput }).then(res => {
      getSearchList({ mechanismName: this.searchInput }).then((res) => {
                if (res.data.data.length > 0) {
                    this.$store.commit('SET_SEARCHPOPUPFLAG', true)
                    this.$store.commit('SET_SEARCHPOPUPLIST', res.data.data)
                    this.searchInput = ''
                    this.searchValList = []
                    this.searchValShow = false
          this.$store.commit("SET_SEARCHPOPUPFLAG", true);
          this.$store.commit("SET_SEARCHPOPUPLIST", res.data.data);
          this.searchInput = "";
          this.searchValList = [];
          this.searchValShow = false;
                }
            })
      });
        },
        openModelPopup (param) {
            var list = []
      var list = [];
            if (param.type == 'orgnav') {
                this.$store.commit('SET_ORGNAVBARTITLE', param.title)
                this.$store.commit('SET_ORGNAVBARLIST', [])
                this.$store.commit('SET_ORGNAVBARFLAG', true)
      if (param.type == "orgnav") {
        this.$store.commit("SET_ORGNAVBARTITLE", param.title);
        this.$store.commit("SET_ORGNAVBARLIST", []);
        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',
              icon: "/img/navicon/tag.png",
                            longitude: item.jd,
                            latitude: item.wd,
                            alt: item.gd,
@@ -191,100 +197,112 @@
                            address: item.address,
                            telephone: item.telephone,
                            introduce: item.introduce,
                            videourl: item.videourl
                        })
                    })
              videourl: item.videourl,
            });
          });
                    this.$store.commit('SET_ORGNAVBARLIST', list)
                })
            } else if (param.type == 'arc') {
                this.$store.commit('SET_ARCNAVBARTITLE', param.title)
                this.$store.commit('SET_ARCNAVBARCODE', param.code)
                this.$store.commit('SET_ARCNAVBARFLAG', true)
          this.$store.commit("SET_ORGNAVBARLIST", list);
        });
      } else if (param.type == "arc") {
        this.$store.commit("SET_ARCNAVBARTITLE", param.title);
        this.$store.commit("SET_ARCNAVBARCODE", param.code);
        this.$store.commit("SET_ARCNAVBARFLAG", true);
            }
            this.$router.push(param.path)
      this.$router.push(param.path);
        },
        shortcutShow (event) {
            var sp = document.getElementById('CampusSearchPanel')
      var sp = document.getElementById("CampusSearchPanel");
            if (sp) {
                if (!sp.contains(event.target)) { // 这句是说如果我们点击到了id为myPanel以外的区域
                    this.shortcutFlag = false
        if (!sp.contains(event.target)) {
          // 这句是说如果我们点击到了id为myPanel以外的区域
          this.shortcutFlag = false;
                }
            }
        },
        loadPopup (param) {
            var that = this
      var that = this;
            that.searchInput = ''
            that.searchValList = []
            that.searchValShow = false
      that.searchInput = "";
      that.searchValList = [];
      that.searchValShow = false;
            this.$store.commit('CLEAR_ALL', null)
      this.$store.commit("CLEAR_ALL", null);
            var imgArr = param.tpurl.split(',')
      var imgArr = param.tpurl.split(",");
            this.$store.commit('SET_POPUPBGURL', imgArr[0])
            this.$store.commit('SET_POPUPQRURL', param.codeurl)
            this.$store.commit('SET_POINTPOSITION', [Number(param.jd), Number(param.wd), Number(param.gd), Number(param.heading), Number(param.pitch), Number(param.roll)])
            this.$store.commit('SET_STATENAME', param.mechanismname)
            this.$store.commit('SET_SITENAME', param.address)
            this.$store.commit('SET_TELEPHONE', param.telephone)
            this.$store.commit('SET_INTRODUCETEXT', param.introduce)
            if (param.panoramaurl != '') {
                this.$store.commit('SET_PANORAMAURL', param.panoramaurl)
      this.$store.commit("SET_POPUPBGURL", imgArr[0]);
      this.$store.commit("SET_POPUPQRURL", param.codeurl);
      this.$store.commit("SET_POINTPOSITION", [
        Number(param.jd),
        Number(param.wd),
        Number(param.gd),
        Number(param.heading),
        Number(param.pitch),
        Number(param.roll),
      ]);
      this.$store.commit("SET_STATENAME", param.mechanismname);
      this.$store.commit("SET_SITENAME", param.address);
      this.$store.commit("SET_TELEPHONE", param.telephone);
      this.$store.commit("SET_INTRODUCETEXT", param.introduce);
      if (param.panoramaurl != "") {
        this.$store.commit("SET_PANORAMAURL", param.panoramaurl);
            }
            if (param.videourl && param.videourl != '') {
                this.$store.commit('SET_MONITORURL', param.videourl)
      if (param.videourl && param.videourl != "") {
        this.$store.commit("SET_MONITORURL", param.videourl);
            }
            this.$store.commit('SET_POPUPIMGATLAS', imgArr)
            if (param.jx != undefined && param.jx != '') {
                var tabOne = param.jx.split(',')
                this.$store.commit('SET_TEACHLIST', tabOne)
      this.$store.commit("SET_POPUPIMGATLAS", imgArr);
      if (param.jx != undefined && param.jx != "") {
        var tabOne = param.jx.split(",");
        this.$store.commit("SET_TEACHLIST", tabOne);
            } else {
                this.$store.commit('SET_TEACHLIST', [])
        this.$store.commit("SET_TEACHLIST", []);
            }
            if (param.sh != undefined && param.sh != '') {
                var tabTwo = param.sh.split(',')
                this.$store.commit('SET_LIVELIST', tabTwo)
      if (param.sh != undefined && param.sh != "") {
        var tabTwo = param.sh.split(",");
        this.$store.commit("SET_LIVELIST", tabTwo);
            } else {
                this.$store.commit('SET_LIVELIST', [])
        this.$store.commit("SET_LIVELIST", []);
            }
            this.newPopup(param)
      this.newPopup(param);
            this.viewer.flyToPosition(
                new this.DC.Position(Number(param.jd), Number(param.wd), 300, Number(param.heading), Number(param.pitch), Number(param.roll)),
                () => {
                },
        new this.DC.Position(
          Number(param.jd),
          Number(param.wd),
          300,
          Number(param.heading),
          Number(param.pitch),
          Number(param.roll)
        ),
        () => {},
                0.5
            )
      );
        },
        newPopup (item) {
            const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd)))
      const position = this.DC.Transform.transformWGS84ToCartesian(
        new this.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, {
                domId: 'divFormsDomBox',
                position: [
                    position
                ]
            })
        domId: "divFormsDomBox",
        position: [position],
      });
            this.$store.commit('SET_PANORAMAPOPUP', false)
            this.$store.commit('SET_MONITORPOPUP', false)
            this.$store.commit('SET_DETAILSPOPUP', true)
        }
    }
}
      this.$store.commit("SET_PANORAMAPOPUP", false);
      this.$store.commit("SET_MONITORPOPUP", false);
      this.$store.commit("SET_DETAILSPOPUP", true);
    },
  },
};
</script>
<style lang='scss' scope>
<style lang="scss" scope>
.map-campus-search {
    position: fixed;
    top: 100px;
@@ -376,16 +394,18 @@
    .map-campus-shortcut {
        margin-top: 20px;
        width: 100%;
        height: 330px;
    // height: 330px;
    height: auto;
        background: #fff;
        border-radius: 5px;
        .shortcut-box {
            padding-top: 36px;
      height: auto;
            ul {
                display: flex;
                width: 100%;
                height: 120px;
        height: auto;
                justify-content: flex-start;
                flex-wrap: wrap;