YaolongHan 4 năm trước cách đây
mục cha
commit
747ec74be4

+ 44 - 12
src/components/baseEditer.vue

@@ -14,8 +14,8 @@ import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
 import { saveGroup, readGroup } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
-import { uuid } from "@/components/mapClass/until"
-import store from '../store'
+import { uuid } from "@/components/mapClass/until";
+import store from "../store";
 
 let fengmap = null;
 
@@ -37,13 +37,13 @@ export default {
       appName: "万达可视化系统",
       key: "23f30a832a862c58637a4aadbf50a566",
       mapServerURL: "/wdfn",
-      fmapID: "1001724_29",
       canvasWidth: 700,
       canvasHeight: 800,
       fParser: null,
       scene: null,
       view: null,
-      floorList: {}
+      floorList: {},
+      urlMsg: {}
     };
   },
   mounted() {
@@ -52,7 +52,7 @@ export default {
     this.init();
     // 挂在bus
     this.getBus();
-    store.dispatch('getElementType',{PageSize:1000})
+    store.dispatch("getElementType", { PageSize: 1000 });
   },
   methods: {
     init() {
@@ -62,13 +62,13 @@ export default {
       this.scene = new EditScence();
       fengmap = new SFengParser(
         "fengMap",
-        this.mapServerURL + "/" + this.fmapID,
+        this.mapServerURL + "/" + this.urlMsg.fmapID,
         this.key,
         this.appName,
         null
       );
       const floorid = "f1";
-      fengmap.loadMap(this.fmapID, resp => {
+      fengmap.loadMap(this.urlMsg.fmapID, resp => {
         console.log("load-map-succ", resp);
         this.floorList = resp;
         this.parserData(floorid);
@@ -213,11 +213,11 @@ export default {
         const Elements = this.scene.saveMsgItem();
         const data = {
           Elements,
-          Name: "1", // 名称
-          categoryId: "NTXT",
-          ProjectID: "5", // 项目ID
-          BuildingID: "1", // 建筑ID
-          FloorID: "1", // 楼层id
+          Name: this.appName, // 名称
+          categoryId: this.urlMsg.categoryId,
+          ProjectID: this.urlMsg.ProjectID, // 项目ID
+          BuildingID: this.urlMsg.BuildingID, // 建筑ID
+          FloorID: this.urlMsg.FloorID // 楼层id
         };
         saveGroup(data).then(res => {
           console.log("aaaaaaaaaaaaaa", res);
@@ -293,6 +293,38 @@ export default {
       },
       deep: true
     }
+  },
+  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)
+    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"
+    };
+    this.urlMsg = obj;
+    /**
+ * obj:
+
+ */
   }
 };
 </script>

+ 3 - 2
src/components/mapClass/EditScence.ts

@@ -234,6 +234,7 @@ export class EditScence extends SGraphScene {
             ID: uuid(),
             /** 名称  */
             Name: '图片',
+            Num: 3,
             /** 图标(Image),线类型(Line) */
             Type: "Image",
             /** 位置  */
@@ -473,9 +474,9 @@ export class EditScence extends SGraphScene {
      * @param val string border类型
      */
     upadataLengedName(val: string): void {
-        console.log('xxxxxxx',val)
+        console.log('xxxxxxx',val,this.focusItem)
         if (this.focusItem && this.focusItem.data) {
-            this.focusItem.data.Name = val
+            this.focusItem.text= val
         }
     }
 

+ 0 - 1
src/lib/items/TipelineItem.ts

@@ -121,7 +121,6 @@ export class TipelineItem extends SPolylineItem {
     if (data.Properties && data.Properties.LineWidth) {
       this.lineWidth = data.Properties.LineWidth;
     }
-
   }
 
   /** 获取data数据  */