Prechádzať zdrojové kódy

修改平面图业务逻辑

haojianlong 5 rokov pred
rodič
commit
f9be51f29f

+ 30 - 18
src/components/business_space/newGraphy/graphy.vue

@@ -103,7 +103,7 @@
         <el-button size="small" type="primary" @click="confirm">确认</el-button>
       </span>
     </el-dialog>
-    <dialogZone ref="zone" @createSuccess="getOhterType" />
+    <dialogZone ref="zone" @createSuccess="getOtherType" />
   </div>
 </template>
 <script>
@@ -137,8 +137,6 @@ export default {
   },
   data() {
     return {
-      zoneValue: '',
-      addZone: [],
       canvasWidth: 800,
       canvasHeight: 600,
       type: 1, // 默认操作模式
@@ -286,14 +284,19 @@ export default {
       if (tab.code == "OtherZone") {
         // 其他分区
         this.showOtherFlag = true
-        this.getOhterType();
+        this.getOtherType();
+        if (this.scene) {
+          this.scene.removeAllZone();
+          this.zoneList = this.scene.zoneList;
+          this.view._needDraw = true;
+        }
       } else {
         this.showOtherFlag = false;
         this.init(initType);
       }
     },
     // 其他分区类型查询
-    getOhterType() {
+    getOtherType() {
       let pa = {
         Cascade: [{ Name: 'zoneType' }],
         Filters: `Code="OtherZone"`
@@ -312,7 +315,7 @@ export default {
     },
     // 其他类型下拉change
     changeOtherZone(val) {
-      console.log(val)
+      this.init(2);
     },
     // 获取未绑定业务空间的元空间
     getISPSPUnrelaBSP() {
@@ -321,7 +324,7 @@ export default {
           Filters: `FloorId='${this.buildFloor[1]}'`,
           PageSize: 1000
         },
-        objectType: this.tab.code
+        objectType: this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code
       }
       this.allUnRelatISP = []
       getIspNotInSpace(pa, res => {
@@ -360,13 +363,14 @@ export default {
       })
     },
     // 获取当前分区下的业务空间
-    getBusinessSpace() {
+    getBusinessSpace(other) {
       this.canvasLoading = true
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       let pa = {
-        ZoneType: this.tab.code,
+        ZoneType: ObjectType,
         Filters: `not RoomID isNull`,
         Orders: "createTime desc, RoomID asc",
-        PageSize: 1000
+        PageSize: 10000
       }
       if (this.buildFloor.length && this.buildFloor.length > 1) {
         pa.BuildingId = this.buildFloor[0];
@@ -383,8 +387,9 @@ export default {
           }
         })
         // 绘制业务空间
+        let tempType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
         let tempArr = this.BSPRelaISPList.map((t, i) => {
-          if (t.FloorId == this.buildFloor[1] && t.ObjectType == this.tab.code) {
+          if (t.FloorId == this.buildFloor[1] && t.ObjectType == tempType) {
             return {
               RoomLocalName: t.RoomLocalName,
               OutLine: t.Outline,
@@ -718,10 +723,11 @@ export default {
     },
     // 确认业务空间
     confirmZoneSpace() {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       let space = {
         RoomID: this.curZoneItem.data.RoomID,
         State: 0,
-        ObjectType: this.tab.code
+        ObjectType: ObjectType
       }
       let pa = {
         Content: [space],
@@ -912,9 +918,10 @@ export default {
     },
     // 更新业务空间和元空间的关系
     relationInBSPandISP(SpaceId, IspaceIdList) {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       let pa = {
         data: { SpaceId: SpaceId, IspaceIdList: IspaceIdList },
-        type: this.tab.code
+        type: ObjectType
       }
       createRelateInZoneAndISp(pa, res => {
         this.$message.success('创建成功');
@@ -930,12 +937,13 @@ export default {
     // 批量更新业务空间和元空间的关系
     groupCreRelaZoneAndISp(Spaces) {
       Spaces = Spaces.filter(item => item.IspaceId);
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       if (Spaces.length) {
         let param = {
           data: {
             Content: Spaces
           },
-          type: this.tab.code
+          type: ObjectType
         }
         groupCreRelaZoneAndISp(param, res => {
           this.$message.success('创建成功')
@@ -950,8 +958,9 @@ export default {
     },
     // 批量创建
     groupCreateBSP(spaces) {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       spaces = spaces.map(t => {
-        t.ObjectType = this.tab.code;
+        t.ObjectType = ObjectType;
         t.BIMLocation = this.getAverageVal(t.Outline);
         return t;
       })
@@ -972,8 +981,9 @@ export default {
     },
     // 单个创建
     createSingleBSP(space, IspaceIdList) {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       space.BIMLocation = space.Outline ? this.getAverageVal(space.Outline) : null;
-      space.ObjectType = this.tab.code;
+      space.ObjectType = ObjectType;
       let pa = {
         Content: [space]
       }
@@ -983,8 +993,9 @@ export default {
     },
     // 更新业务空间区域
     updateBSPOutline(zoneObj, IspaceIdList) {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       zoneObj.BIMLocation = zoneObj.Outline ? this.getAverageVal(zoneObj.Outline) : null;
-      zoneObj.ObjectType = this.tab.code;
+      zoneObj.ObjectType = ObjectType;
       let pa = {
         Content: [zoneObj]
       }
@@ -994,8 +1005,9 @@ export default {
     },
     // 查询未关联平面图的业务空间(项目下+当前分区)
     getBSPunrelaISP() {
+      let ObjectType = this.tab.code == 'OtherZone' ? this.OtherValue : this.tab.code;
       let pa = {
-        Filters: `Outline isNull;ObjectType="${this.tab.code}"`
+        Filters: `Outline isNull;ObjectType="${ObjectType}"`
       }
       zoneCount(pa, res => {
         this.num = res.Count;