Browse Source

提取bug

YaolongHan 4 years ago
parent
commit
a81c9ad40f

+ 3 - 0
src/bus2.js

@@ -0,0 +1,3 @@
+import Vue from 'vue'
+const bus2 = new Vue()
+export default bus2

+ 25 - 29
src/components/baseEditer.vue

@@ -13,6 +13,7 @@ import { SFloorParser } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
+import bus2 from "@/bus2";
 import {
   saveGroup,
   readGroup,
@@ -296,20 +297,20 @@ export default {
         this.initScale = this.view.scale;
         this.view.maxScale = this.initScale * 10;
         this.view.minScale = this.initScale / 10;
-        bus.$emit("initScale", this.view.scale);
-        bus.$emit("elementDataChange", this.scene);
-        this.loadings.close();
+        bus2.$emit("initScale", this.view.scale);
+        bus2.$emit("elementDataChange", this.scene);
+        this.loadings.close()
       });
     },
     // 监听变化
     emitChange(itemMsg) {
       this.chiceItemList = itemMsg.itemList;
       this.$emit("changeFocusItem", itemMsg);
-      bus.$emit("FocusItemChanged", itemMsg);
+      bus2.$emit("FocusItemChanged", itemMsg);
     },
     // 监听场景元素数据变化
     scenceUpdate(scence) {
-      bus.$emit("elementDataChange", scence);
+      bus2.$emit("elementDataChange", scence);
     },
     clearGraphy() {
       if (this.view) {
@@ -391,7 +392,7 @@ export default {
             address: "提取"
           });
         }
-        bus.$emit("exportItem", data);
+        bus2.$emit("exportItem", data);
       });
       bus.$on("saveMsgItem", () => {
         const loading = Message({
@@ -427,26 +428,21 @@ export default {
                     Size: { Width: 0, Height: 0 }, // 大小
                     Type: val.age.Type,
                     Properties: {
-                      IconUrl:
-                        "/serve/topology-wanda/Picture/query/" + val.age.Url,
-                      Url: "/serve/topology-wanda/Picture/query/" + val.age.Url,
-                      Num: 1, // 此num与信息工程化得num无关
-                      sWidth: 32, //icon 的宽
-                      sHeight: 32, //icon 的高
-                      font: 14, //font
-                      color: "#1F2429", //字体颜色
-                      GraphCategoryId: val.age.GraphCategoryId,
-                      InfoSystemId: val.age.InfoSystemId
-                        ? val.age.InfoSystemId
-                        : "", //信息工程话分类ID分类
-                      FID: t.data.SourceId,
-                      InfoTypeId: val.age.InfoTypeId.length
-                        ? val.age.InfoTypeId
-                        : [],
-                      InfoLocal: val.age.InfoLocal.length
-                        ? val.age.InfoLocal
-                        : []
-                    }
+                        IconUrl: '/serve/topology-wanda/Picture/query/' + val.age.Url,
+                        Url: '/serve/topology-wanda/Picture/query/' + val.age.Url,
+                        Num: 1, // 此num与信息工程化得num无关
+                        Size: {
+                          Width: val.age.Size?val.age.Size.Width?val.age.Size.Width:32:32,  //icon 的宽
+                          Height: val.age.Size?val.age.Size.Height?val.age.Size.Height:32:32,   //icon 的高
+                        },
+                        font: 14,    //font
+                        color: "#1F2429",  //字体颜色
+                        GraphCategoryId: val.age.GraphCategoryId,
+                        InfoSystemId: val.age.InfoSystemId?val.age.InfoSystemId:'',   //信息工程话分类ID分类
+                        FID: t.data.SourceId,
+                        InfoTypeId:val.age.InfoTypeId.length? val.age.InfoTypeId :[],
+                        InfoLocal:val.age.InfoLocal.length ?val.age.InfoLocal :[]
+                    },
                   };
                   const item = new SImageLegendItem(null, data);
                   item.selectable = true;
@@ -459,7 +455,7 @@ export default {
             })
             .filter(item => item);
           this.scene.AddListCommand(list);
-          bus.$emit("elementDataChange", this.scene);
+          bus2.$emit("elementDataChange", this.scene);
         } else if (val.type == "Zone") {
           const list = this.fParser.spaceList
             .map(t => {
@@ -510,7 +506,7 @@ export default {
           });
           // undo/redo事件
           this.scene.AddListCommand(parserData.zoneLegendList);
-          bus.$emit("elementDataChange", this.scene);
+          bus2.$emit("elementDataChange", this.scene);
         }
       });
       // 设备图例样式对象
@@ -798,7 +794,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

@@ -151,6 +151,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 = [
@@ -440,7 +441,8 @@ export default {
       }
     },
     getBus() {
-      bus.$on("exportItem", data => {
+      bus2.$off('exportItem');
+      bus2.$on("exportItem", data => {
         this.data = [];
         if (data.length) {
           this.spinning = true;

+ 8 - 8
src/components/edit/leftbar_components/itemTree.vue

@@ -116,14 +116,14 @@ export default {
           });
         }
       });
-      newTree.push({
-        title: '其他分组',
-        name: '其他分组',
-        id: '#',
-        key:'#',
-          checked: 'uncheck',
-        children: []
-      })
+      // newTree.push({
+      //   title: '其他分组',
+      //   name: '其他分组',
+      //   id: '#',
+      //   key:'#',
+      //     checked: 'uncheck',
+      //   children: []
+      // })
       return newTree;
     },
     //确定

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

@@ -39,6 +39,7 @@
 <script>
 import attrSelect from "@/components/edit/attr_select";
 import bus from "@/bus";
+import bus2 from "@/bus2";
 import { SImageMarkerItem } from "@/lib/items/SImageMarkerItem";
 import { SImageLegendItem } from "@/lib/items/SImageLegendItem";
 
@@ -104,7 +105,8 @@ export default {
   methods: {
     // 获取元素数据
     listenElementData() {
-      bus.$on("elementDataChange", val => {
+      bus2.$off('elementDataChange')
+      bus2.$on("elementDataChange", val => {
         this.elementData = [];
         if (val.Nodes.length) {
           this.elementData = this.elementData.concat(val.Nodes);

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

@@ -112,6 +112,7 @@
 </template>
 <script>
 import bus from "@/bus";
+import bus2 from "@/bus2";
 import { SGraphLayoutType, SOrderSetType } from "@saga-web/graph/lib";
 import systym from "./codeMapSystem.js";
 import { MessageBox } from "element-ui";
@@ -221,7 +222,8 @@ export default {
      * @description 获取底图加载完成后的,初始化的缩放比例initScale,设置为baseScale
      */
     getInitScale() {
-      bus.$on("initScale", baseScale => {
+      bus2.$off('initScale')
+      bus2.$on("initScale", baseScale => {
         this.baseScale = Number(baseScale || 1);
       });
     },
@@ -231,7 +233,8 @@ export default {
      */
     getMouseScale() {
       //  zoom 为缩放后改变的比例
-      bus.$on("mouseScale", zoom => {
+      bus2.$off('mouseScale')
+      bus2.$on("mouseScale", zoom => {
         const s = Number((zoom * this.initScale).toFixed(2));
         this.scale = s > 0.05 ? s : 0.05;
       });
@@ -357,8 +360,8 @@ export default {
     },
   },
   async mounted() {
-    bus.$on("FocusItemChanged", itemMsg => {
-      console.log("itemMsg", itemMsg);
+    bus2.$off('FocusItemChanged')
+    bus2.$on("FocusItemChanged", itemMsg => {
       this.FocusItemChanged(itemMsg);
     });
     // 获取底图加载完成后的初始sacle

+ 1 - 1
src/lib/items/SSCPZZoneLegendItem.ts

@@ -137,7 +137,7 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
         }
         this.id = data.ID;
         this.name = data.Name;
-        this.text = data.Name;
+        // this.text = data.Name;
         if (data) {
             this.setPointList = [];
             let setPointList: SPoint[];