瀏覽代碼

Merge branch 'develop' of http://39.106.8.246:3003/web/persagy_topo_editer into develop

YaolongHan 4 年之前
父節點
當前提交
236a3445d1

+ 2 - 2
package.json

@@ -16,9 +16,9 @@
   },
   "dependencies": {
     "@persagy-web/base": "2.2.1",
-    "@persagy-web/big": "2.2.18",
+    "@persagy-web/big": "2.2.19",
     "@persagy-web/draw": "2.2.8",
-    "@persagy-web/graph": "2.2.22",
+    "@persagy-web/graph": "2.2.23",
     "ant-design-vue": "^1.6.5",
     "axios": "^0.20.0",
     "core-js": "^3.6.5",

+ 6 - 9
src/components/editClass/edit/items/SBaseArrowEdit.ts

@@ -329,8 +329,8 @@ export class SBaseArrowEdit extends SGraphEdit {
         ]);
       }
     } else if (this.status == SItemStatus.Normal) {
-      this.moveToOrigin(this.x, this.y);
-      return super.onMouseUp(event);
+      super.onMouseUp(event)
+      return true;
     }
 
     this.curIndex = -1;
@@ -390,15 +390,11 @@ export class SBaseArrowEdit extends SGraphEdit {
 
   /**
    * 移动后处理所有坐标,并肩原点置为场景原点
-   *
-   * @param x   x 坐标
-   * @param y   y 坐标
   */
-  moveToOrigin(x: number, y: number): void {
-    super.moveToOrigin(x, y);
+  moveToOrigin(): void {
     this.line = this.line.map(t => {
-      t.x = t.x + x;
-      t.y = t.y + y;
+      t.x = t.x + this.x;
+      t.y = t.y + this.y;
       return t;
     });
 
@@ -551,6 +547,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * @return	实体类保存得数据
   */
   toData(): any {
+    this.moveToOrigin()
     const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
     this.data.style.default.line = Line;
     this.data.style.default.lineWidth = this.lineWidth;

+ 16 - 0
src/components/editClass/edit/items/SBaseCircleEdit.ts

@@ -345,12 +345,28 @@ export class SBaseCircleEdit extends SGraphEdit {
     }
   } // Function cancelOperate()
 
+   /**
+     * 移动后处理所有坐标,并肩原点置为场景原点
+     */
+    moveToOrigin(): void {
+      this.line = this.line.map(t => {
+          t.x = t.x + this.x;
+          t.y = t.y + this.y;
+          return t;
+      });
+
+      this.x = 0;
+      this.y = 0;
+    } // Function moveToOrigin()
+  
   /**
    * 返回对象储存的相关数据
    *
    * @return  实体类数据
   */
   toData(): any {
+    // 将原点移动到场景原点
+    this.moveToOrigin();
     const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
     this.data.style.line = Line;
     this.data.style.default.lineWidth = this.lineWidth;

文件差異過大導致無法顯示
+ 1 - 1
src/components/editClass/edit/items/SBaseImageEdit.ts


+ 6 - 6
src/components/editClass/edit/items/SBaseLineEdit.ts

@@ -279,8 +279,8 @@ export class SBaseLineEdit extends SGraphEdit {
                 ]);
             }
         } else if (this.status == SItemStatus.Normal) {
-            this.moveToOrigin(this.x, this.y);
-            return super.onMouseUp(event);
+            super.onMouseUp(event);
+            return true
         }
 
         this.curIndex = -1;
@@ -385,11 +385,10 @@ export class SBaseLineEdit extends SGraphEdit {
      * @param x   x 坐标
      * @param y   y 坐标
      */
-    moveToOrigin(x: number, y: number): void {
-        super.moveToOrigin(x, y);
+    moveToOrigin(): void {
         this.line = this.line.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
+            t.x = t.x + this.x;
+            t.y = t.y + this.y;
             return t;
         });
 
@@ -526,6 +525,7 @@ export class SBaseLineEdit extends SGraphEdit {
      * @return	对象数据
      */
     toData(): any {
+        this.moveToOrigin()
         const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
         this.data.style.default.line = Line;
         this.data.style.default.lineWidth = this.lineWidth;

+ 4 - 8
src/components/editClass/edit/items/SBasePolygonEdit.ts

@@ -794,7 +794,6 @@ export class SBasePolygonEdit extends SGraphEdit {
                 ]);
             }
         } else if (this.status == SItemStatus.Normal) {
-            this.moveToOrigin(this.x, this.y);
             return super.onMouseUp(event);
         }
         return true;
@@ -802,15 +801,11 @@ export class SBasePolygonEdit extends SGraphEdit {
 
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
-     *
-     * @param x   x 坐标
-     * @param y   y 坐标
      */
-    moveToOrigin(x: number, y: number): void {
-        super.moveToOrigin(x, y);
+    moveToOrigin(): void {
         this.pointList = this.pointList.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
+            t.x = t.x + this.x;
+            t.y = t.y + this.y;
             return t;
         });
 
@@ -907,6 +902,7 @@ export class SBasePolygonEdit extends SGraphEdit {
      * @return	对象参数
      */
     toData() : any {
+        this.moveToOrigin();        
         const Line = this.pointList.map(pos => {
             return {
                 x: pos.x,

+ 6 - 9
src/components/editClass/edit/items/SBasePolylineEdit.ts

@@ -341,8 +341,8 @@ export class SBasePolylineEdit extends SGraphEdit {
                 ]);
             }
         } else if (this.status == SItemStatus.Normal) {
-            this.moveToOrigin(this.x, this.y);
-            return super.onMouseUp(event);
+            super.onMouseUp(event)
+            return true;
         }
 
         return true;
@@ -400,15 +400,11 @@ export class SBasePolylineEdit extends SGraphEdit {
 
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
-     *
-     * @param x   x 坐标
-     * @param y   y 坐标
      */
-    moveToOrigin(x: number, y: number): void {
-        super.moveToOrigin(x, y);
+    moveToOrigin(): void {
         this.pointList = this.pointList.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
+            t.x = t.x + this.x;
+            t.y = t.y + this.y;
             return t;
         });
         this.x = 0;
@@ -639,6 +635,7 @@ export class SBasePolylineEdit extends SGraphEdit {
      * @return 对象储存的相关数据
      */
     toData(): any {
+        this.moveToOrigin();
         const Line = this.pointList.map(pos => {
             return {
                 x: pos.x,

+ 15 - 0
src/components/editClass/edit/items/SBaseRectEdit.ts

@@ -343,11 +343,26 @@ export class SBaseRectEdit extends SGraphEdit {
     } // Function cancelOperate()
 
     /**
+     * 移动后处理所有坐标,并肩原点置为场景原点
+     */
+    moveToOrigin(): void {
+        this.line = this.line.map(t => {
+            t.x = t.x + this.x;
+            t.y = t.y + this.y;
+            return t;
+        });
+  
+        this.x = 0;
+        this.y = 0;
+    } // Function moveToOrigin()
+
+    /**
      * 返回对象储存的相关数据
      *
      * @return 对象储存的相关数据
      */
     toData(): any {
+        this.moveToOrigin();
         const Line: any = [];
         this.line.forEach(item => {
             Line.push({ x: item.x, y: item.y })

+ 3 - 3
src/components/editClass/edit/items/SBaseTextEdit.ts

@@ -260,9 +260,9 @@ export class SBaseTextEdit extends SGraphEdit {
      * @param x   x 坐标
      * @param y   y 坐标
      */
-    moveToOrigin(x: number, y: number): void {
-        this.moveTo(this.x + x, this.y + y);
-    } // Function moveToOrigin()
+    // moveToOrigin(x: number, y: number): void {
+    //     this.moveTo(this.x + x, this.y + y);
+    // } // Function moveToOrigin()
 
     /**
      * 绘制显示状态文本 Item

+ 21 - 17
src/components/editview/baseTopoEditer.vue

@@ -162,24 +162,27 @@ export default {
           graphId: this.graphId,
           id: this.id,
         });
-        console.log(obj);
         saveGroup(obj).then((res) => {
-          // 设置发布状态为 未发布
-          this.SETISPUB(0);
-          const gid = res.entityList[0].graphId;
-          const id = res.entityList[0].id;
-          // 重设图id 与 id
-          this.SETPROJECT({ graphId: gid, id: id });
-          // 修改url参数
-          this.$router.push({
-            name: "Editer",
-            query: {
-              graphId: gid,
-              id: id,
-              categoryName: encodeURI(this.categoryName),
-              isPub: 0,
-            },
-          });
+          // 如果是从已发布跳转过来
+          if (this.isPub == 1) {
+            // 设置发布状态为 未发布
+            this.SETISPUB(0);
+            const gid = res.entityList[0].graphId;
+            const id = res.entityList[0].id;
+            // 重设图id 与 id
+            this.SETPROJECT({ graphId: gid, id: id });
+            // 修改url参数
+            this.$router.push({
+              name: "Editer",
+              query: {
+                graphId: gid,
+                id: id,
+                categoryName: encodeURI(this.categoryName),
+                isPub: 0,
+              },
+            });
+          }
+          this.$message.success(`保存成功${res.entityList[0].version}`);
         });
       });
       // 设置实例置顶置底
@@ -226,6 +229,7 @@ export default {
         item.connect("onContextMenu", this, this.scene.getItem);
         this.scene.addItem(item);
       });
+      this.view.fitSceneToView()
     },
   },
   watch: {