瀏覽代碼

fix outline point tofixed 2 add group create bsp

haojianlong 5 年之前
父節點
當前提交
fb02082cb2

+ 5 - 0
src/api/scan/request.js

@@ -1409,4 +1409,9 @@ export function getIspNotInSpace(param, success) {
 export function createRelateInZoneAndISp(param, success) {
     let url = `${baseUrl}/datacenter/si-in-sp-base/link-sp?type=${param.type}`;
     http.postJson(url, param.data, success)
+}
+//关系-----业务空间内的元空间,创建业务空间内的元空间关系, 累计添加不会覆盖-批量关联
+export function groupCreRelaZoneAndISp(param, success) {
+    let url = `${baseUrl}/datacenter/si-in-sp-base/link-list?type=${param.type}`;
+    http.postJson(url, param.data, success)
 }

+ 33 - 12
src/components/business_space/newGraphy/graphy.vue

@@ -78,7 +78,8 @@ import {
   updateZone,
   createZone,
   getIspNotInSpace,
-  createRelateInZoneAndISp
+  createRelateInZoneAndISp,
+  groupCreRelaZoneAndISp
 } from "@/api/scan/request"
 const colorArr = [
   "#F9C3C3",
@@ -122,6 +123,7 @@ export default {
       curOutline: [],
       BIMIDToSID: {}, //bimid映射元空间id
       curZoneItem: {}, //当前选中的业务空间item
+      allUnRelatISP: [], //
     }
   },
   computed: {
@@ -210,8 +212,9 @@ export default {
         },
         objectType: this.tab.code
       }
+      this.allUnRelatISP = []
       getIspNotInSpace(pa, res => {
-        console.log(res)
+        this.allUnRelatISP = res.Content;
       })
     },
     // 获取底图
@@ -314,16 +317,16 @@ export default {
     // 批量创建业务空间
     groupCreateBSpace() {
       let text = []
-      let Spaces = this.scene.spaceList.map(t => {
-        text.push(t.data.Name)
+      let Spaces = this.allUnRelatISP.map(t => {
+        text.push(t.RoomLocalName || t.RoomName)
         return {
-          RoomLocalName: t.data.Name,
-          Outline: [t.data.OutLine]
+          IspaceId: t.RoomID,
+          RoomLocalName: t.RoomLocalName || t.RoomName,
+          Outline: [t.Outline],
+          BuildingId: this.buildFloor[0],
+          FloorId: this.buildFloor[1]
         }
       });
-      console.log(Spaces)
-      console.log(this.scene.spaceList)
-      // return
       this.$confirm(
         "<p>确定根据未关联业务空间的空间批量创建业务空间</p>" +
         "<p>涉及的空间:</p>" +
@@ -337,15 +340,33 @@ export default {
         type: "warning"
       }
       ).then(() => {
-        console.log()
         let pa = {
-          zone: this.zoneCode,
+          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()
+          })
         })
       }).catch(() => {
         this.$message({

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

@@ -163,7 +163,12 @@ export default {
         Filters: `parentId = 'Space'`
       }
       queryDictionaryHead(pa, res => {
-        this.tabsList = res.Content;
+        this.tabsList = res.Content.map(t => {
+          if (t.Name == "元空间") {
+            return undefined;
+          }
+          return t;
+        }).filter(item => item);
         if (this.childBackParam.zone) {
           this.activeName = this.childBackParam.zone;
           this.buildFloorSelectd = [this.childBackParam.BuildingId, this.childBackParam.FloorId];

+ 19 - 10
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -51,18 +51,27 @@ export default {
     },
     // 确认保存
     confirm() {
-      let sceneMark = this.$refs.drawFloor.drawMainScene.sceneMark;
-      if (!sceneMark || sceneMark.outLine.length < 3) {
-        this.$message.warning('请添加轮廓线');
-        return;
-      }
-      if (!sceneMark.closeFlag) {
-        this.$message.warning('请按回车闭合轮廓线');
-        this.$refs.drawFloor.focus();
-        return;
+      let sceneMark = this.$refs.drawFloor.drawMainScene.sceneMark, Outline = null;
+      if (sceneMark) {
+        if (sceneMark.outLine.length < 3) {
+          this.$message.warning('请添加轮廓线');
+          return;
+        }
+        if (!sceneMark.closeFlag) {
+          this.$message.warning('请按回车闭合轮廓线');
+          this.$refs.drawFloor.focus();
+          return;
+        }
+        Outline = this.$refs.drawFloor.drawMainScene.sceneMark.outLine
+        Outline = Outline.map(t => {
+          return {
+            x: t.x.toFixed(2),
+            y: t.y.toFixed(2),
+          }
+        })
       }
       let pa = {
-        Content: [{ FloorID: this.FloorID, Outline: this.$refs.drawFloor.drawMainScene.sceneMark.outLine }],
+        Content: [{ FloorID: this.FloorID, Outline: Outline }],
         Projection: ['Outline']
       }
       floorUpdate(pa, res => {