Explorar o código

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

LXXXY %!s(int64=5) %!d(string=hai) anos
pai
achega
77f08e41b7

+ 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.400"
+        "@saga-web/cad-engine": "2.0.406"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 40 - 14
src/components/business_space/newGraphy/graphy.vue

@@ -302,12 +302,6 @@ export default {
         }
       })
     },
-    // 清空绘制业务空间
-    clearZoneCanvas() {
-      this.zoneList.map(t => {
-        this.scene.removeItem(t);
-      })
-    },
     // 获取当前分区下的业务空间
     getBusinessSpace() {
       this.canvasLoading = true
@@ -341,8 +335,7 @@ export default {
             Color: colorArr[i % colorArr.length],
           }
         })
-        this.clearZoneCanvas();
-        this.scene.zoneList = [];
+        this.scene.removeAllZone();
         this.scene.addZoneList(tempArr);
         this.scene.click(this, this.canvasClick);
         this.zoneList = this.scene.zoneList;
@@ -486,13 +479,15 @@ export default {
       let selectSpaces = this.scene.getSelectedSpaces();
       selectSpaces.map(t => {
         zoneObj.Outline.push(t.data.OutLine);
-        IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        if (this.BIMIDToSID[t.data.SourceId]) {
+          IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        }
         if (t.data.Height && (zoneObj.Height == 0 || t.data.Height < zoneObj.Height)) {
           zoneObj.Height = t.data.Height;
         }
       })
       // 如果有划分,求交集
-      if (this.scene.cutItem) {
+      if (this.scene.cutItem || this.scene.sceneMark) {
         zoneObj.Outline = [];
         let arr = this.scene.getIntersect();
         arr.map(t => {
@@ -506,6 +501,9 @@ export default {
           zoneObj.Outline.push([temp]);
         })
       }
+      if (!zoneObj.Outline.length) {
+        zoneObj.Outline = null;
+      }
       zoneObj.RoomLocalName = val;
       zoneObj.BuildingId = this.buildFloor[0];
       zoneObj.FloorId = this.buildFloor[1];
@@ -518,7 +516,9 @@ export default {
       let arr = this.scene.getSelectedSpaces(), IspaceIdList = [];
       arr.map(t => {
         BSP.Outline.push(t.data.OutLine);
-        IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        if (this.BIMIDToSID[t.data.SourceId]) {
+          IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        }
         if (t.Height && (BSP.Height == 0 || t.Height < BSP.Height)) {
           BSP.Height = t.Height;
         }
@@ -556,7 +556,9 @@ export default {
       // 空间
       selectSpace.map(t => {
         zoneObj.Outline.push(t.data.OutLine);
-        IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        if (this.BIMIDToSID[t.data.SourceId]) {
+          IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
+        }
         if (t.Height && (zoneObj.Height == 0 || t.Height < zoneObj.Height)) {
           zoneObj.Height = t.Height;
         }
@@ -566,7 +568,7 @@ export default {
         zoneObj.Outline.push(t.data);
       })
       // 如果有划分,求交集
-      if (this.scene.cutItem) {
+      if (this.scene.cutItem || this.scene.sceneMark) {
         zoneObj.Outline = [];
         let spaceIntersect = this.scene.getIntersect();
         spaceIntersect.map(t => {
@@ -644,6 +646,10 @@ export default {
     },
     // 批量创建
     groupCreateBSP(spaces) {
+      spaces = spaces.map(t => {
+        t.BIMLocation = this.getAverageVal(t.Outline);
+        return t;
+      })
       let pa = {
         zone: this.tab.code,
         data: {
@@ -664,6 +670,7 @@ export default {
     },
     // 单个创建
     createSingleBSP(space, IspaceIdList) {
+      space.BIMLocation = space.Outline ? this.getAverageVal(space.Outline) : null;
       let pa = {
         zone: this.tab.code,
         data: {
@@ -676,11 +683,12 @@ export default {
     },
     // 更新业务空间区域
     updateBSPOutline(zoneObj, IspaceIdList) {
+      zoneObj.BIMLocation = zoneObj.Outline ? this.getAverageVal(zoneObj.Outline) : null;
       let pa = {
         zone: this.tab.code,
         data: {
           Content: [zoneObj],
-          Projection: ['Outline']
+          Projection: ['Outline', 'BIMLocation']
         },
       }
       updateZone(pa, res => {
@@ -699,6 +707,24 @@ export default {
         this.num = res.Count;
       })
     },
+    // 计算平均值 作为业务空间BIMLocation
+    getAverageVal(Outline) {
+      let X = 0, Y = 0, Z = 0, len = 0;
+      Outline.map(t => {
+        if (t[0]) {
+          t[0].map(item => {
+            X += item.X;
+            Y += item.Y;
+            Z += item.Z;
+          })
+          len += t[0].length
+        }
+      })
+      X = (X / len).toFixed(2);
+      Y = (Y / len).toFixed(2);
+      Z = (Z / len).toFixed(2);
+      return `${X},${Y},${Z}`
+    },
     // canvas 获取焦点
     focus() {
       document.getElementById(`floorCanvas`).focus()

+ 3 - 1
src/components/ledger/handsontables/system.vue

@@ -557,7 +557,9 @@ export default {
           }
           return false
         case 'BuildingFloorInfoList':
-          this.$refs.editFloor.showDialog(this.tableData[row.row]);
+          if (!this.onlyRead) {
+            this.$refs.editFloor.showDialog(this.tableData[row.row]);
+          }
           return false
         default:
           break;