Browse Source

Merge branch 'dev' of http://39.106.8.246:3003/web/persagy-plan-editer into dev

yunxing 4 years ago
parent
commit
3fcc337f06

+ 2 - 2
package.json

@@ -21,8 +21,8 @@
     "@persagy-web/big": "2.2.33",
     "@persagy-web/draw": "2.2.8",
     "@persagy-web/graph": "2.2.34",
-    "@persagy-web/big-edit": "2.2.6",
-    "@persagy-web/edit": "2.2.5",
+    "@persagy-web/big-edit": "2.2.7",
+    "@persagy-web/edit": "2.2.6",
     "@types/uuid": "^8.0.0",
     "ant-design-vue": "^1.6.5",
     "axios": "^0.20.0",

+ 29 - 29
src/components/editview/basePlanEditer.vue

@@ -1,13 +1,13 @@
 <template>
-    <div class="baseTopo" id="baseTopo" ref="baseTopo">
-        <topoTooltip
+    <div class="basePlan" id="basePlan" ref="basePlan">
+        <planTooltip
             v-show="showTooltip"
-            class="topoTooltip-box"
-            ref="topoTooltip"
+            class="planTooltip-box"
+            ref="planTooltip"
             @closeTooltip="showTooltip = false"
             :havItem="havItem"
             :contextMenuItem="contextMenuItem"
-        ></topoTooltip>
+        ></planTooltip>
         <canvas style="border: none; outline: medium" id="persagy_plan" :width="canvasWidth" :height="canvasHeight" tabindex="0"></canvas>
     </div>
 </template>
@@ -16,7 +16,7 @@ import { SFloorParser, getJsonz } from "@persagy-web/big";
 import { SImageItem, SImageShowType } from "@persagy-web/graph";
 import { SPlanView, SPlanParser, SPlanScene, SPlanDecorator, SPlanEquipment, SPlanZone } from "@/lib";
 import { SGraphPropertyCommand } from "@persagy-web/edit";
-import topoTooltip from "./topoTooltip.vue";
+import planTooltip from "./planTooltip.vue";
 import { mapState, mapMutations } from "vuex";
 import base64ToFile from "@/utils/base64ToFile";
 import { v1 as uuidv1 } from "uuid";
@@ -25,7 +25,7 @@ import { planerSave, planerRead, planerPublish } from "@/api/labsl";
 import { equipQuery, spaceQuery } from "@/api/equipcomponent";
 import { imgBaseUrl } from "@/api/imageservice";
 export default {
-    components: { topoTooltip },
+    components: { planTooltip },
     data() {
         return {
             scene: null, //场景
@@ -74,8 +74,8 @@ export default {
     mounted() {
         window.vim = this;
         // 获取 canvas 的宽高
-        this.canvasWidth = this.$refs.baseTopo.offsetWidth;
-        this.canvasHeight = this.$refs.baseTopo.offsetHeight - 10;
+        this.canvasWidth = this.$refs.basePlan.offsetWidth;
+        this.canvasHeight = this.$refs.basePlan.offsetHeight - 10;
         // 初始化场景类
         this.view = new SPlanView("persagy_plan");
         if (this.scene) this.view.scene = this.scene;
@@ -92,13 +92,13 @@ export default {
         this.scene.vueOnMouseDown = this.vueOnMouseDown;
 
         // 屏蔽浏览器右键功能(防止与编辑器右键交互重合)
-        document.getElementById("baseTopo").oncontextmenu = function (e) {
+        document.getElementById("basePlan").oncontextmenu = function (e) {
             return false;
         };
 
         // 2分钟自动保存
         this.autoSave = setInterval(() => {
-            this.autoSaveTopo();
+            this.autoSavePlan();
         }, 120000);
     },
     methods: {
@@ -238,7 +238,7 @@ export default {
                 this.havItem = false;
                 this.contextMenuItem = null;
             }
-            const doms = document.getElementsByClassName("topoTooltip-box")[0];
+            const doms = document.getElementsByClassName("planTooltip-box")[0];
             doms.style.left = event.offsetX + "px";
             doms.style.top = event.offsetY + "px";
         },
@@ -264,13 +264,13 @@ export default {
                 this.scene.updateStyle(type, val);
             });
             // 撤销
-            bus.$off("topoUndo");
-            bus.$on("topoUndo", (val) => {
+            bus.$off("planUndo");
+            bus.$on("planUndo", (val) => {
                 this.scene.undo();
             });
             // 重做
-            bus.$off("topoRedo");
-            bus.$on("topoRedo", (val) => {
+            bus.$off("planRedo");
+            bus.$on("planRedo", (val) => {
                 this.scene.redo();
             });
             // 删除
@@ -290,9 +290,9 @@ export default {
                 this.scene.paste();
             });
             // 保存
-            bus.$off("saveTopo");
-            bus.$on("saveTopo", (val) => {
-                this.saveTopoDraft();
+            bus.$off("savePlan");
+            bus.$on("savePlan", (val) => {
+                this.savePlanDraft();
             });
             // 设置实例置顶置底
             bus.$off("setOrder");
@@ -305,16 +305,16 @@ export default {
                 this.scene.setItemStatus();
             });
             // 下载图片
-            bus.$off("saveTopoImg");
-            bus.$on("saveTopoImg", () => {
+            bus.$off("savePlanImg");
+            bus.$on("savePlanImg", () => {
                 // 隐藏选择器
                 this.scene.selectContainer.clear();
                 this.view.saveImageSize(`${this.planContent.name}.png`, "png", this.canvasWidth, this.canvasHeight);
             });
             // 发布图片
-            bus.$off("issueTopo");
-            bus.$on("issueTopo", () => {
-                this.saveTopoDraft().then(() => {
+            bus.$off("issuePlan");
+            bus.$on("issuePlan", () => {
+                this.savePlanDraft().then(() => {
                     this.issueDraft();
                 });
             });
@@ -548,7 +548,7 @@ export default {
             bus.$emit("initScale", this.view.scale);
         },
         // 生成快照并保存草稿
-        saveTopoDraft() {
+        savePlanDraft() {
             const uuid = uuidv1();
             return Promise.all([this.generateSnap(uuid), this.saveDraft(uuid)])
                 .then((vals) => {
@@ -651,9 +651,9 @@ export default {
             });
         },
         // 自动保存
-        autoSaveTopo() {
+        autoSavePlan() {
             if (this.scene && this.scene.undoStack.isChange) {
-                this.saveTopoDraft().then(() => {
+                this.savePlanDraft().then(() => {
                     this.scene.undoStack.isChange = false;
                 });
             }
@@ -709,11 +709,11 @@ export default {
 };
 </script>
 <style lang="less" scoped>
-.baseTopo {
+.basePlan {
     width: 100%;
     height: 100%;
     position: relative;
-    .topoTooltip-box {
+    .planTooltip-box {
         position: absolute;
         left: 0;
         top: 0;

+ 4 - 4
src/components/editview/planEditer.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="topo-editer">
+    <div class="plan-editer">
         <div class="top-bar">
             <topToolBar></topToolBar>
         </div>
@@ -7,7 +7,7 @@
             <div class="left-bar">
                 <leftToolBar></leftToolBar>
             </div>
-            <div class="base-topo-editer">
+            <div class="base-plan-editer">
                 <basePlanEditer></basePlanEditer>
             </div>
             <div class="right-bar">
@@ -34,7 +34,7 @@ export default {
 };
 </script>
 <style lang="less">
-.topo-editer {
+.plan-editer {
     width: 100%;
     height: 100%;
     position: relative;
@@ -51,7 +51,7 @@ export default {
             // width: 240px;
             height: 100%;
         }
-        .base-topo-editer {
+        .base-plan-editer {
             flex: 1;
             height: 100%;
         }

+ 6 - 6
src/components/editview/topoTooltip.vue

@@ -1,6 +1,6 @@
 <!-- 弹框 -->
 <template>
-    <div class="topo_tooltip">
+    <div class="plan_tooltip">
         <div v-if="havItem" class="tooltip-card">
             <ul>
                 <li @click="editItem">编辑</li>
@@ -26,7 +26,7 @@ import { SItemStatus } from "@persagy-web/big";
 import bus from "@/bus/bus";
 export default {
     props: ["havItem", "contextMenuItem"],
-    name: "topoTooltip",
+    name: "planTooltip",
     data() {
         return {};
     },
@@ -79,17 +79,17 @@ export default {
         },
         // 保存图
         saveGraph() {
-            bus.$emit("saveTopo");
+            bus.$emit("savePlan");
             this.closetooltip();
         },
         // 发布图
         publishGraph() {
-            bus.$emit("issueTopo");
+            bus.$emit("issuePlan");
             this.closetooltip();
         },
         // 下载
         downPng() {
-            bus.$emit("saveTopoImg");
+            bus.$emit("savePlanImg");
             this.closetooltip();
         },
         // 关闭窗口
@@ -107,7 +107,7 @@ li {
     padding: 0;
     list-style-type: none;
 }
-.topo_tooltip {
+.plan_tooltip {
     position: relative;
     .tooltip-card {
         border: 1px solid #e4e5e7;

+ 6 - 6
src/components/editview/topToolBar.vue

@@ -2,12 +2,12 @@
     <div id="topToolBar">
         <div class="left">
             <ul>
-                <li @click="topoUndo">
+                <li @click="planUndo">
                     <el-tooltip class="item" effect="dark" content="撤销" placement="bottom">
                         <span class="icon iconfont icon-chehui"></span>
                     </el-tooltip>
                 </li>
-                <li @click="topoRedo">
+                <li @click="planRedo">
                     <el-tooltip class="item" effect="dark" content="重做" placement="bottom">
                         <span class="icon iconfont icon-zhongzuo"></span>
                     </el-tooltip>
@@ -163,12 +163,12 @@ export default {
     },
     methods: {
         //撤销
-        topoUndo() {
-            bus.$emit("topoUndo");
+        planUndo() {
+            bus.$emit("planUndo");
         },
         // 重做
-        topoRedo() {
-            bus.$emit("topoRedo");
+        planRedo() {
+            bus.$emit("planRedo");
         },
         // 删除item
         deleteItem() {

+ 9 - 10
src/views/editer.vue

@@ -8,13 +8,13 @@
             </div>
             <div class="right">
                 <el-tooltip class="item" effect="dark" content="下载" placement="bottom">
-                    <span @click="saveTopoImg" class="icon iconfont icon-xiazai"></span>
+                    <span @click="savePlanImg" class="icon iconfont icon-xiazai"></span>
                 </el-tooltip>
                 <el-tooltip class="item" effect="dark" content="保存" placement="bottom">
-                    <span @click="saveTopo" class="icon iconfont icon-baocun"></span>
+                    <span @click="savePlan" class="icon iconfont icon-baocun"></span>
                 </el-tooltip>
                 <el-tooltip class="item" effect="dark" content="发布" placement="bottom">
-                    <span @click="issueTopo" class="icon iconfont icon-fabu"></span>
+                    <span @click="issuePlan" class="icon iconfont icon-fabu"></span>
                 </el-tooltip>
             </div>
         </div>
@@ -22,7 +22,6 @@
     </div>
 </template>
 <script>
-// import topoEditer from "@/components/editview/topoEditer.vue";
 import planEditer from "@/components/editview/planEditer.vue";
 import bus from "@/bus/bus";
 import { mapState, mapMutations } from "vuex";
@@ -48,16 +47,16 @@ export default {
             this.INITRULELIST([]);
         },
         // 保存图片
-        saveTopo() {
-            bus.$emit("saveTopo");
+        savePlan() {
+            bus.$emit("savePlan");
         },
         // 发布
-        issueTopo() {
-            bus.$emit("issueTopo");
+        issuePlan() {
+            bus.$emit("issuePlan");
         },
         // 下载图片
-        saveTopoImg() {
-            bus.$emit("saveTopoImg");
+        savePlanImg() {
+            bus.$emit("savePlanImg");
         },
     },
     watch: {