Browse Source

完成编辑器内楼层得切换

YaolongHan 4 years ago
parent
commit
de56438260
2 changed files with 40 additions and 9 deletions
  1. 9 2
      src/components/baseEditer.vue
  2. 31 7
      src/components/edit/top_toolbar.vue

+ 9 - 2
src/components/baseEditer.vue

@@ -30,6 +30,7 @@ import { Loading } from "element-ui";
 import { Message } from "element-ui";
 import { SCircleItem } from "@/lib/items/SCircleItem";
 import menuList from "@/components/edit/menu_list.vue";
+import { mapState } from "vuex";
 window.FENGMAP = null;
 const isMac = /macintosh|mac os x/i.test(navigator.userAgent);
 //// 底图空间增加字段 isExtracted:boolean true 已被提取过
@@ -73,7 +74,6 @@ export default {
         left: 0
       },
       count: 0, // 顶楼为多张图时计数器
-      isCopy: "" //是否为不可编辑得复制状态
     };
   },
   mounted() {
@@ -442,6 +442,9 @@ export default {
       bus.$on("changeFontColor", val => {
         this.scene.updatedFontColor(val);
       });
+      bus.$on('changeCopystatus',val=>{
+         this.scene.isCopy = val;
+      })
       bus.$on("itemWidth", val => {
         this.scene.updatedWidth(Number(val));
       });
@@ -980,7 +983,11 @@ export default {
       obj[arr[0]] = arr[1];
     });
     this.urlMsg = obj;
-    this.isCopy = obj.isCopy ? obj.isCopy : "false";
+  },
+  computed: {
+    ...mapState({
+      isCopy:'isCopy'
+    })
   },
   beforeDestroy() {
     // 销毁自动保存

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

@@ -19,8 +19,14 @@
       </el-popover>
       <div class="OpenEdit">
         <i class="el-icon-back el-icon-back-two"></i>
-        <p>此处可以快速切换图纸</p>
-        <el-button size="medium" round class="edit-btn" v-show="isCopy=='true'" @click="opEditStatus">启动编辑</el-button>
+        <p v-bind:class="[isCopy!='true' ? 'iscopyTrue' : '']">此处可以快速切换图纸</p>
+        <el-button
+          size="medium"
+          round
+          class="edit-btn"
+          v-show="isCopy=='true'"
+          @click="opEditStatus"
+        >启动编辑</el-button>
       </div>
     </div>
     <div class="top-right">
@@ -175,7 +181,7 @@ import { SGraphLayoutType, SOrderSetType } from "@saga-web/graph/lib";
 import { queryFullFloor } from "@/api/editer";
 import systym from "./codeMapSystem.js";
 import { MessageBox } from "element-ui";
-import { mapState, mapActions } from "vuex";
+import { mapState, mapMutations } from "vuex";
 export default {
   data() {
     return {
@@ -276,6 +282,7 @@ export default {
     };
   },
   methods: {
+    ...mapMutations(["SETISCOPY"]),
     getFullFloor() {
       queryFullFloor({ projectId: this.urlMsg.projectId }).then(res => {
         this.treeData = res.Data;
@@ -495,8 +502,22 @@ export default {
       bus.$emit("changeRedo");
     },
     //打开编辑状态
-    opEditStatus(){
-
+    opEditStatus() {
+      this.SETISCOPY(false);
+      bus.$emit("changeCopystatus", false);
+      const query = `categoryId=${this.urlMsg.categoryId}&projectId=${
+        this.urlMsg.projectId
+      }&BuildingID=${this.urlMsg.BuildingID}&FloorID=${
+        this.urlMsg.FloorID
+      }&FloorName=${this.urlMsg.FloorName}&fmapID=${this.urlMsg.fmapID}&seq=${
+        this.urlMsg.seq
+      }&token=${this.urlMsg.token}&isCopy=${false}`;
+      this.urlMsg;
+      const url =
+        window.location.origin +
+        "/wandaEditer/editer?" +
+        encodeURIComponent(query);
+      window.open(url, "_self");
     }
   },
   created() {
@@ -532,8 +553,8 @@ export default {
           : (this.scale * 100).toFixed(0);
       return scalePercent + "%";
     },
-     ...mapState({
-      isCopy:'isCopy'
+    ...mapState({
+      isCopy: "isCopy"
     })
   },
   async mounted() {
@@ -697,6 +718,9 @@ li {
     }
   }
 }
+.iscopyTrue {
+  margin-right: 200px;
+}
 
 /deep/ .ant-dropdown-menu-item {
   display: flex;