Przeglądaj źródła

Merge branch 'master' of git.sagacloud.cn:web/ibms

zhangyu 5 lat temu
rodzic
commit
07b451c569
1 zmienionych plików z 83 dodań i 23 usunięć
  1. 83 23
      src/views/business_space/dataUtil/index2.vue

+ 83 - 23
src/views/business_space/dataUtil/index2.vue

@@ -1,7 +1,15 @@
 <template>
   <div class="main-box">
     <div class="saga-build-mess">
-      <el-button @click="queryZone">导入业务空间BIMLocation</el-button>
+      <h4>接口基于数据中心,数据更改基于已创建业务空间本身数据计算而得,有轮廓线即可写入BIMLocation,处理单位是毫米的高度为米</h4>
+      <el-checkbox-group v-model="checkTypeList">
+        <el-checkbox v-for="item in tabsList" :label="item.Code" :key="item.Rel_type">{{item.Name}}</el-checkbox>
+      </el-checkbox-group>
+      <el-checkbox-group v-model="checkDataList">
+        <el-checkbox label="BIMLocation">根据业务空间轮廓线计算得</el-checkbox>
+        <el-checkbox label="Height">根据<b>业务空间或元空间</b>本身高度超过100,则/1000(如果本身没有高度或小于100不会处理)</el-checkbox>
+      </el-checkbox-group>
+      <el-button @click="queryZone">导入业务空间选中的数据</el-button>
     </div>
   </div>
 </template>
@@ -77,8 +85,32 @@ export default {
           "Name": '功能分区',
           'Rel_type': '11',
           "Code": 'FunctionZone'
-        }
+        },
+        {
+          "Name": '元空间',
+          "Code": 'Ispace',
+          "Rel_type": '--'
+        },
       ],
+      checkDataList: ['BIMLocation'],
+      checkTypeList: ['GeneralZone', 'PowerSupplyZone', 'LightingZone', 'NetworkZone', 'AirConditioningZone', 'HeatingZone', 'CleanZone', 'DomesticWaterSupplyZone', 'FireZone', 'SecurityZone', 'TenantZone', 'FunctionZone'],
+      codeToName: {
+        GeneralZone: '默认分区',
+        PowerSupplyZone: '供电分区',
+        LightingZone: '照明分区',
+        NetworkZone: '网络分区',
+        AirConditioningZone: '空调分区',
+        HeatingZone: '采暖分区',
+        CleanZone: '洁净分区',
+        DomesticWaterSupplyZone: '生活给水分区',
+        FireZone: '防火分区',
+        SecurityZone: '安防分区',
+        TenantZone: '租户分区',
+        FunctionZone: '功能分区',
+        Ispace: '元空间',
+      },
+      checkAll: false,
+      isIndeterminate: true
     }
   },
   computed: {
@@ -88,8 +120,8 @@ export default {
     init() { },
     // 查询该项目下所有的业务空间
     queryZone() {
-      this.tabsList.map(t => {
-        this.getZone(t.Code, 1, t.Name);
+      this.checkTypeList.map(t => {
+        this.getZone(t, 1, this.codeToName[t]);
       })
     },
     getZone(Code, PageNumber, Name) {
@@ -107,30 +139,58 @@ export default {
           console.log(num)
           this.getZone(Code, num, Name)
         }
-        let params = {
-          data: {
-            Content: [],
-            Projection: ["BIMLocation"]
-          },
-          zone: Code
-        }
-        res.Content.map(t => {
-          if (t.Outline && t.Outline[0]) {
-            t.BIMLocation = this.getAverageVal(t.Outline);
-            let obj = {
-              RoomID: t.RoomID,
-              BIMLocation: t.BIMLocation
+        // 更新BIMLocation
+        if (this.checkDataList.indexOf("BIMLocation") > -1) {
+          let params = {
+            data: {
+              Content: [],
+              Projection: ["BIMLocation"]
+            },
+            zone: Code
+          }
+          res.Content.map(t => {
+            if (t.Outline && t.Outline[0]) {
+              t.BIMLocation = this.getAverageVal(t.Outline);
+              let obj = {
+                RoomID: t.RoomID,
+                BIMLocation: t.BIMLocation
+              }
+              params.data.Content.push(obj);
             }
-            params.data.Content.push(obj);
+          });
+          this.updateZoneData(params, Name)
+        }
+
+        // 更新业务空间Height
+        if (this.checkDataList.indexOf("Height") > -1) {
+          let params2 = {
+            data: {
+              Content: [],
+              Projection: ["Height"]
+            },
+            zone: Code
           }
-        });
-        if (params.data.Content.length) {
-          updateZone(params, res => {
-            console.log(`${this.projectId},${Name},${params.data.Content.length}条更新完成`);
-          })
+          res.Content.map(t => {
+            if (t.Height && t.Height > 100) {
+              t.Height = (t.Height / 1000).toFixed(2);
+              let obj = {
+                RoomID: t.RoomID,
+                Height: t.Height
+              }
+              params2.data.Content.push(obj);
+            }
+          });
+          this.updateZoneData(params2, Name)
         }
       })
     },
+    updateZoneData(param, Name) {
+      if (param.data.Content.length) {
+        updateZone(param, res => {
+          console.log(`${this.projectId},${Name},${param.data.Projection.toString()},${param.data.Content.length}条更新完成`);
+        })
+      }
+    },
     getAverageVal(Outline) {
       let X = 0, Y = 0, Z = 0, len = 0;
       Outline.map(t => {