liuyg
2022-03-05 3d6fe47da90e3335a16b093dccaadcfca9933520
src/components/map/components/campusBuildingSearch copy.vue
@@ -7,19 +7,10 @@
        v-model="searchInput"
        @input="searchValueChange"
        @focus="shortcutFlag = true"
      >
      </el-input>
            ></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">
        <ul>
@@ -27,9 +18,7 @@
            v-for="(item, index) in searchValList"
            :key="index"
            @click="loadPopup(item)"
          >
            {{ item.name }}
          </li>
                    >{{ item.name }}</li>
        </ul>
      </div>
      <div class="map-campus-shortcut" v-show="shortcutFlag">
@@ -37,7 +26,7 @@
          <ul>
            <li v-for="(item, index) in shortcutList" :key="index">
              <el-button @click="openModelPopup(item)">
                <img :src="item.bgimg" alt="" />
                                <img :src="item.bgimg" alt />
                <span>{{ item.title }}</span>
              </el-button>
            </li>
@@ -49,13 +38,13 @@
</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,
@@ -82,12 +71,12 @@
        //     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/dorm.png',
        //     title: '校区宿舍',
@@ -104,77 +93,77 @@
        // }
      ],
      shortcutFlag: false,
      searchInput: "",
            searchInput: '',
      searchValShow: false,
      searchValList: [],
    };
            searchValList: []
        }
  },
  computed: {
    ...mapGetters([
      "viewer",
            'viewer',
      // 校区内导航的显示关闭
      "campusNavFlag",
      "orgNavBarFlag",
      "arcNavBarFlag",
    ]),
            '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) => {
        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)
      }
    },
    openModelPopup(param) {
      var list = [];
      if (this.$route.path.indexOf("/service") != -1) {
        this.$store.dispatch("delVisitedViews", this.$route);
        this.$router.push("/pcLayout/default");
            var list = []
            if (this.$route.path.indexOf('/service') != -1) {
                this.$store.dispatch('delVisitedViews', this.$route)
                this.$router.push('/pcLayout/default')
      }
      if (param.type == "orgnav") {
        var path = this.$route.path;
        if (path.indexOf("/arc") != -1) {
          this.$store.dispatch("delVisitedViews", this.$route);
          this.$router.push("/pcLayout/default");
          this.$store.commit("SET_ARCNAVBARTITLE", "");
          this.$store.commit("SET_ARCNAVBARCODE", "");
          this.$store.commit("SET_ARCNAVBARFLAG", false);
            if (param.type == 'orgnav') {
                var path = this.$route.path
                if (path.indexOf('/arc') != -1) {
                    this.$store.dispatch('delVisitedViews', this.$route)
                    this.$router.push('/pcLayout/default')
                    this.$store.commit('SET_ARCNAVBARTITLE', '')
                    this.$store.commit('SET_ARCNAVBARCODE', '')
                    this.$store.commit('SET_ARCNAVBARFLAG', false)
        }
        if (this.arcNavBarFlag == true) {
          this.$store.commit("SET_ARCNAVBARTITLE", "");
          this.$store.commit("SET_ARCNAVBARCODE", "");
          this.$store.commit("SET_ARCNAVBARFLAG", false);
                    this.$store.commit('SET_ARCNAVBARTITLE', '')
                    this.$store.commit('SET_ARCNAVBARCODE', '')
                    this.$store.commit('SET_ARCNAVBARFLAG', false)
        }
        this.$store.commit("SET_ORGNAVBARTITLE", param.title);
        this.$store.commit("SET_ORGNAVBARLIST", []);
                this.$store.commit('SET_ORGNAVBARTITLE', param.title)
                this.$store.commit('SET_ORGNAVBARLIST', [])
        this.$store.commit("SET_ORGNAVBARFLAG", true);
                this.$store.commit('SET_ORGNAVBARFLAG', true)
        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,
@@ -186,93 +175,93 @@
              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") {
        if (this.$route.path.indexOf("/orgnav") != -1) {
          this.$store.dispatch("delVisitedViews", this.$route);
          this.$router.push("/pcLayout/default");
          this.$store.commit("SET_ORGNAVBARTITLE", "");
          this.$store.commit("SET_ORGNAVBARLIST", []);
          this.$store.commit("SET_ORGNAVBARFLAG", false);
                    this.$store.commit('SET_ORGNAVBARLIST', list)
                })
            } else if (param.type == 'arc') {
                if (this.$route.path.indexOf('/orgnav') != -1) {
                    this.$store.dispatch('delVisitedViews', this.$route)
                    this.$router.push('/pcLayout/default')
                    this.$store.commit('SET_ORGNAVBARTITLE', '')
                    this.$store.commit('SET_ORGNAVBARLIST', [])
                    this.$store.commit('SET_ORGNAVBARFLAG', false)
        }
        if (this.orgNavBarFlag == true) {
          this.$store.commit("SET_ORGNAVBARTITLE", "");
          this.$store.commit("SET_ORGNAVBARLIST", []);
          this.$store.commit("SET_ORGNAVBARFLAG", false);
                    this.$store.commit('SET_ORGNAVBARTITLE', '')
                    this.$store.commit('SET_ORGNAVBARLIST', [])
                    this.$store.commit('SET_ORGNAVBARFLAG', false)
        }
        this.$store.commit("SET_ARCNAVBARTITLE", param.title);
        this.$store.commit("SET_ARCNAVBARCODE", param.code);
        this.$store.commit("SET_ARCNAVBARFLAG", true);
                this.$store.commit('SET_ARCNAVBARTITLE', param.title)
                this.$store.commit('SET_ARCNAVBARCODE', param.code)
                this.$store.commit('SET_ARCNAVBARFLAG', true)
      }
    },
    shortcutShow(event) {
      var sp = document.getElementById("CampusSearchPanel");
            var sp = document.getElementById('CampusSearchPanel')
      if (sp) {
        if (!sp.contains(event.target)) {
          // 这句是说如果我们点击到了id为myPanel以外的区域
          this.shortcutFlag = false;
                    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 result = param.list;
            var result = param.list
      var imgArr = result.tpurl.split(",");
            var imgArr = result.tpurl.split(',')
      this.$store.commit("SET_POPUPBGURL", imgArr[0]);
      this.$store.commit("SET_POPUPQRURL", result.codeurl);
      this.$store.commit("SET_POINTPOSITION", [
            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_STATENAME", result.mechanismname);
      this.$store.commit("SET_SITENAME", result.address);
      this.$store.commit("SET_TELEPHONE", result.telephone);
      this.$store.commit("SET_INTRODUCETEXT", result.introduce);
      if (result.panoramaurl != "") {
        this.$store.commit("SET_PANORAMAURL", result.panoramaurl);
                Number(result.roll)
            ])
            this.$store.commit('SET_STATENAME', result.mechanismname)
            this.$store.commit('SET_SITENAME', result.address)
            this.$store.commit('SET_TELEPHONE', result.telephone)
            this.$store.commit('SET_INTRODUCETEXT', result.introduce)
            if (result.panoramaurl != '') {
                this.$store.commit('SET_PANORAMAURL', result.panoramaurl)
      }
      if (result.videourl && result.videourl != "") {
        this.$store.commit("SET_MONITORURL", result.videourl);
            if (result.videourl && result.videourl != '') {
                this.$store.commit('SET_MONITORURL', result.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(result);
            this.newPopup(result)
      this.viewer.flyToPosition(
        new this.DC.Position(
          Number(result.jd),
@@ -284,25 +273,25 @@
        ),
        () => {},
        3
      );
            )
    },
    newPopup(item) {
      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>