Forráskód Böngészése

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

zhangyu 4 éve
szülő
commit
b6df42a712

BIN
public/favicon.ico


+ 42 - 24
src/components/baseEditer.vue

@@ -12,7 +12,7 @@ import { SFloorParser } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
-import { saveGroup, readGroup, queryTypeGraph,publishGraph } from "@/api/editer.js";
+import { saveGroup, readGroup, queryTypeGraph, publishGraph } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
 import { SImageItem } from "@saga-web/graph/lib";
@@ -49,7 +49,7 @@ export default {
       urlMsg: {},
       chiceItemList: [], //选中itemlist
       hasTypeList: [], // 当前类型下包含的typeid(提取)
-      graphId:'',
+      graphId: '',
       initScale: 1,  //加载好底图之后的,初始缩放比例
       changeScaleByClick: false,  //区分 滚轮,点击 事件改变的缩放比例
     };
@@ -152,10 +152,10 @@ export default {
       }
     },
     // 读取绘制数据
-    readGraph(){
+    readGraph() {
       this.readGroup().then(data => {
         this.graphId = data.Data[0].ID;
-        bus.$emit('setGraphId',this.graphId)
+        bus.$emit('setGraphId', this.graphId)
         if (data.Data) {
           const parserData = new STopologyParser(null);
           parserData.parseData(data.Data[0].Elements);
@@ -183,16 +183,34 @@ export default {
             this.scene.addItem(t);
             this.scene.Markers.push(t);
           });
-          // 增加图标类图例
+          // 增加图标类图例(此item需在管线item添加之前添加)
+          const ancToAnchor = {}
           parserData.imageLegendList.forEach(t => {
             this.scene.addItem(t);
             this.scene.Nodes.push(t);
+            if (t.anchorList && t.anchorList.length) {
+              t.anchorList.forEach(anc => {
+                ancToAnchor[anc.id] = anc
+              })
+            }
           });
-          // 增加管线类
-          // 增加图标类图例
+          // 增加管线类(需在图标类图例添加后添加)
           parserData.relationList.forEach(t => {
             this.scene.addItem(t);
             this.scene.Relations.push(t);
+            // 设置锚点
+            if (t.anchor1ID) {
+              const startAnc = ancToAnchor[t.anchor1ID]
+              startAnc.isConnected = true
+              startAnc.parent?.connect('changePos', t, t.changePos)
+              t.startAnchor = startAnc || null
+            }
+            if (t.anchor2ID) {
+              const endAnc = ancToAnchor[t.anchor2ID]
+              endAnc.isConnected = true
+              endAnc.parent?.connect('changePos', t, t.changePos)
+              t.endAnchor = endAnc || null
+            }
           });
           this.view.fitSceneToView();
           bus.$emit("elementDataChange", this.scene);
@@ -389,14 +407,14 @@ export default {
       bus.$on("changeDrawType", val => {
         this.scene.isSelecting = val == "select";
       }),
-      //发布图
-      bus.$on("publishMap", () => {
-        if(this.graphId==''){
-          this.$message.error('请先保存');
-          return false;
-        }
-       this.publishBtn()
-      })
+        //发布图
+        bus.$on("publishMap", () => {
+          if (this.graphId == '') {
+            this.$message.error('请先保存');
+            return false;
+          }
+          this.publishBtn()
+        })
       /**
        * @name changeScale缩放底图
        * @param { Number } zoom 缩放比例
@@ -427,7 +445,7 @@ export default {
       };
       return readGroup(data);
     },
-        //发布
+    //发布
     publishBtn() {
       console.log(this.graphId);
       const loadings = Loading.service({
@@ -448,14 +466,14 @@ export default {
         loadings.close();
         if (res.Result == "success") {
           this.$message.success('发布成功');
-         setTimeout(()=>{
-           const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
-           const url =
-                   window.location.origin +
-                   "/wandaEditer/drafts?" +
-                   encodeURIComponent(data);
-           window.open(url, true);
-         },1000);
+          setTimeout(() => {
+            const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
+            const url =
+              window.location.origin +
+              "/wandaEditer/drafts?" +
+              encodeURIComponent(data);
+            window.open(url, true);
+          }, 1000);
         } else {
           this.$message.error(res.Message);
         }

+ 16 - 11
src/components/mapClass/EditScence.ts

@@ -245,15 +245,13 @@ export class EditScence extends SGraphScene {
      */
     addPolygonItem(event: SMouseEvent): void {
         const SubType = this._legend.SubType ? this._legend.SubType : '';
-        //获取信息工程化相关参数
-        const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
         const LegendData: Legend = {
             ID: uuid(),
             Name: this._legend.Name,
             GraphElementType: this._legend.Type,
             Num: 1,
             GraphElementId: this._legend.Id,
-            AttachObjectIds: AttachObjectIds,
+            AttachObjectIds: [],
             Type: "Zone",
             Pos: { X: event.x, Y: event.y },
             OutLine: [{ X: event.x, Y: event.y }],
@@ -301,14 +299,13 @@ export class EditScence extends SGraphScene {
             //@ts-ignore
             item.isExtracted = true
             const SubType = this._legend.SubType ? this._legend.SubType : '';
-            const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
             const LegendData: Legend = {
                 ID: uuid(),
                 Name: this._legend.Name,
                 GraphElementType: this._legend.Type,
                 Num: 1,
                 GraphElementId: this._legend.Id,
-                AttachObjectIds: AttachObjectIds,
+                AttachObjectIds: [],
                 Type: "Zone",
                 Pos: { X: item.x, Y: item.y },
                 OutLine: item.pointArr[0],
@@ -417,14 +414,13 @@ export class EditScence extends SGraphScene {
      */
     addIconItem(event: SMouseEvent): void {
            //获取信息工程化相关参数
-        const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
         const LegendData: Legend = {
             ID: uuid(),
             Name: this._legend.Name,
             GraphElementType: this._legend.Type,
             Num: 1,
             GraphElementId: this._legend.Id,
-            AttachObjectIds: AttachObjectIds,
+            AttachObjectIds: [],
             Pos: { X: event.x, Y: event.y },
             Scale: { X: 1, Y: 1, Z: 1 },          // 缩放
             Rolate: { X: 0, Y: 0, Z: 0 },
@@ -793,10 +789,10 @@ export class EditScence extends SGraphScene {
             event.y = this.highLight.point.y;
         }
         if (this.grabItem) {
-            // if (this.grabItem instanceof TipelineItem) {
-            //     this.setTipeEndanchor(event)
-            //     return true;
-            // }
+            if (this.grabItem instanceof TipelineItem) {
+                this.setTipeEndanchor(event)
+                return true;
+            }
             return this.grabItem.onMouseDown(event);
         }
         switch (this.cmd) {
@@ -849,6 +845,15 @@ export class EditScence extends SGraphScene {
     onKeyDown(event: KeyboardEvent): any {
         if (this.grabItem) {
             this.grabItem.onKeyDown(event);
+            console.log('event',event)
+            if(event.code == "Escape"){
+               const item = this.grabItem;
+               this.grabItem = null
+               this.removeItem(item);
+               if(this.view){
+                   this.view.update()
+               }
+            }
         }
         // if (event.key == "Enter") {
         //     this.cmd = 0

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

@@ -37,7 +37,7 @@ export class SImageLegendItem extends SIconTextItem {
      * @param data      图例节点对象数据
      */
     constructor(parent: SGraphItem | null, data: Legend) {
-        super(parent);
+        super(parent, data.AnchorList);
         this.zOrder = ItemOrder.markOrder;
         this.data = data;
         this.id = data.ID;