From d805339695bf1d25a333977445e1821508654d13 Mon Sep 17 00:00:00 2001 From: TreeWish <1131093754@qq.com> Date: 星期二, 28 二月 2023 10:09:30 +0800 Subject: [PATCH] 解决分屏切换2D显示不全 --- src/views/Synthesis/index.vue | 105 ++++++++++++++++++++++++---------------------------- 1 files changed, 48 insertions(+), 57 deletions(-) diff --git a/src/views/Synthesis/index.vue b/src/views/Synthesis/index.vue index 48f7ff9..336a6b5 100644 --- a/src/views/Synthesis/index.vue +++ b/src/views/Synthesis/index.vue @@ -11,15 +11,8 @@ class="MenuIcon" :class="{ lefMenuActive: showMenuFlag == item.id }" > - <div - class="menuDiv" - :title="item.name" - @click="setMenuChange(item)" - > - <div - class="menuImage" - :class="item.class" - ></div> + <div class="menuDiv" :title="item.name" @click="setMenuChange(item)"> + <div class="menuImage" :class="item.class"></div> </div> </div> <div @@ -31,18 +24,12 @@ :title="menuItem.name" @click="setMenuChange(menuItem)" > - <div - class="menuImage" - :class="menuItem.class" - ></div> + <div class="menuImage" :class="menuItem.class"></div> </div> </div> </div> <div class="rightContent"> - <div - class="left_main" - :class="{ left_main_show: !openStatus }" - > + <div class="left_main" :class="{ left_main_show: !openStatus }"> <div class="right_Map"> <left-menu></left-menu> </div> @@ -58,10 +45,10 @@ </template> <script> -import { getPerms } from "../../api/api"; -import mapdiv from "../../components/MapDiv.vue"; -import leftMenu from "./LeftMenu.vue"; -import maplayer from "../Tools/maplayer.vue"; +import { getPerms } from "../../api/api" +import mapdiv from "../../components/MapDiv.vue" +import leftMenu from "./LeftMenu.vue" +import maplayer from "../Tools/maplayer.vue" export default { components: { mapdiv, @@ -143,7 +130,7 @@ class: "menu_img1", show: true, }, - }; + } }, watch: {}, @@ -151,28 +138,32 @@ //宸︿晶鑿滃崟婊戝姩鏄鹃殣 setMenuChange(res) { if (res.id == this.showMenuFlag) { - return; + return } //娓呴櫎鏌ヨ寮圭獥 - this.$store.state.mapMenuBoolean = false; - this.$store.state.mapMenuBoxFlag = ""; + this.$store.state.mapMenuBoolean = false + this.$store.state.mapMenuBoxFlag = "" //娓呴櫎鍒嗘瀽妯″潡鐨勫叏灞�鍙橀噺 - ClearAlayse(); + ClearAlayse() switch (res.id) { case 1: - if (this.showMenuFlag == null) return; - this.openStatus = !this.openStatus; - break; + if (this.showMenuFlag == null) return + this.openStatus = !this.openStatus + // 鐐瑰嚮宸︿晶鑿滃崟鏄皟鏁� + setTimeout(() => { + window.map.updateSize() + }, 1000) + break case 10: if (this.showMenuFlag == null) { - this.openStatus = false; + this.openStatus = false } - this.$bus.$emit("setChangeTwoMenu", res.id - 2); - break; + this.$bus.$emit("setChangeTwoMenu", res.id - 2) + break default: { - this.openStatus = true; - this.$bus.$emit("setChangeTwoMenu", res.id - 2); - this.showMenuFlag = res.id; + this.openStatus = true + this.$bus.$emit("setChangeTwoMenu", res.id - 2) + this.showMenuFlag = res.id } } }, @@ -182,63 +173,63 @@ this.$store.state.currentPerms == "" || this.$store.state.currentPerms != "/comprehensive" ) { - this.$store.state.currentPerms = "/comprehensive"; + this.$store.state.currentPerms = "/comprehensive" } if (this.$store.state.permsEntity.length == 0) { - const data = await getPerms(); - this.$store.state.permsEntity = data.result; + const data = await getPerms() + this.$store.state.permsEntity = data.result } - var val = this.$store.state.currentPerms; - var permsEntity = this.$store.state.permsEntity; + var val = this.$store.state.currentPerms + var permsEntity = this.$store.state.permsEntity for (var i = 0; i < permsEntity.length; i++) { if (permsEntity[i].perms == val) { - this.showMenuChange(permsEntity[i], permsEntity); + this.showMenuChange(permsEntity[i], permsEntity) } } for (var i in this.menuOption) { if (this.menuOption[i].show != false) { - this.showMenuList.push(this.menuOption[i]); + this.showMenuList.push(this.menuOption[i]) } } //鍒濆鍖栦簩绾ц彍鍗� if (this.showMenuList.length > 1) { - var index = this.showMenuList[1].id; - this.$bus.$emit("setChangeTwoMenu", index - 2); + var index = this.showMenuList[1].id + this.$bus.$emit("setChangeTwoMenu", index - 2) } }, showMenuChange(res, result) { - var permsId = res.id; - this.$store.state.syntiesis.menu = res.id; + var permsId = res.id + this.$store.state.syntiesis.menu = res.id for (var i = 0; i < result.length; i++) { if (result[i].pid == permsId) { - this.showMenuStatus(result[i]); + this.showMenuStatus(result[i]) } } }, showMenuStatus(res) { - var std = []; - std.push(this.menuOption[0]); + var std = [] + std.push(this.menuOption[0]) for (var i = 1; i < this.menuOption.length; i++) { if (this.menuOption[i].name == res.cnName) { - this.menuOption[i].show = true; + this.menuOption[i].show = true } } }, }, mounted() { // this.$bus.$emit('showLeftMenu', true); - window.sgworld.navControl("nav", true); - this.$store.state.mapMenuBoolean = false; - this.$store.state.mapMenuBoxFlag = null; - this.$store.state.mapPopBoolean = false; - this.$store.state.mapPopBoxFlag = null; + window.sgworld.navControl("nav", true) + this.$store.state.mapMenuBoolean = false + this.$store.state.mapMenuBoxFlag = null + this.$store.state.mapPopBoolean = false + this.$store.state.mapPopBoxFlag = null }, //鍒濆鍖栬彍鍗曟巿鏉� created() { - this.getPermsMenu(); + this.getPermsMenu() }, -}; +} </script> <style lang="less" scoped> -- Gitblit v1.9.3