YaolongHan před 4 roky
rodič
revize
bd9a1bba54

+ 17 - 21
src/components/baseEditer.vue

@@ -43,6 +43,7 @@ export default {
       scene: null,
       view: null,
       floorList: {},
+      fmapID:'1000423_120',
       urlMsg: {}
     };
   },
@@ -62,16 +63,16 @@ export default {
       this.scene = new EditScence();
       fengmap = new SFengParser(
         "fengMap",
-        this.mapServerURL + "/" + this.urlMsg.fmapID,
+        this.mapServerURL + "/" + this.fmapID,
         this.key,
         this.appName,
         null
       );
       const floorid = "f1";
-      fengmap.loadMap(this.urlMsg.fmapID, resp => {
-        console.log("load-map-succ", resp);
+      fengmap.loadMap(this.fmapID, resp => {
         this.floorList = resp;
         this.parserData(floorid);
+        this.view.fitSceneToView();
       });
       this.readGroup().then(data => {
         const parserData = new STopologyParser(null);
@@ -107,7 +108,9 @@ export default {
           this.scene.addItem(t);
           this.scene.Relations.push(t);
         });
+        this.view.fitSceneToView();
       });
+
       this.scene.emitChange = this.emitChange;
     },
     parserData(floor) {
@@ -215,7 +218,7 @@ export default {
           Elements,
           Name: this.appName, // 名称
           categoryId: this.urlMsg.categoryId,
-          ProjectID: this.urlMsg.ProjectID, // 项目ID
+          ProjectID: this.urlMsg.projectId, // 项目ID
           BuildingID: this.urlMsg.BuildingID, // 建筑ID
           FloorID: this.urlMsg.FloorID // 楼层id
         };
@@ -271,8 +274,8 @@ export default {
     // 读取数据
     readGroup() {
       const data = {
-        categoryId: "NTXT",
-        projectId: 5
+        categoryId: this.urlMsg.categoryId,
+        projectId: this.urlMsg.projectId
       };
       return readGroup(data);
     }
@@ -302,24 +305,17 @@ export default {
     let params = href.split("?")[1];
     if (!params) {
       // 参数有问题
-      // return false
+      return false
     }
     params = decodeURIComponent(params);
-    params = "categoryId=NTXT&ProjectID=5&BuildingID=1&FloorID=1"; // mock 参数
+    // params = "categoryId=NTXT&ProjectID=5&BuildingID=1&FloorID=1"; // mock 参数
     const paramsArr = params.split("&");
-    // console.log(paramsArr)
-    let obj = {};
-    // paramsArr.map(item => {
-    //   const arr = item.split("=");
-    //   obj[arr[0]] = arr[1];
-    // });
-    obj = {
-      categoryId: "NTXT",
-      ProjectID: "5",
-      BuildingID: "1",
-      FloorID: "1",
-      fmapID: "1001724_29"
-    };
+    console.log('paramsArr',paramsArr)
+    const obj = {};
+    paramsArr.map(item => {
+      const arr = item.split("=");
+      obj[arr[0]] = arr[1];
+    });
     this.urlMsg = obj;
     /**
  * obj:

+ 35 - 8
src/components/edit/left_toolbar.vue

@@ -93,7 +93,7 @@
                   :key="indexs"
                 >
                   <img
-                    :class="items.Type =='Image'? 'item' :'item-Image'"
+                    :class="['item',`item-${items.Type}`]"
                     :src="'/serve/topology-wanda/Picture/query/'+ items.Url"
                     alt
                   />
@@ -245,7 +245,8 @@ export default {
       isExtract: false, //是否为提取框
       data,
       columns,
-      itemList: [] //图例数组
+      itemList: [], //图例数组
+      categoryId: ""
     };
   },
   computed: {
@@ -296,7 +297,7 @@ export default {
         // 打开侧边框
         // 接口请求
         const arr = {
-          GraphCategoryIds: ["NTXT"],
+          GraphCategoryIds: this.categoryId,
           Type: item.type
         };
         queryGroup(arr).then(res => {
@@ -324,8 +325,8 @@ export default {
     getBus() {
       bus.$on("exportItem", data => {
         this.data = data.map(t => {
-          t.name = this.TypeIdToGraphElement[t.key].Name,
-          t.properties = this.TypeIdToGraphElement[t.key];
+          (t.name = this.TypeIdToGraphElement[t.key].Name),
+            (t.properties = this.TypeIdToGraphElement[t.key]);
           return t;
         });
       });
@@ -350,7 +351,27 @@ export default {
     this.getBus();
     console.log(this.GraphCategoryIds);
   },
-  created() {}
+  created() {
+    const href = window.location.href;
+    // 路由
+    // const route = href.split("?")[0];
+    // 参数处理
+    let params = href.split("?")[1];
+    if (!params) {
+      // 参数有问题
+      return false;
+    }
+    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.categoryId = obj.categoryId;
+  }
 };
 </script>
 <style lang="less">
@@ -499,8 +520,9 @@ export default {
         .example {
           width: 100%;
           display: flex;
+          flex-wrap: wrap;
           li {
-            width: 72px;
+            width: 66px;
             height: 60px;
             display: flex;
             justify-content: center;
@@ -516,7 +538,12 @@ export default {
             }
             .item-Image {
               width: 28px;
-              height: 16px;
+              height: 28px;
+              margin: 0 auto;
+            }
+            .item-Line {
+              width: 40px;
+              height: 30px;
               margin: 0 auto;
             }
             .item-pip {

+ 2 - 2
src/components/edit/top_toolbar.vue

@@ -10,14 +10,14 @@
           <img class="lock" :src="require(`./../../assets/images/t-save.png`)" alt />
           <span>保存</span>
         </li>
-        <li>
+        <!-- <li>
           <a-icon type="edit" />
           <span>撤销</span>
         </li>
         <li>
           <a-icon type="edit" />
           <span>重做</span>
-        </li>
+        </li> -->
         <li class="zoom-window">
           <div>
             <img class="lock" :src="require(`./../../assets/images/缩小.png`)" alt />