YaolongHan преди 3 години
родител
ревизия
91b8a91b9e

+ 3 - 3
src/components/editClass/persagy-edit/PTopoScene.ts

@@ -43,7 +43,7 @@ export class PTopoScene extends SBaseEditScene {
     legendObj: any = null;
 
     /** 是否打开吸附功能 */
-    isAdsorb:boolean = false;
+    isAdsorb:boolean = true;
 
     // 静态服务器路径
     public imgServeUrl: string = '';
@@ -576,7 +576,7 @@ export class PTopoScene extends SBaseEditScene {
 
     /**
      * 接收选择器抛出的批量移动的事件
-     * 
+     *
      * @param sender 事件发送者
      * @param args   返回的参数
     */
@@ -595,7 +595,7 @@ export class PTopoScene extends SBaseEditScene {
 
     /**
      * 命令栈当前命令索引发生变化
-     * 
+     *
      * @param sender 事件发送者
     */
     stackChange(sender: SObject): void {

+ 26 - 24
src/components/editview/baseTopoEditer.vue

@@ -42,6 +42,7 @@ import {
 } from "@/api/editer";
 import { publishGraph } from "@/api/home";
 import crypto from "crypto-js/";
+import { equipAnchor } from "./equipAnchor";
 //////////////////////////////////////
 // 常量
 // 图服务路径
@@ -348,36 +349,34 @@ export default {
       });
       parse.relations.forEach((t) => {
         // 设置锚点
-        if (this.scene.isAdsorb) {
-          if (t.anchor1Id) {
-            let startAnc = null;
-            anchorList.forEach((aItem) => {
-              if (aItem.id == t.anchor1Id) {
-                startAnc = aItem;
-              }
-            });
 
-            if (startAnc) {
-              startAnc.isConnected = true;
-              startAnc.parent?.connect("changePos", t, t.changePos);
-              t.startAnchor = startAnc || null;
+        if (t.anchor1Id && this.scene.isAdsorb) {
+          let startAnc = null;
+          anchorList.forEach((aItem) => {
+            if (aItem.id == t.anchor1Id) {
+              startAnc = aItem;
             }
+          });
+
+          if (startAnc) {
+            startAnc.isConnected = true;
+            startAnc.parent?.connect("changePos", t, t.changePos);
+            t.startAnchor = startAnc || null;
           }
-          if (t.anchor2Id) {
-            let endAnc = null;
-            anchorList.forEach((aItem) => {
-              if (aItem.id == t.anchor2Id) {
-                endAnc = aItem;
-              }
-            });
-            if (endAnc) {
-              endAnc.isConnected = true;
-              endAnc.parent?.connect("changePos", t, t.changePos);
-              t.endAnchor = endAnc || null;
+        }
+        if (t.anchor2Id && this.scene.isAdsorb) {
+          let endAnc = null;
+          anchorList.forEach((aItem) => {
+            if (aItem.id == t.anchor2Id) {
+              endAnc = aItem;
             }
+          });
+          if (endAnc) {
+            endAnc.isConnected = true;
+            endAnc.parent?.connect("changePos", t, t.changePos);
+            t.endAnchor = endAnc || null;
           }
         }
-
         t.connect("finishCreated", this.scene, this.scene.finishCreated);
         t.connect("onContextMenu", this, this.scene.getItem);
         this.scene.addItem(t);
@@ -550,6 +549,9 @@ export default {
             },
           },
         };
+        if (equipAnchor[item.classCode]) {
+          data.anchorList = equipAnchor[item.classCode];
+        }
         parse.addNode(data);
       });
       // 添加到 scence 中

+ 72 - 0
src/components/editview/equipAnchor.js

@@ -0,0 +1,72 @@
+export const equipAnchor = {
+  "WSSTSP": [
+    {
+      id: '',
+      pos: {
+        x: 50,
+        y: 0
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: -50,
+        y: 0
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: 50
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: -50
+      }
+    },
+  ],
+  "WSDWWT": [ // 生活给水储水箱
+    {
+      id: '',
+      pos: {
+        x: 12,
+        y: -10
+      }
+    },
+  ],
+  // 离心式冷水机组
+  'ACCCCC': [
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: -50
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: -50
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: -50
+      }
+    },
+    {
+      id: '',
+      pos: {
+        x: 0,
+        y: -50
+      }
+    },
+  ]
+}

+ 1 - 1
src/components/editview/rightPropertyBar/property.vue

@@ -204,7 +204,7 @@ export default {
     // 同步样式
     linkStyle(itemList) {
       const item = itemList[0];
-      console.log("item", item);
+      console.log("item", item.legendData.properties.classCode);
       this.EquipMsgItem = null;
       this.items = null;
       this.isSvg = false;