Browse Source

'添加切换楼层功能'

zhangyu 4 years ago
parent
commit
c2adc993ee
4 changed files with 80 additions and 10 deletions
  1. 5 0
      src/api/editer.js
  2. 7 3
      src/components/edit/edit-dialog.vue
  3. 64 3
      src/components/edit/top_toolbar.vue
  4. 4 4
      vue.config.js

+ 5 - 0
src/api/editer.js

@@ -126,4 +126,9 @@ export function queryFloorByNode(params) {
 // 批量绑定工程信息化数据
 export function bindAttachObject(params){
     return httputils.postJson(`${testApi}/node/bindAttachObject`, params)
+}
+
+// 查询所有绘图的楼层
+export function queryFullFloor(params) {
+    return httputils.getJson(`${testApi}/graph/fullFloor`, params)
 }

+ 7 - 3
src/components/edit/edit-dialog.vue

@@ -660,7 +660,9 @@
                         GraphIds: this.GraphsIdList,
                         GraphElementName: this.GraphElementName,
                         GraphElementId: this.GraphElementId,
-                        AttachObject: lists
+                        AttachObject: lists,
+                        Num: lists.length?lists.length:1,
+                        Name: this.lengedName
                     }
                 } else {
                     params = {
@@ -668,10 +670,12 @@
                         Marked: false, // Marked为false时不传GraphIds字段,
                         GraphElementName: this.GraphElementName,
                         GraphElementId: this.GraphElementId,
-                        AttachObject: lists
+                        AttachObject: lists,
+                        Num: lists.length?lists.length:1,
+                        Name: this.lengedName
                     }
                 }
-
+                console.log("lenged+++++++++++++++++++++++++", this.lengedName);
                 bindAttachObject(params).then(res => {
                     this.visibleBind = false;
                     this.visible = false;

+ 64 - 3
src/components/edit/top_toolbar.vue

@@ -3,7 +3,18 @@
     <!-- 顶部编辑器 -->
     <div class="tit">
       <a-icon style="cursor: pointer;" type="left" @click="goDrafts" />
-      {{this.urlMsg.floorName}}
+      <el-popover
+        placement="bottom-start"
+        width="300"
+        trigger="click">
+        <div style="max-height:400px;overflow-y:auto;">
+          <el-tree :data="treeData" :props="defaultProps" :default-expand-all=true @node-click="handleNodeClick"></el-tree>
+        </div>
+        <span style="margin-left: 10px;cursor: pointer;" slot="reference">
+          {{this.urlMsg.floorName}}
+          <i class="el-icon-caret-bottom"></i>
+        </span>
+      </el-popover>
     </div>
     <div class="tool">
       <ul>
@@ -119,12 +130,26 @@
       </div>
     </div>
 
+    <el-dialog
+      title="操作提示"
+      :visible.sync="dialogVisible"
+      width="400">
+      <div>您打开的是已发布的平面图,您可以进行如下操作:</div>
+      <p>1、直接选择平面图中的元素进行复制,然后贴到其他平面图;</p>
+      <p>2、点击“启动编辑”对当前平面图进行编辑;</p>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleOpenUrl">打 开</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 <script>
     import bus from "@/bus";
     import bus2 from "@/bus2";
     import {SGraphLayoutType, SOrderSetType} from "@saga-web/graph/lib";
+    import {queryFullFloor} from "@/api/editer";
     import systym from "./codeMapSystem.js";
     import {MessageBox} from "element-ui";
 
@@ -132,7 +157,6 @@
         data() {
             return {
                 visible: false,
-
                 isLock: false, //是否锁定
                 focusItem: null,
                 alignmentOptions: [
@@ -218,7 +242,14 @@
                 scaleStep: 0.05, // +-缩放步进
                 locationQuery: null,
                 urlMsg: {},
-                focusItemList: []
+                focusItemList: [],
+                treeData: [],
+                defaultProps: {
+                  children: 'Children',
+                  label: 'Name'
+                },
+                treeQuery: "",
+                dialogVisible: false
             };
         },
         computed: {
@@ -232,6 +263,34 @@
             }
         },
         methods: {
+            getFullFloor() {
+                queryFullFloor({projectId: this.urlMsg.projectId}).then(res => {
+                  this.treeData = res.Data;
+                })
+            },
+            // 切换楼层
+            handleNodeClick(data, node) {
+                console.log(data, node);
+                if (data.CategoryId && data.ProjectId && data.BuildingId && data.FloorId && data.Name && data.Seq && data.Type) {
+                    const query = `categoryId=${data.CategoryId}&projectId=${data.ProjectId}&BuildingID=${data.BuildingId}&FloorID=${data.FloorId}&FloorName=${data.Name}&fmapID=${this.urlMsg.fmapID}&seq=${data.Seq}&token=${this.urlMsg.token}`;
+                    const url = window.location.origin + "/wandaEditer/editer?" + encodeURIComponent(query);
+                    if (data.Type == "NotPub") {
+                        window.open(url, "_self");
+                    } else if (data.Type == "HasPub") {
+                        this.treeQuery = query;
+                        this.dialogVisible = true;
+                    }
+                } else {
+                    this.$message.error("缺少跳转参数!");
+                }
+            },
+            // 已发布跳转url
+            handleOpenUrl() {
+                const query = `${this.treeQuery}&isCopy=true`;
+                const url = window.location.origin + "/wandaEditer/editer?" + encodeURIComponent(query);
+                window.open(url, "_self");
+                this.dialogVisible = false;
+            },
             /**
              * @name getInitScale
              * @description 获取底图加载完成后的,初始化的缩放比例initScale,设置为baseScale
@@ -433,6 +492,7 @@
             this.urlMsg = obj;
             const FloorName = this.urlMsg.FloorName ? this.urlMsg.FloorName : "";
             this.urlMsg.floorName = systym[this.urlMsg.categoryId] + "-" + FloorName;
+            this.getFullFloor();
         }
     };
 </script>
@@ -457,6 +517,7 @@ li {
     font-size: 18px;
     font-weight: bold;
     color: #1f2429;
+    position: relative;
   }
   .tool {
     ul {

+ 4 - 4
vue.config.js

@@ -16,8 +16,8 @@ module.exports = {
             },
             '/serve': {
                 // target: 'http://192.168.200.87:8088/',
-                target: 'http://10.199.143.129:8080',
-                // target: 'http://60.205.177.43:8080', //阿里云
+                // target: 'http://10.199.143.129:8080',
+                target: 'http://60.205.177.43:8080', //阿里云
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
@@ -25,8 +25,8 @@ module.exports = {
                 },
             },
             '/data': {
-                target: "http://10.199.143.126",
-                // target: 'http://60.205.177.43', //阿里云
+                // target: "http://10.199.143.126",
+                target: 'http://60.205.177.43', //阿里云
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {