|
@@ -49,6 +49,11 @@
|
|
|
<el-button plain @click="cancelGraphy">取 消</el-button>
|
|
|
<el-button type="primary" @click="saveRefactorBSP">保存</el-button>
|
|
|
</div>
|
|
|
+ <!-- 批量创建所选业务空间 -->
|
|
|
+ <div v-show="type==5">
|
|
|
+ <el-button type="primary" @click="groupCreateZone">批量创建所选业务空间</el-button>
|
|
|
+ <el-button plain @click="cancelGraphy">取 消</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div style="position: absolute;right: 0;">
|
|
|
<el-button type="text" @click="lookUnrelatBSpace(false)">未关联平面图的业务空间 {{num}} 条</el-button>
|
|
@@ -56,8 +61,8 @@
|
|
|
</el-row>
|
|
|
<!-- 底部操作按钮 -->
|
|
|
<el-row class="canvas-actions-box">
|
|
|
- <canvasFun @move="moveCanvas" @fit="fit" @savePng="savePng" @saveSvg="saveSvg" @divide="divide" @clearDivide="clearDivide" @undo="undo"
|
|
|
- @redo="redo" @scale="scale" :isEdit="isEdit" ref="canvasFun"></canvasFun>
|
|
|
+ <canvasFun @fit="fit" @savePng="savePng" @saveSvg="saveSvg" @divide="divide" @clearDivide="clearDivide" @undo="undo" @redo="redo"
|
|
|
+ @changeAbsorb="changeAbsorb" @scale="scale" @groupSelect="groupSelect" :config="config" ref="canvasFun" @saveJson="saveJson"></canvasFun>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<!-- -->
|
|
@@ -130,7 +135,11 @@ export default {
|
|
|
FloorObj: {}, //楼层对象
|
|
|
FloorMap: '', //楼层底图
|
|
|
tab: {},
|
|
|
- isEdit: false,
|
|
|
+ config: {
|
|
|
+ isEdit: false,
|
|
|
+ divide: true,
|
|
|
+ groupSelect: true
|
|
|
+ },
|
|
|
canvasLoading: false,
|
|
|
view: null,
|
|
|
scene: null,
|
|
@@ -178,6 +187,11 @@ export default {
|
|
|
// 业务空间
|
|
|
this.getBusinessSpace();
|
|
|
}
|
|
|
+ this.config = {
|
|
|
+ isEdit: false,
|
|
|
+ divide: true,
|
|
|
+ groupSelect: true
|
|
|
+ }
|
|
|
// 获取当前楼层的元空间
|
|
|
this.getFloorISpace();
|
|
|
// 查询未关联业务空间的元空间
|
|
@@ -223,6 +237,7 @@ export default {
|
|
|
this.scene.clearZoneSelection();
|
|
|
// 选中当前
|
|
|
zone.selected = true;
|
|
|
+ this.curZoneItem = zone;
|
|
|
this.type = 2;
|
|
|
this.view.fitSelectedToView();
|
|
|
},
|
|
@@ -333,18 +348,26 @@ export default {
|
|
|
},
|
|
|
// canvas点击事件
|
|
|
canvasClick(item, event) {
|
|
|
- if (this.type == 4) {
|
|
|
+ console.log(item)
|
|
|
+ console.log(event)
|
|
|
+ if (this.type == 4) {//重新划分
|
|
|
+
|
|
|
+ } else if (this.type == 5) {//批量
|
|
|
|
|
|
} else {
|
|
|
if (item instanceof SpaceItem && item.selectable) {
|
|
|
+ if (this.type == 2) {
|
|
|
+ this.scene.clearZoneSelection();
|
|
|
+ }
|
|
|
this.type = 3;
|
|
|
this.curZoneItem = {};
|
|
|
- this.scene.isZoneSelectable = false;
|
|
|
}
|
|
|
if (item instanceof ZoneItem && item.selectable) {
|
|
|
+ if (this.type == 3) {
|
|
|
+ this.scene.clearSpaceSelection();
|
|
|
+ }
|
|
|
this.type = 2;
|
|
|
this.curZoneItem = item;
|
|
|
- this.scene.isSpaceSelectable = false;
|
|
|
this.scene.clearZoneSelection();
|
|
|
item.selected = true;
|
|
|
}
|
|
@@ -353,6 +376,11 @@ export default {
|
|
|
// 编辑平面图
|
|
|
editGraphy() {
|
|
|
this.type = 3;
|
|
|
+ this.config.isEdit = true;
|
|
|
+ this.config.groupSelect = false;
|
|
|
+ this.config.divide = true;
|
|
|
+ // 设置业务空间不可选
|
|
|
+ this.scene.isZoneSelectable = false
|
|
|
},
|
|
|
// 查看未关联的业务空间--flag--查看-or-选择
|
|
|
lookUnrelatBSpace(flag) {
|
|
@@ -377,7 +405,17 @@ export default {
|
|
|
if (this.groupCreateType == 1) {
|
|
|
this.groupCreateBSpace()
|
|
|
} else if (this.groupCreateType == 2) {
|
|
|
-
|
|
|
+ this.type = 5;
|
|
|
+ this.config.isEdit = true;
|
|
|
+ this.config.groupSelect = true;
|
|
|
+ this.config.divide = false;
|
|
|
+ this.groupCreateDialogVis = false;
|
|
|
+ // 清空选中空间
|
|
|
+ this.scene.clearSpaceSelection();
|
|
|
+ // 设置空间可选
|
|
|
+ this.scene.isSpaceSelectable = true;
|
|
|
+ // 设置业务空间不可选
|
|
|
+ this.scene.isZoneSelectable = false;
|
|
|
}
|
|
|
},
|
|
|
// 批量创建业务空间
|
|
@@ -412,34 +450,9 @@ export default {
|
|
|
type: "warning"
|
|
|
}
|
|
|
).then(() => {
|
|
|
- let pa = {
|
|
|
- zone: this.tab.code,
|
|
|
- data: {
|
|
|
- Content: Spaces
|
|
|
- }
|
|
|
- }
|
|
|
+ this.groupCreateDialogVis = false;
|
|
|
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(2)
|
|
|
- })
|
|
|
- })
|
|
|
+ this.groupCreateBSP(Spaces)
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: "info",
|
|
@@ -478,38 +491,21 @@ export default {
|
|
|
zoneObj.RoomLocalName = val;
|
|
|
zoneObj.BuildingId = this.buildFloor[0];
|
|
|
zoneObj.FloorId = this.buildFloor[1];
|
|
|
- let pa = {
|
|
|
- zone: this.tab.code,
|
|
|
- data: {
|
|
|
- Content: [zoneObj]
|
|
|
- }
|
|
|
- }
|
|
|
- createZone(pa, res => {
|
|
|
- this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
|
|
|
- })
|
|
|
+ this.createSingleBSP(zoneObj, IspaceIdList)
|
|
|
},
|
|
|
// 从未关联平面图的业务空间中选择--按钮返回关联信号
|
|
|
createFromUnrelated(BSP) {
|
|
|
BSP.Outline = [];
|
|
|
BSP.Height = 0;
|
|
|
- let arr = this.scene.getSelectedSpaces();
|
|
|
+ let arr = this.scene.getSelectedSpaces(), IspaceIdList = [];
|
|
|
arr.map(t => {
|
|
|
BSP.Outline.push(t.data.OutLine);
|
|
|
+ IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
if (t.Height && (BSP.Height == 0 || t.Height < BSP.Height)) {
|
|
|
BSP.Height = t.Height;
|
|
|
}
|
|
|
})
|
|
|
- let pa = {
|
|
|
- zone: BSP.ObjectType,
|
|
|
- data: {
|
|
|
- Content: [BSP],
|
|
|
- Projection: ['Outline']
|
|
|
- }
|
|
|
- }
|
|
|
- updateZone(pa, res => {
|
|
|
- this.$message.success('更新成功');
|
|
|
- this.init(2);
|
|
|
- })
|
|
|
+ this.updateBSPOutline(BSP, IspaceIdList)
|
|
|
},
|
|
|
// 编辑空间详情
|
|
|
editeSpaceDetail() {
|
|
@@ -527,7 +523,8 @@ export default {
|
|
|
// 设置空间可选
|
|
|
this.scene.isSpaceSelectable = true;
|
|
|
// 将已关联的设置不可选,并将当前选的隐藏
|
|
|
- this.scene.changeSelectZone(this.curZoneItem);
|
|
|
+ this.scene.isZoneSelectable = false;
|
|
|
+ this.curZoneItem.visible = false;
|
|
|
},
|
|
|
// 重新划分--保存
|
|
|
saveRefactorBSP() {
|
|
@@ -545,16 +542,27 @@ export default {
|
|
|
if (!zoneObj.Outline.length) {
|
|
|
zoneObj.Outline = null;
|
|
|
}
|
|
|
- let pa = {
|
|
|
- zone: this.tab.code,
|
|
|
- data: {
|
|
|
- Content: [zoneObj],
|
|
|
- Projection: ['Outline']
|
|
|
- },
|
|
|
- }
|
|
|
- updateZone(pa, res => {
|
|
|
- this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
|
|
|
+ this.updateBSPOutline(zoneObj, IspaceIdList)
|
|
|
+ },
|
|
|
+ // 批量创建所选业务空间
|
|
|
+ groupCreateZone() {
|
|
|
+ let arr = this.scene.getSelectedSpaces();
|
|
|
+ let spaces = arr.map(t => {
|
|
|
+ return {
|
|
|
+ IspaceId: this.BIMIDToSID[t.data.SourceId],
|
|
|
+ RoomLocalName: t.data.Name,
|
|
|
+ Outline: [t.data.OutLine],
|
|
|
+ BuildingId: this.buildFloor[0],
|
|
|
+ FloorId: this.buildFloor[1],
|
|
|
+ Height: t.data.Height || 0
|
|
|
+ }
|
|
|
})
|
|
|
+ if (spaces.length) {
|
|
|
+ this.canvasLoading = true;
|
|
|
+ this.groupCreateBSP(spaces)
|
|
|
+ } else {
|
|
|
+ this.$message.warning('未选择空间');
|
|
|
+ }
|
|
|
},
|
|
|
// 更新业务空间和元空间的关系
|
|
|
relationInBSPandISP(SpaceId, IspaceIdList) {
|
|
@@ -567,6 +575,65 @@ export default {
|
|
|
this.init(2);
|
|
|
})
|
|
|
},
|
|
|
+ // 批量更新业务空间和元空间的关系
|
|
|
+ groupCreRelaZoneAndISp(Spaces) {
|
|
|
+ let param = {
|
|
|
+ data: {
|
|
|
+ Content: Spaces
|
|
|
+ },
|
|
|
+ type: this.tab.code
|
|
|
+ }
|
|
|
+ groupCreRelaZoneAndISp(param, res => {
|
|
|
+ this.$message.success('创建成功')
|
|
|
+ this.canvasLoading = false;
|
|
|
+ this.init(2)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 批量创建
|
|
|
+ groupCreateBSP(spaces) {
|
|
|
+ let pa = {
|
|
|
+ zone: this.tab.code,
|
|
|
+ data: {
|
|
|
+ Content: spaces
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createZone(pa, res => {
|
|
|
+ res.EntityList.map(t => {
|
|
|
+ spaces = spaces.map(item => {
|
|
|
+ if (t.RoomLocalName == item.RoomLocalName) {
|
|
|
+ item.SpaceId = t.RoomID
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.groupCreRelaZoneAndISp(spaces)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 单个创建
|
|
|
+ createSingleBSP(space, IspaceIdList) {
|
|
|
+ let pa = {
|
|
|
+ zone: this.tab.code,
|
|
|
+ data: {
|
|
|
+ Content: [space]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createZone(pa, res => {
|
|
|
+ this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 更新业务空间区域
|
|
|
+ updateBSPOutline(zoneObj, IspaceIdList) {
|
|
|
+ let pa = {
|
|
|
+ zone: this.tab.code,
|
|
|
+ data: {
|
|
|
+ Content: [zoneObj],
|
|
|
+ Projection: ['Outline']
|
|
|
+ },
|
|
|
+ }
|
|
|
+ updateZone(pa, res => {
|
|
|
+ this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
|
|
|
+ })
|
|
|
+ },
|
|
|
// 查询未关联平面图的业务空间(项目下+当前分区)
|
|
|
getBSPunrelaISP() {
|
|
|
let pa = {
|
|
@@ -592,15 +659,13 @@ export default {
|
|
|
this.view = new FloorView('floorCanvas')
|
|
|
},
|
|
|
// 工具栏操作
|
|
|
- // 移动底图
|
|
|
- moveCanvas(move) {
|
|
|
- // todo
|
|
|
- let canvas = document.getElementById(`floorCanvas`);
|
|
|
- if (move) {
|
|
|
- canvas.style.cursor = 'move';
|
|
|
- } else {
|
|
|
- canvas.style.cursor = 'default';
|
|
|
- }
|
|
|
+ // 吸附
|
|
|
+ changeAbsorb(isAbsorbing) {
|
|
|
+ this.scene.isAbsorbing = isAbsorbing;
|
|
|
+ },
|
|
|
+ // 框选
|
|
|
+ groupSelect() {
|
|
|
+ this.scene.isRectSelection = true;
|
|
|
},
|
|
|
// 适配底图到窗口
|
|
|
fit() {
|
|
@@ -614,6 +679,14 @@ export default {
|
|
|
saveSvg() {
|
|
|
this.view.saveSceneSvg(`${this.buildFloor[1]}.svg`, 6400, 4800);
|
|
|
},
|
|
|
+ // 保存为svg
|
|
|
+ saveSvg() {
|
|
|
+ this.view.saveSceneSvg(`${this.buildFloor[1]}.svg`, 6400, 4800);
|
|
|
+ },
|
|
|
+ // 保存json
|
|
|
+ saveJson() {
|
|
|
+ this.view.saveFloorJson(`${this.buildFloor[1]}.json`)
|
|
|
+ },
|
|
|
// 切割划分
|
|
|
divide() {
|
|
|
this.scene.isMarking = true;
|