haojianlong преди 4 години
родител
ревизия
41d86fa1e9
променени са 1 файла, в които са добавени 49 реда и са изтрити 13 реда
  1. 49 13
      src/views/drafts.vue

+ 49 - 13
src/views/drafts.vue

@@ -93,7 +93,7 @@
 </template>
 <script>
 import Tree from "./../components/Tree/Tree.vue";
-import { SFengParser } from "@saga-web/feng-map";
+import { SFengParser, ProjectRf } from "@saga-web/feng-map";
 import { SFloorParser } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "@/components/mapClass/EditScence";
@@ -158,7 +158,8 @@ export default {
       BuildingID: "1", // 建筑id
       categoryId: "", //系统类id
       currentNodekey: "", //默认选中的节点树
-      expandedkeys: [] //默认展开的节点树
+      expandedkeys: [], //默认展开的节点树
+      count: 0, // 顶楼为多张图时计数器
     };
   },
   methods: {
@@ -222,17 +223,42 @@ export default {
       if (floor == "g80") {
         // 屋顶
         if (fengmap.frImg) {
-          const imgItem = new SImageItem(
-            null,
-            `${this.mapServerURL}/webtheme/${this.fmapID}/${fengmap.frImg}`
-          );
-          imgItem.showType = SImageShowType.AutoFit;
-          imgItem.connect("imgLoadOver", this, () => {
-            this.view.fitSceneToView();
-          });
-          this.scene.addItem(imgItem);
-          this.loading = false;
-          this.isQuerying = false;
+          const pj = this.fmapID.split('_')[0]
+          if (!ProjectRf[pj]){
+            const imgItem = new SImageItem(
+              null,
+              `${this.mapServerURL}/webtheme/${this.fmapID}/${fengmap.frImg}`
+            );
+            imgItem.showType = SImageShowType.AutoFit;
+            imgItem.connect("imgLoadOver", this, () => {
+              this.view.fitSceneToView();
+            });
+            this.scene.addItem(imgItem);
+            this.loading = false;
+            this.isQuerying = false;
+          } else {
+            // 多张图
+            try {
+              // 初始化0
+              this.count = 0;
+              ProjectRf[pj].forEach(t => {
+                const item = new SImageItem(
+                  null,
+                  `${this.mapServerURL}/webtheme/${this.fmapID}/${t.name}`
+                );
+                item.width = t.width
+                item.height = t.height
+                item.moveTo(t.x, t.y)
+                item.connect("imgLoadOver", this, () => {
+                  this.countRf(ProjectRf[pj].length);
+                });
+                this.scene.addItem(item);
+              })
+              // this.view.scene = this.scene;
+            } catch(e) {
+              console.log(e);
+            }
+          }
         } else {
           this.readBaseMap(floor)
         }
@@ -244,6 +270,16 @@ export default {
         }
       }
     },
+    // 顶楼为多张图时计数器
+    countRf(len) {
+      this.count++
+      console.log(len == this.count);
+      if (len == this.count) {
+        this.readGraph();
+      } else {
+        console.log('所有图片未加载完成');
+      }
+    },
     readBaseMap(floor){
       fengmap.parseData(this.floorList[floor], res => {
         if (res.err) {