瀏覽代碼

bus2修改

yx 4 年之前
父節點
當前提交
1f8e2d6d7f

+ 7 - 7
src/components/baseEditer.vue

@@ -138,7 +138,7 @@ export default {
                     t.endAnchor = endAnc || null
                 }
             })
-            bus.$emit('elementDataChange', this.scene)
+            bus2.$emit('elementDataChange', this.scene)
         },
         /**
          * 本地上传万抽后,读取json进行处理
@@ -239,7 +239,7 @@ export default {
                 this.scene.setBackgroundImgItem(url)
                 this.view.fitSceneToView()
             }
-            bus.$emit('elementDataChange', this.scene)
+            bus2.$emit('elementDataChange', this.scene)
         },
         // 不适用平面图逻辑(调用蜂鸟接口,加载底图)
         init1() {
@@ -309,7 +309,7 @@ export default {
                         console.log('success')
                         // 设置初始化缩放比例
                         this.initScale = this.view.scale
-                        bus.$emit('initScale', this.view.scale)
+                        bus2.$emit('initScale', this.view.scale)
                     })
                 } else {
                     console.log('楼层不正确')
@@ -393,7 +393,7 @@ export default {
                         }
                     })
                     this.view.fitSceneToView()
-                    bus.$emit('elementDataChange', this.scene)
+                    bus2.$emit('elementDataChange', this.scene)
                 }
             })
         },
@@ -406,7 +406,7 @@ export default {
         },
         // 监听场景元素数据变化
         scenceUpdate(scence) {
-            bus.$emit('elementDataChange', scence)
+            bus2.$emit('elementDataChange', scence)
         },
         clearGraphy() {
             if (this.view) {
@@ -588,7 +588,7 @@ export default {
                         address: '提取',
                     })
                 }
-                bus.$emit('exportItem', data)
+                bus2.$emit('exportItem', data)
             })
             bus.$on('saveMsgItem', () => {
                 const Elements = this.scene.saveMsgItem()
@@ -830,7 +830,7 @@ export default {
             handler(scale) {
                 // 滚轮触发的缩放
                 if (!this.changeScaleByClick) {
-                    bus.$emit('mouseScale', scale / this.initScale)
+                    bus2.$emit('mouseScale', scale / this.initScale)
                 }
             },
         },

+ 3 - 1
src/components/edit/left_toolbar.vue

@@ -119,6 +119,7 @@
 import itemTree from "./leftbar_components/itemTree";
 import { graphElementGroup } from "@/api/editer.js";
 import bus from "@/bus";
+import bus2 from "@/bus2";
 import { queryGroup } from "@/api/editer.js";
 import { mapState, mapActions } from "vuex";
 const columns = [
@@ -375,7 +376,8 @@ export default {
             bus.$emit("extractItem");
         },
         getBus() {
-            bus.$on("exportItem", data => {
+            bus2.$off('exportItem');
+            bus2.$on("exportItem", data => {
                 this.data = data.map(t => {
                     (t.name = this.TypeIdToGraphElement[t.key].Name), (t.properties = this.TypeIdToGraphElement[t.key]);
                     return t;

+ 3 - 1
src/components/edit/right_toolbar.vue

@@ -42,6 +42,7 @@
 import attrSelect from "@/components/edit/attr_select";
 import equipmentAttr from './equipmentAttr.vue'
 import bus from "@/bus";
+import bus2 from "@/bus2";
 import { SImageMarkerItem } from "../../lib/items/SImageMarkerItem";
 import { SImageLegendItem } from "../../lib/items/SImageLegendItem";
 import { SEquipmentItem } from "../../lib/items/SEquipmentItem";
@@ -108,7 +109,8 @@ export default {
     methods: {
         // 获取元素数据
         listenElementData() {
-            bus.$on("elementDataChange", val => {
+            bus2.$off('elementDataChange')
+            bus2.$on("elementDataChange", val => {
                 this.elementData = [];
                 console.log(val);
                 if (val.Nodes.length) {

+ 4 - 1
src/components/edit/top_toolbar.vue

@@ -260,6 +260,7 @@ export default {
          * @description 获取底图加载完成后的,初始化的缩放比例initScale,设置为baseScale
          */
         getInitScale() {
+            bus2.$off('initScale')
             bus.$on("initScale", baseScale => {
                 this.baseScale = Number(baseScale || 1);
             });
@@ -270,7 +271,8 @@ export default {
          */
         getMouseScale() {
             //  zoom 为缩放后改变的比例
-            bus.$on("mouseScale", zoom => {
+            bus2.$off("mouseScale")
+            bus2.$on("mouseScale", zoom => {
                 this.scale = Number((zoom * this.initScale).toFixed(2));
             });
         },
@@ -352,6 +354,7 @@ export default {
     },
     async mounted() {
         console.log('dsafadsfasdfas')
+        bus2.$off("FocusItemChanged")
         bus2.$on("FocusItemChanged", itemMsg => {
             console.log("itemMsg", itemMsg);
             this.FocusItemChanged(itemMsg);