YaolongHan vor 4 Jahren
Ursprung
Commit
cc241fc108

+ 8 - 4
src/components/baseEditer.vue

@@ -73,6 +73,7 @@ export default {
         left: 0
       },
       count: 0, // 顶楼为多张图时计数器
+      isCopy:''//是否为不可编辑得复制状态
     };
   },
   mounted() {
@@ -84,10 +85,9 @@ export default {
     if (this.urlMsg.categoryId) {
       store.dispatch("getGraphElement", { PageSize: 1000, Deleted: false, GraphCategoryIds:[this.urlMsg.categoryId] });
     }
-    window.vm = this;
+    // window.vm = this;
     const that = this;
     document.onkeydown = function(event) {
-      console.log('ctrl',event,isMac)
       const e = event || window.event || arguments.callee.caller.arguments[0];
       if (e && e.key == "Control") {
         // 按 ctrl
@@ -118,6 +118,10 @@ export default {
       this.scene.crossPagePaste(text)
     }
     // 自动保存(时间差为一分钟)
+    // 如果为复制状态则不需要自动保存
+    if(this.isCopy=='true'){
+      return
+    }
     this.autoSave = setInterval(() => {
       this.saveMsgNoMessage();
     }, 300000);
@@ -133,7 +137,7 @@ export default {
       document.getElementById(`canvas`).focus();
       this.clearGraphy();
       this.scene = new EditScence();
-
+      this.scene.isCopy = this.isCopy; //是否为复制状态
       if (this.urlMsg.fmapID.includes("null")) {
         this.loadings.close();
         this.view.scene = this.scene;
@@ -940,13 +944,13 @@ export default {
     params = decodeURIComponent(params);
     // params = "categoryId=NTXT&ProjectID=5&BuildingID=1&FloorID=1"; // mock 参数
     const paramsArr = params.split("&");
-    console.log("paramsArr", paramsArr);
     const obj = {};
     paramsArr.map(item => {
       const arr = item.split("=");
       obj[arr[0]] = arr[1];
     });
     this.urlMsg = obj;
+    this.isCopy = obj.isCopy ? obj.isCopy :'false'
   },
   beforeDestroy() {
     // 销毁自动保存

+ 15 - 4
src/components/edit/left_toolbar.vue

@@ -145,6 +145,9 @@
         </div>
       </div>
     </transition>
+    <!-- 左侧导航蒙版 -->
+    <div class="left_toolbar_mask" v-show="isCopy=='true'">
+    </div>
   </div>
 </template>
 <script>
@@ -283,13 +286,14 @@ export default {
         { name: "绘制", id: "draw" },
         { name: "点选", id: "select" }
       ],
-      tabActive: "select"
+      tabActive: "select",
     };
   },
   computed: {
     ...mapState({
       GraphCategoryIds: "GraphCategoryIds",
-      GraphElement: "GraphElement"
+      GraphElement: "GraphElement",
+      isCopy:'isCopy'
     })
   },
   methods: {
@@ -554,8 +558,6 @@ export default {
       obj[arr[0]] = arr[1];
     });
     this.categoryId = obj.categoryId;
-    // this.categoryIdS.push(obj.categoryId);
-    this.categoryId;
   }
 };
 </script>
@@ -838,5 +840,14 @@ export default {
     background: #c3c7cb;
     margin: 0 auto;
   }
+  .left_toolbar_mask{
+    position: absolute;
+    width: 100%;
+    height:e("calc(100% - 56px)");
+    background: rgba(0, 0, 0, 0.11);
+    left: 0;
+    top: 56px;
+    cursor:not-allowed;
+  }
 }
 </style>

+ 19 - 3
src/components/edit/right_toolbar.vue

@@ -48,6 +48,7 @@
         </div>
       </a-tab-pane>
     </a-tabs>
+    <div class="right_toolbar_mask"  v-show="isCopy=='true'"></div>
   </div>
 </template>
 <script>
@@ -56,7 +57,7 @@ import bus from "@/bus";
 import bus2 from "@/bus2";
 import { SImageMarkerItem } from "@/lib/items/SImageMarkerItem";
 import { SImageLegendItem } from "@/lib/items/SImageLegendItem";
-
+import { mapState } from "vuex";
 const msgList = [
   {
     msg: "",
@@ -103,8 +104,13 @@ export default {
   components: {
     attrSelect
   },
+   computed: {
+    ...mapState({
+      isCopy:'isCopy'
+    })
+  },
   created() {
-    this.listenElementData();
+    this.listenElementData()
   },
   data() {
     return {
@@ -113,7 +119,7 @@ export default {
       elementData: [],
       key: "",
       isLock: true,
-      aspectRatio: 1 // 元素宽高比
+      aspectRatio: 1, // 元素宽高比
     };
   },
   methods: {
@@ -304,6 +310,7 @@ li {
   height: 100%;
   background: rgba(255, 255, 255, 1);
   box-shadow: 1px 2px 10px 0px rgba(0, 0, 0, 0.11);
+  position: relative;
   .atabless {
     height: 100%;
     width: 100%;
@@ -378,6 +385,15 @@ li {
       }
     }
   }
+  .right_toolbar_mask{
+    width: 280px;
+    height: 100%;
+    background: rgba(0, 0, 0, 0.11);
+    cursor:not-allowed;
+    position: absolute;
+    left: 0;
+    top: 0;
+  }
 }
 /deep/ .ant-tabs .ant-tabs-top-content.ant-tabs-content-animated {
   height: calc(100% - 60px);

+ 0 - 1
src/components/edit/top_toolbar.vue

@@ -457,7 +457,6 @@ export default {
     params = decodeURIComponent(params);
     // params = "categoryId=NTXT&ProjectID=5&BuildingID=1&FloorID=1"; // mock 参数
     const paramsArr = params.split("&");
-    console.log("paramsArr", paramsArr);
     const obj = {};
     paramsArr.map(item => {
       const arr = item.split("=");

+ 77 - 67
src/components/mapClass/EditScence.ts

@@ -36,6 +36,8 @@ export class EditScence extends SGraphScene {
     undoStack = new SUndoStack();
     /** 判断是否为苹果电脑 */
     public isMac = /macintosh|mac os x/i.test(navigator.userAgent);
+    /** 是否为复制状态 */
+    public isCopy = "false"
     /** 命令 1 绘制直线 */
     private cmd = 'choice';
     /** 获取当前状态 */
@@ -761,13 +763,13 @@ export class EditScence extends SGraphScene {
                     let nameArr = name.split("\n");
                     // if (nameArr[nameArr.length - 1] != arr[arr.length - 1].name) //最后一行的名称和将要添加的名称如果不同(增加)
                     if (nameArr.indexOf(arr[arr.length - 1].name) == -1) //将要添加的名称和每一行的名称都不同(新增)
-                    if (name) {
-                        item.name = name + `\n${arr[arr.length - 1].name}`;
-                        item.text = name + `\n${arr[arr.length - 1].name}`;
-                    } else {
-                        item.name = arr[arr.length - 1].name;
-                        item.text = arr[arr.length - 1].name;
-                    }
+                        if (name) {
+                            item.name = name + `\n${arr[arr.length - 1].name}`;
+                            item.text = name + `\n${arr[arr.length - 1].name}`;
+                        } else {
+                            item.name = arr[arr.length - 1].name;
+                            item.text = arr[arr.length - 1].name;
+                        }
                 }
                 // 绑定工程信息化数据后设置状态
                 if (item.data.AttachObjectIds && item.data.AttachObjectIds.length) {
@@ -806,6 +808,10 @@ export class EditScence extends SGraphScene {
      * 删除指定item
      */
     deleiteItem(): void {
+        // 如果为复制状态则删除失效
+        if (this.isCopy == "true") {
+            return
+        }
         if (this.focusItem) {
             if ((this.focusItem instanceof SZoneLegendItem ||
                 this.focusItem instanceof SSCPZZoneLegendItem ||
@@ -1050,7 +1056,7 @@ export class EditScence extends SGraphScene {
         }
         switch (this.cmd) {
             case 'choice':
-                if (!super.onMouseDown(event)){
+                if (!super.onMouseDown(event)) {
                     this.addRectSelect(event);
                 }
                 break
@@ -1412,6 +1418,10 @@ export class EditScence extends SGraphScene {
      * @return	boolean
      */
     onDoubleClick(event: SMouseEvent): boolean {
+        // 如果为复制状态则双击失效
+        if (this.isCopy == "true") {
+            return true
+        }
         if (!this.isEditStatus) {
             return true
         } else {
@@ -1910,8 +1920,8 @@ export class EditScence extends SGraphScene {
     /**
      * 计算框选交集
     */
-    groupSelect(ctrl:boolean){
-        if(!ctrl){
+    groupSelect(ctrl: boolean) {
+        if (!ctrl) {
             this.selectContainer.clear()
         }
         if (this.grabItem instanceof SRectSelectItem) {
@@ -1942,65 +1952,65 @@ export class EditScence extends SGraphScene {
     /**
      * 修改item样式
      */
-    changeLengendItem(legend:any){
+    changeLengendItem(legend: any) {
         if (this.focusItem) {
             //   如果更改得item类相同,则不需要
-                if(this.focusItem.data.GraphElementId == legend.Id){
-                    return
-                }
-                const OutLine:any = []
-                if(this.focusItem.pointList){
-                    this.focusItem.pointList.forEach(item=>{
-                        OutLine.push({X:item.x,Y:item.y})
-                    })
-                }
-                const SubType = legend.SubType ? legend.SubType : '';
-                const LegendData: Legend = {
-                    ID: uuid(),
-                    Name: this.focusItem.name,
-                    GraphElementType: legend.Type,
-                    Num: 1,
-                    GraphElementId: legend.Id,
-                    AttachObjectIds: this.focusItem.data.AttachObjectIds,
-                    Type: "Zone",
-                    Pos: { X: this.focusItem.data.Pos.X, Y: this.focusItem.data.Pos.Y },
-                    OutLine: OutLine,
-                    SubType: SubType,
-                    Properties: {
-                        IconUrl: '/serve/topology-wanda/Picture/query/' + legend.Url,
-                        StrokeColor: legend.Color,
-                        FillColor: legend.FillColor,
-                        LineDash: legend.LineDash,
-                        LineWidth: legend.LineWidth,
-                        font: 14,
-                        color: "#1F2429",
-                        TextPos: { X:this.focusItem.data.Properties.TextPos.X, Y: this.focusItem.data.Properties.TextPos.Y },
-                        InfoTypeId: legend.InfoTypeId.length ? legend.InfoTypeId : [],
-                        InfoSystemId: legend.InfoSystemId ? legend.InfoSystemId : '',
-                        InfoLocal: legend.InfoLocal.length ? legend.InfoLocal : [],
-                        lengendName: legend.Name, //图例名称
-                    },
-                }
-                let Polylines = null;
-                if (SubType == "SCPZ") {
-                    Polylines = new SSCPZZoneLegendItem(null, LegendData);
-                } else if (SubType == "FHFQ") {
-                    Polylines = new SFHFQZoneLegendItem(null, LegendData);
-                } else if (SubType == "CUSTOM") {
-                    Polylines = new SCustomLegendItem(null, LegendData);
-                } else {
-                    Polylines = new SZoneLegendItem(null, LegendData);
-                }
-                Polylines.selectable = true;
-                //设置状态
-                Polylines.status = SItemStatus.Normal;
-                // Polylines.moveable = true;
-                this.addItem(Polylines);
-                Polylines.connect("finishCreated", this, this.finishCreated);
-                // 删除item
-                this.deleiteItem();
-                this.grabItem = Polylines;
-                this.focusItem = Polylines;
+            if (this.focusItem.data.GraphElementId == legend.Id) {
+                return
+            }
+            const OutLine: any = []
+            if (this.focusItem.pointList) {
+                this.focusItem.pointList.forEach(item => {
+                    OutLine.push({ X: item.x, Y: item.y })
+                })
+            }
+            const SubType = legend.SubType ? legend.SubType : '';
+            const LegendData: Legend = {
+                ID: uuid(),
+                Name: this.focusItem.name,
+                GraphElementType: legend.Type,
+                Num: 1,
+                GraphElementId: legend.Id,
+                AttachObjectIds: this.focusItem.data.AttachObjectIds,
+                Type: "Zone",
+                Pos: { X: this.focusItem.data.Pos.X, Y: this.focusItem.data.Pos.Y },
+                OutLine: OutLine,
+                SubType: SubType,
+                Properties: {
+                    IconUrl: '/serve/topology-wanda/Picture/query/' + legend.Url,
+                    StrokeColor: legend.Color,
+                    FillColor: legend.FillColor,
+                    LineDash: legend.LineDash,
+                    LineWidth: legend.LineWidth,
+                    font: 14,
+                    color: "#1F2429",
+                    TextPos: { X: this.focusItem.data.Properties.TextPos.X, Y: this.focusItem.data.Properties.TextPos.Y },
+                    InfoTypeId: legend.InfoTypeId.length ? legend.InfoTypeId : [],
+                    InfoSystemId: legend.InfoSystemId ? legend.InfoSystemId : '',
+                    InfoLocal: legend.InfoLocal.length ? legend.InfoLocal : [],
+                    lengendName: legend.Name, //图例名称
+                },
+            }
+            let Polylines = null;
+            if (SubType == "SCPZ") {
+                Polylines = new SSCPZZoneLegendItem(null, LegendData);
+            } else if (SubType == "FHFQ") {
+                Polylines = new SFHFQZoneLegendItem(null, LegendData);
+            } else if (SubType == "CUSTOM") {
+                Polylines = new SCustomLegendItem(null, LegendData);
+            } else {
+                Polylines = new SZoneLegendItem(null, LegendData);
+            }
+            Polylines.selectable = true;
+            //设置状态
+            Polylines.status = SItemStatus.Normal;
+            // Polylines.moveable = true;
+            this.addItem(Polylines);
+            Polylines.connect("finishCreated", this, this.finishCreated);
+            // 删除item
+            this.deleiteItem();
+            this.grabItem = Polylines;
+            this.focusItem = Polylines;
         }
     }
 }

+ 6 - 1
src/store/index.ts

@@ -11,7 +11,8 @@ export default new Vuex.Store({
     token: null,
     GraphElement:[],
     isRemember: false,
-    rememberBtn: "bind"
+    rememberBtn: "bind",
+    isCopy:'' //是否为复制状态
   },
   mutations: {
     TypeIdToGraphElement(state, data) {
@@ -40,6 +41,10 @@ export default new Vuex.Store({
     setRememberBtn(state, data) {
       state.rememberBtn = data
     },
+    SETISCOPY(state, data) {
+      state.isCopy = data;
+      console.log('SETISCOPY',data)
+    },
   },
   actions: {
     getElementType({ commit }, params) {

+ 21 - 0
src/views/editer.vue

@@ -34,6 +34,7 @@ import leftToolbar from "@/components/edit/left_toolbar.vue";
 import topToolbar from "@/components/edit/top_toolbar.vue";
 import rightToolbar from "@/components/edit/right_toolbar.vue";
 import bus from "@/bus";
+import {mapMutations} from 'vuex'
 export default {
   name: "wandaEditer",
   data() {
@@ -49,6 +50,7 @@ export default {
     rightToolbar
   },
   methods: {
+    ...mapMutations(['SETISCOPY']),
     // 左侧工具栏 点击事件
     toolActionClick(item) {
       this.cmdType = item.Type;
@@ -60,6 +62,25 @@ export default {
     changeFocusItem(item) {
       this.focusItemList = item;
     }
+  },
+   created() {
+    const href = window.location.href;
+    // 参数处理
+    let params = href.split("?")[1];
+    if (!params) {
+      // 参数有问题
+      return false;
+    }
+    params = decodeURIComponent(params);
+    const paramsArr = params.split("&");
+    const obj = {};
+    paramsArr.map(item => {
+      const arr = item.split("=");
+      obj[arr[0]] = arr[1];
+    });
+    this.urlMsg = obj;
+    const isCopy = obj.isCopy ? obj.isCopy :'false';
+    this.SETISCOPY(isCopy)
   }
 };
 </script>