Forráskód Böngészése

业务空间逻辑修改

haojianlong 5 éve
szülő
commit
cf72948bbe

+ 68 - 71
src/components/business_space/newGraphy/graphy.vue

@@ -56,8 +56,8 @@
       </el-row>
       <!-- 底部操作按钮 -->
       <el-row class="canvas-actions-box">
-        <canvasFun @move="moveCanvas" @fit="fit" @savePng="savePng" @saveSvg="saveSvg" @divide="divide" @clearDivide="clearDivide" @undo="undo"
-          @redo="redo" @scale="scale" :isEdit="isEdit" ref="canvasFun"></canvasFun>
+        <canvasFun @fit="fit" @savePng="savePng" @saveSvg="saveSvg" @divide="divide" @clearDivide="clearDivide" @undo="undo" @redo="redo"
+          @scale="scale" :isEdit="isEdit" ref="canvasFun"></canvasFun>
       </el-row>
     </div>
     <!--  -->
@@ -393,7 +393,7 @@ export default {
       if (this.groupCreateType == 1) {
         this.groupCreateBSpace()
       } else if (this.groupCreateType == 2) {
-        
+
       }
     },
     // 批量创建业务空间
@@ -428,34 +428,8 @@ export default {
           type: "warning"
         }
         ).then(() => {
-          let pa = {
-            zone: this.tab.code,
-            data: {
-              Content: Spaces
-            }
-          }
           this.canvasLoading = true;
-          createZone(pa, res => {
-            res.EntityList.map(t => {
-              Spaces = Spaces.map(item => {
-                if (t.RoomLocalName == item.RoomLocalName) {
-                  item.SpaceId = t.RoomID
-                }
-                return item;
-              })
-            })
-            let param = {
-              data: {
-                Content: Spaces
-              },
-              type: this.tab.code
-            }
-            groupCreRelaZoneAndISp(param, res => {
-              this.$message.success('创建成功')
-              this.canvasLoading = false;
-              this.init(2)
-            })
-          })
+          this.groupCreateBSP(Spaces)
         }).catch(() => {
           this.$message({
             type: "info",
@@ -494,38 +468,21 @@ export default {
       zoneObj.RoomLocalName = val;
       zoneObj.BuildingId = this.buildFloor[0];
       zoneObj.FloorId = this.buildFloor[1];
-      let pa = {
-        zone: this.tab.code,
-        data: {
-          Content: [zoneObj]
-        }
-      }
-      createZone(pa, res => {
-        this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
-      })
+      this.createSingleBSP(zoneObj, IspaceIdList)
     },
     // 从未关联平面图的业务空间中选择--按钮返回关联信号
     createFromUnrelated(BSP) {
       BSP.Outline = [];
       BSP.Height = 0;
-      let arr = this.scene.getSelectedSpaces();
+      let arr = this.scene.getSelectedSpaces(), IspaceIdList = [];
       arr.map(t => {
         BSP.Outline.push(t.data.OutLine);
+        IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
         if (t.Height && (BSP.Height == 0 || t.Height < BSP.Height)) {
           BSP.Height = t.Height;
         }
       })
-      let pa = {
-        zone: BSP.ObjectType,
-        data: {
-          Content: [BSP],
-          Projection: ['Outline']
-        }
-      }
-      updateZone(pa, res => {
-        this.$message.success('更新成功');
-        this.init(2);
-      })
+      this.updateBSPOutline(BSP, IspaceIdList)
     },
     // 编辑空间详情
     editeSpaceDetail() {
@@ -561,16 +518,7 @@ export default {
       if (!zoneObj.Outline.length) {
         zoneObj.Outline = null;
       }
-      let pa = {
-        zone: this.tab.code,
-        data: {
-          Content: [zoneObj],
-          Projection: ['Outline']
-        },
-      }
-      updateZone(pa, res => {
-        this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
-      })
+      this.updateBSPOutline(zoneObj, IspaceIdList)
     },
     // 更新业务空间和元空间的关系
     relationInBSPandISP(SpaceId, IspaceIdList) {
@@ -583,6 +531,65 @@ export default {
         this.init(2);
       })
     },
+    // 批量更新业务空间和元空间的关系
+    groupCreRelaZoneAndISp(Spaces) {
+      let param = {
+        data: {
+          Content: Spaces
+        },
+        type: this.tab.code
+      }
+      groupCreRelaZoneAndISp(param, res => {
+        this.$message.success('创建成功')
+        this.canvasLoading = false;
+        this.init(2)
+      })
+    },
+    // 批量创建
+    groupCreateBSP(spaces) {
+        let pa = {
+          zone: this.tab.code,
+          data: {
+            Content: space
+          }
+        }
+        createZone(pa, res => {
+          res.EntityList.map(t => {
+            Spaces = Spaces.map(item => {
+              if (t.RoomLocalName == item.RoomLocalName) {
+                item.SpaceId = t.RoomID
+              }
+              return item;
+            })
+          })
+          this.groupCreRelaZoneAndISp(space)
+        })
+    },
+    // 单个创建
+    createSingleBSP(space, IspaceIdList) {
+      let pa = {
+        zone: this.tab.code,
+        data: {
+          Content: [space]
+        }
+      }
+      createZone(pa, res => {
+        this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
+      })
+    },
+    // 更新业务空间区域
+    updateBSPOutline(zoneObj, IspaceIdList) {
+      let pa = {
+        zone: this.tab.code,
+        data: {
+          Content: [zoneObj],
+          Projection: ['Outline']
+        },
+      }
+      updateZone(pa, res => {
+        this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
+      })
+    },
     // canvas 获取焦点
     focus() {
       document.getElementById(`floorCanvas`).focus()
@@ -596,16 +603,6 @@ export default {
       this.view = new FloorView('floorCanvas')
     },
     // 工具栏操作
-    // 移动底图
-    moveCanvas(move) {
-      // todo
-      let canvas = document.getElementById(`floorCanvas`);
-      if (move) {
-        canvas.style.cursor = 'move';
-      } else {
-        canvas.style.cursor = 'default';
-      }
-    },
     // 适配底图到窗口
     fit() {
       this.view.fitSceneToView()

+ 2 - 1
src/views/ledger/spacelist/index.vue

@@ -374,7 +374,8 @@ export default {
   .spaceTypes {
     .types {
       float: left;
-      width: calc(100% - 200px);
+      width: 100%;
+      // width: calc(100% - 200px);
     }
     .groupAdd {
       float: left;