Bläddra i källkod

修改业务空间台账快速切换分区类型导致问题

haojianlong 4 år sedan
förälder
incheckning
b630715fc8
1 ändrade filer med 45 tillägg och 37 borttagningar
  1. 45 37
      src/components/business_space/newGraphy/graphy.vue

+ 45 - 37
src/components/business_space/newGraphy/graphy.vue

@@ -131,7 +131,7 @@ import {
   queryZone,
   zoneCount,
   zoneCreate,
-  zoneQuery,
+  zoneQueryOutline,
   zoneUpdate,
   zoneUpdateOutline,
   handleZoneUpdateBd
@@ -248,15 +248,17 @@ export default {
         }
       }
       queryZone(pa, res => {
-        this.BIMIDToSID = {}
-        this.BIMIDToSIName = {}
-        this.sourceIdToISP = {}
-        res.Content.map(t => {
-          let key = t.BIMID.split(":")[1];
-          this.BIMIDToSID[key] = t.RoomID;
-          this.BIMIDToSIName[key] = t.RoomLocalName || t.RoomName;
-          this.sourceIdToISP[key] = t;
-        })
+        if (res.Message == this.buildFloor[1]) {
+          this.BIMIDToSID = {}
+          this.BIMIDToSIName = {}
+          this.sourceIdToISP = {}
+          res.Content.map(t => {
+            let key = t.BIMID.split(":")[1];
+            this.BIMIDToSID[key] = t.RoomID;
+            this.BIMIDToSIName[key] = t.RoomLocalName || t.RoomName;
+            this.sourceIdToISP[key] = t;
+          })
+        }
       })
     },
     //添加其他分区
@@ -344,9 +346,12 @@ export default {
         },
         objectType: this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code
       }
-      this.allUnRelatISP = []
       getIspNotInSpace(pa, res => {
-        this.allUnRelatISP = res.Content;
+        // 类型需要重新获取,直接取pa.objecttype有问题
+        let tempType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code
+        if (res.FloorId == this.buildFloor[1] && res.ZoneType == tempType) {
+          this.allUnRelatISP = res.Content;
+        }
       })
     },
     // 获取底图
@@ -394,20 +399,22 @@ export default {
         pa.BuildingId = this.buildFloor[0];
         pa.FloorId = this.buildFloor[1];
       }
-      zoneQuery(pa, res => {
-        // 所有业务空间
-        this.businessSpaceList = res.Content;
-        // 已关联元空间的业务空间
-        this.BSPRelaISPList = [];
-        res.Content.map(t => {
-          if (t.Outline && t.Outline.length) {
-            this.BSPRelaISPList.push(t)
-          }
-        })
-        // 绘制业务空间
+      zoneQueryOutline(pa, res => {
+        // 类型需要重新获取,直接取pa.ZoneType
         let tempType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
-        let tempArr = this.BSPRelaISPList.map((t, i) => {
-          if (t.FloorId == this.buildFloor[1] && t.ObjectType == tempType) {
+        if (res.FloorId == this.buildFloor[1] && res.ZoneType == tempType) {
+          // 所有业务空间
+          this.businessSpaceList = res.Content;
+          // 已关联元空间的业务空间
+          this.BSPRelaISPList = [];
+          res.Content.map(t => {
+            if (t.Outline && t.Outline.length) {
+              this.BSPRelaISPList.push(t)
+            }
+          })
+          // 绘制业务空间
+          let tempArr = this.BSPRelaISPList.map((t, i) => {
+            // if (t.FloorId == this.buildFloor[1] && t.ObjectType == tempType) {
             return {
               RoomLocalName: t.RoomLocalName,
               OutLine: t.Outline,
@@ -415,18 +422,19 @@ export default {
               Color: colorArr[i % colorArr.length],
               Infected: t.State
             }
-          } else {
-            console.log('internet slow')
-            return undefined;
-          }
-        }).filter(item => item)
-        console.log(this.scene)
-        this.scene.removeAllZone();
-        this.scene.addZoneList(tempArr);
-        this.scene.click(this, this.canvasClick);
-        this.zoneList = this.scene.zoneList;
-        this.view._needDraw = true;
-        this.canvasLoading = false;
+            // } else {
+            //   console.log('internet slow')
+            //   return undefined;
+            // }
+          }).filter(item => item)
+          console.log(this.scene)
+          this.scene.removeAllZone();
+          this.scene.addZoneList(tempArr);
+          this.scene.click(this, this.canvasClick);
+          this.zoneList = this.scene.zoneList;
+          this.view._needDraw = true;
+          this.canvasLoading = false;
+        }
       })
     },
     // canvas点击事件