瀏覽代碼

Merge branch 'msg-sever' of http://39.106.8.246:3003/web/ibms into msg-sever

LXXXY 5 年之前
父節點
當前提交
d2f83e0cdc
共有 2 個文件被更改,包括 88 次插入22 次删除
  1. 1 1
      package.json
  2. 87 21
      src/components/business_space/newGraphy/graphy.vue

+ 1 - 1
package.json

@@ -28,7 +28,7 @@
         "@saga-web/base": "2.1.9",
         "@saga-web/draw": "2.1.58",
         "@saga-web/graphy": "2.1.30",
-        "@saga-web/cad-engine": "2.0.393"
+        "@saga-web/cad-engine": "2.0.400"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 87 - 21
src/components/business_space/newGraphy/graphy.vue

@@ -31,13 +31,14 @@
                 <el-dropdown-item command="groupCreateBSpace">批量创建业务空间</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
+            <!-- 点击已经关联的业务空间 -->
+            <el-button type="primary" plain @click="refactorBSP" :disabled="zoneDisable" style="margin-left:10px;">重新划分业务空间</el-button>
+            <el-button type="primary" @click="editeSpaceDetail" :disabled="zoneDisable">编辑空间详情</el-button>
+            <el-button plain @click="cancelGraphy" v-show="!zoneDisable">取 消</el-button>
           </div>
           <!-- 点击已经关联的业务空间 -->
-          <div v-show="type==2">
-            <el-button type="primary" plain @click="refactorBSP">重新划分业务空间</el-button>
-            <el-button type="primary" @click="editeSpaceDetail">编辑空间详情</el-button>
-            <el-button plain @click="cancelGraphy">取 消</el-button>
-          </div>
+          <!-- <div v-show="type==2">
+          </div> -->
           <!-- 点击未关联的业务空间 -->
           <div v-show="type==3">
             <el-button plain @click="createNewZone">创建单个全新的业务空间</el-button>
@@ -153,6 +154,7 @@ export default {
       zoneList: [], // 业务空间-canvas图中
       groupCreateDialogVis: false, //批量创建业务空间弹窗
       groupCreateType: 1, //批量创建方式
+      zoneDisable: true, // 重新划分是否禁用
     }
   },
   computed: {
@@ -169,10 +171,13 @@ export default {
     init(initType) {
       this.type = 1;
       if (this.scene) {
-        this.scene.isZoneSelectable = true;
-        this.scene.isSpaceSelectable = true;
         this.scene.clearSpaceSelection();
         this.scene.clearZoneSelection();
+        this.scene.clearCut();
+        this.scene.clearLikeSpaces();
+        this.zoneDisable = true;
+        this.scene.isZoneSelectable = true;
+        this.scene.isSpaceSelectable = false;
       }
       if (this.buildFloor.indexOf('all') > -1 || this.buildFloor.indexOf('noKnow') > -1) {
         return;
@@ -235,7 +240,7 @@ export default {
       // 选中当前
       zone.selected = true;
       this.curZoneItem = zone;
-      this.type = 2;
+      this.zoneDisable = false;
       this.view.fitSelectedToView();
     },
     // 父组件调用
@@ -286,6 +291,7 @@ export default {
           })
           this.scene.addSceneMark(newArr)
         }
+        this.scene.isSpaceSelectable = false;
         // 绘制业务空间
         that.getBusinessSpace();
         that.view.fitSceneToView();
@@ -363,7 +369,7 @@ export default {
           if (this.type == 3) {
             this.scene.clearSpaceSelection();
           }
-          this.type = 2;
+          this.zoneDisable = false;
           this.curZoneItem = item;
           this.scene.clearZoneSelection();
           item.selected = true;
@@ -376,6 +382,7 @@ export default {
       this.config.isEdit = true;
       this.config.groupSelect = false;
       this.config.divide = true;
+      this.scene.isSpaceSelectable = true;
       // 设置业务空间不可选
       this.scene.isZoneSelectable = false
     },
@@ -475,16 +482,30 @@ export default {
     },
     // 创建新的业务空间-弹窗返回确认创建
     createRoom(val) {
-      let arr = this.scene.getSelectedSpaces();
       let zoneObj = { Outline: [], Height: 0 }, IspaceIdList = [];
-      arr.map(t => {
+      let selectSpaces = this.scene.getSelectedSpaces();
+      selectSpaces.map(t => {
         zoneObj.Outline.push(t.data.OutLine);
         IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
-        console.log(zoneObj.Height)
         if (t.data.Height && (zoneObj.Height == 0 || t.data.Height < zoneObj.Height)) {
           zoneObj.Height = t.data.Height;
         }
       })
+      // 如果有划分,求交集
+      if (this.scene.cutItem) {
+        zoneObj.Outline = [];
+        let arr = this.scene.getIntersect();
+        arr.map(t => {
+          let temp = t.map(item => {
+            return {
+              X: item.x,
+              Y: -item.y,
+              Z: 0
+            }
+          })
+          zoneObj.Outline.push([temp]);
+        })
+      }
       zoneObj.RoomLocalName = val;
       zoneObj.BuildingId = this.buildFloor[0];
       zoneObj.FloorId = this.buildFloor[1];
@@ -514,31 +535,66 @@ export default {
     },
     // 重新划分业务空间
     refactorBSP() {
+      this.config.isEdit = true;
+      this.config.groupSelect = false;
+      this.config.divide = true;
       this.type = 4;
-      // 清空选中空间
-      this.scene.clearSpaceSelection();
       // 设置空间可选
       this.scene.isSpaceSelectable = true;
       // 将已关联的设置不可选,并将当前选的隐藏
       this.scene.isZoneSelectable = false;
       this.curZoneItem.visible = false;
+      // 将当前业务空间的每个元素添加到场景中并选中
+      this.scene.addAllLikeSpace(this.curZoneItem.data.OutLine);
     },
     // 重新划分--保存
     saveRefactorBSP() {
-      let arr = this.scene.getSelectedSpaces();
+      let selectSpace = this.scene.getSelectedSpaces();
+      let selectLikeSpace = this.scene.getSelectedLikeSpace();
       //更新业务空间
       let zoneObj = { Outline: [], Height: 0 }, IspaceIdList = [];
-      arr.map(t => {
+      // 空间
+      selectSpace.map(t => {
         zoneObj.Outline.push(t.data.OutLine);
         IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
         if (t.Height && (zoneObj.Height == 0 || t.Height < zoneObj.Height)) {
           zoneObj.Height = t.Height;
         }
       })
-      zoneObj.RoomID = this.curZoneItem.data.RoomID;
+      // 类空间
+      selectLikeSpace.map(t => {
+        zoneObj.Outline.push(t.data);
+      })
+      // 如果有划分,求交集
+      if (this.scene.cutItem) {
+        zoneObj.Outline = [];
+        let spaceIntersect = this.scene.getIntersect();
+        spaceIntersect.map(t => {
+          let temp = t.map(item => {
+            return {
+              X: item.x,
+              Y: -item.y,
+              Z: 0
+            }
+          })
+          zoneObj.Outline.push([temp]);
+        })
+        let likeSpaceIntersect = this.scene.getLikeIntersect();
+        likeSpaceIntersect.map(t => {
+          let temp = t.map(item => {
+            return {
+              X: item.x,
+              Y: -item.y,
+              Z: 0
+            }
+          })
+          zoneObj.Outline.push([temp]);
+        })
+      }
       if (!zoneObj.Outline.length) {
         zoneObj.Outline = null;
       }
+      zoneObj.RoomID = this.curZoneItem.data.RoomID;
       this.updateBSPOutline(zoneObj, IspaceIdList)
     },
     // 批量创建所选业务空间
@@ -682,11 +738,11 @@ export default {
     },
     // 切割划分
     divide() {
-      this.scene.isMarking = true;
+      this.scene.isCutting = true;
     },
     // 清除切割划分
     clearDivide() {
-      this.scene.clearSceneMark()
+      this.scene.clearCut();
     },
     // 撤销
     undo() {
@@ -731,7 +787,16 @@ export default {
           this.$refs.canvasFun.active = '';
         }
       }
-    }
+    },
+    "scene.isCutting": {
+      handler(n) {
+        if (!n) {
+          this.$refs.canvasFun.active = '';
+          this.$refs.canvasFun.isSwitch = false;
+          this.scene.isAbsorbing = false;
+        }
+      }
+    },
   }
 }
 </script>
@@ -757,7 +822,8 @@ export default {
       width: 320px;
       margin-right: 10px;
     }
-    .button-group button {
+    .button-group button,
+    .button-group .el-dropdown {
       display: block;
       float: left;
     }