Browse Source

草稿箱顶楼展示

haojianlong 4 years ago
parent
commit
527ce5e165
1 changed files with 32 additions and 24 deletions
  1. 32 24
      src/views/drafts.vue

+ 32 - 24
src/views/drafts.vue

@@ -108,7 +108,7 @@ import {
 } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
-import { SImageItem } from "@saga-web/graph/lib";
+import { SImageItem, SImageShowType } from "@saga-web/graph/lib";
 import store from "../store";
 import { Loading } from "element-ui";
 import { getUrlMsg } from "@/components/urlMsg.js";
@@ -226,40 +226,48 @@ export default {
             null,
             `${this.mapServerURL}/webtheme/${this.fmapID}/${fengmap.frImg}`
           );
+          imgItem.showType = SImageShowType.AutoFit;
+          imgItem.connect("imgLoadOver", this, () => {
+            this.view.fitSceneToView();
+          });
           this.scene.addItem(imgItem);
-          this.view.fitSceneToView();
           this.loading = false;
           this.isQuerying = false;
+        } else {
+          this.readBaseMap(floor)
         }
       } else {
         if (this.floorList[floor]) {
-          fengmap.parseData(this.floorList[floor], res => {
-            if (res.err) {
-              console.log(res.err);
-              return;
-            }
-            this.fParser = new SFloorParser(null);
-            this.fParser.parseData(res);
-            this.fParser.spaceList.forEach(t => {
-              t.selectable = true;
-              this.scene.addItem(t);
-            });
-            this.fParser.wallList.forEach(t => this.scene.addItem(t));
-            this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
-            this.fParser.doorList.forEach(t => this.scene.addItem(t));
-            this.fParser.columnList.forEach(t => this.scene.addItem(t));
-            this.fParser.casementList.forEach(t => this.scene.addItem(t));
-            this.view.scene = this.scene;
-            this.view.fitSceneToView();
-            this.loading = false;
-            this.isQuerying = false;
-            console.log("success");
-          });
+          this.readBaseMap(floor)
         } else {
           console.log("楼层不正确");
         }
       }
     },
+    readBaseMap(floor){
+      fengmap.parseData(this.floorList[floor], res => {
+        if (res.err) {
+          console.log(res.err);
+          return;
+        }
+        this.fParser = new SFloorParser(null);
+        this.fParser.parseData(res);
+        this.fParser.spaceList.forEach(t => {
+          t.selectable = true;
+          this.scene.addItem(t);
+        });
+        this.fParser.wallList.forEach(t => this.scene.addItem(t));
+        this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
+        this.fParser.doorList.forEach(t => this.scene.addItem(t));
+        this.fParser.columnList.forEach(t => this.scene.addItem(t));
+        this.fParser.casementList.forEach(t => this.scene.addItem(t));
+        this.view.scene = this.scene;
+        this.view.fitSceneToView();
+        this.loading = false;
+        this.isQuerying = false;
+        console.log("success");
+      });
+    },
     change(id) {
       console.log(id);
       const data = this.treeData;