|
@@ -25,18 +25,24 @@
|
|
|
<div class="button-group">
|
|
|
<!-- 默认操作模式 -->
|
|
|
<div v-show="type==1">
|
|
|
- <el-button @click="editGraphy">编辑平面图</el-button>
|
|
|
+ <el-dropdown split-button type="primary" @click="editGraphy" @command="handleCommand">
|
|
|
+ 创建业务空间
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="groupCreateBSpace">批量创建业务空间</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ <!-- 点击已经关联的业务空间 -->
|
|
|
+ <el-button type="primary" plain @click="refactorBSP" :disabled="zoneDisable" style="margin-left:10px;">重新划分业务空间</el-button>
|
|
|
+ <el-button type="primary" @click="editeSpaceDetail" :disabled="zoneDisable">编辑空间详情</el-button>
|
|
|
+ <el-button plain @click="cancelGraphy" v-show="!zoneDisable">取 消</el-button>
|
|
|
</div>
|
|
|
<!-- 点击已经关联的业务空间 -->
|
|
|
- <div v-show="type==2">
|
|
|
- <el-button type="primary" plain @click="refactorBSP">重新划分业务空间</el-button>
|
|
|
- <el-button type="primary" @click="editeSpaceDetail">编辑空间详情</el-button>
|
|
|
- <el-button plain @click="cancelGraphy">取 消</el-button>
|
|
|
- </div>
|
|
|
+ <!-- <div v-show="type==2">
|
|
|
+ </div> -->
|
|
|
<!-- 点击未关联的业务空间 -->
|
|
|
<div v-show="type==3">
|
|
|
- <el-button plain @click="createNewZone">创建新的业务空间</el-button>
|
|
|
- <el-button type="primary" @click="lookUnrelatBSpace(true)">从未关联平面图的业务空间中选择</el-button>
|
|
|
+ <el-button plain @click="createNewZone">创建单个全新的业务空间</el-button>
|
|
|
+ <el-button plain @click="lookUnrelatBSpace(true)">从未关联平面图的业务空间中选择</el-button>
|
|
|
<el-button plain @click="cancelGraphy">取 消</el-button>
|
|
|
</div>
|
|
|
<!-- 重新划分业务空间 -->
|
|
@@ -44,6 +50,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>
|
|
@@ -51,46 +62,52 @@
|
|
|
</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>
|
|
|
<!-- -->
|
|
|
<!-- 未关联元空间的业务空间 -->
|
|
|
- <unRelateBSP ref="unRelateBSP" :tableData="BSPUnrelaISPList" :isAction="isAction" @createFromUnrelated="createFromUnrelated"></unRelateBSP>
|
|
|
+ <unRelateBSP ref="unRelateBSP" :isAction="isAction" @createFromUnrelated="createFromUnrelated" :code="tab.code"></unRelateBSP>
|
|
|
<!-- 创建新的业务空间 -->
|
|
|
<createBSP ref="createBSP" @createRoom="createRoom"></createBSP>
|
|
|
+ <!-- 批量创建选择弹窗 -->
|
|
|
+ <el-dialog title="提示" :visible.sync="groupCreateDialogVis" width="30%">
|
|
|
+ <div id="autoRelate">
|
|
|
+ <p>请选择批量创建方式:</p>
|
|
|
+ <p>
|
|
|
+ <el-radio v-model="groupCreateType" :label="1">批量将所有的空白空间创建业务空间</el-radio>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-radio v-model="groupCreateType" :label="2">批量选择空白空间创建业务空间</el-radio>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="groupCreateDialogVis=false">取消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="confirm">确认</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import canvasFun from "./canvasFun"
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
import { SColor, SPoint } from "@saga-web/draw/lib";
|
|
|
-import { DivideFloorScene, SpaceItem, ZoneItem } from "@saga-web/cad-engine/lib";
|
|
|
-import { FloorView } from "@saga-web/cad-engine/lib/FloorView";
|
|
|
+import { DivideFloorScene, SpaceItem, ZoneItem, FloorView } from "@saga-web/cad-engine/lib";
|
|
|
+import { colorArr } from "@/utils/spaceColor"
|
|
|
import unRelateBSP from "./unRelateBSP";
|
|
|
import createBSP from "./createBSP";
|
|
|
import {
|
|
|
- countZone,
|
|
|
+ buildingQuery,
|
|
|
queryZone,
|
|
|
updateZone,
|
|
|
createZone,
|
|
|
+ countZone,
|
|
|
getIspNotInSpace,
|
|
|
createRelateInZoneAndISp,
|
|
|
groupCreRelaZoneAndISp
|
|
|
} from "@/api/scan/request"
|
|
|
-const colorArr = [
|
|
|
- "#F9C3C3",
|
|
|
- "#FFD1BF",
|
|
|
- "#FFF3BF",
|
|
|
- "#D8F7C6",
|
|
|
- "#C6F2F6",
|
|
|
- "#DCE3C0",
|
|
|
- "#FAE6C9",
|
|
|
- "#E3D7F7",
|
|
|
- "#C4CBF8",
|
|
|
- "#DEC3F6"
|
|
|
-];
|
|
|
+
|
|
|
// BSP => 业务空间
|
|
|
export default {
|
|
|
components: {
|
|
@@ -104,33 +121,39 @@ export default {
|
|
|
canvasHeight: 600,
|
|
|
type: 1, // 默认操作模式
|
|
|
search: '',//搜索
|
|
|
- num: 0, // 未关联空间的业务空间条数
|
|
|
buildFloor: ['', ''],
|
|
|
FloorObj: {}, //楼层对象
|
|
|
FloorMap: '', //楼层底图
|
|
|
tab: {},
|
|
|
- isEdit: false,
|
|
|
+ config: {
|
|
|
+ isEdit: false,
|
|
|
+ divide: true,
|
|
|
+ groupSelect: true
|
|
|
+ },
|
|
|
canvasLoading: false,
|
|
|
view: null,
|
|
|
scene: null,
|
|
|
Outline: [], // 当前选中的多个空间组成的轮廓线->三维数组
|
|
|
businessSpaceList: [], // 所有业务空间
|
|
|
- BSPUnrelaISPList: [], // 未关联元空间的业务空间
|
|
|
+ num: 0, // 未关联元空间的业务空间统计
|
|
|
BSPRelaISPList: [], // 已关联元空间的业务空间
|
|
|
// 未关联元空间的业务空间弹窗
|
|
|
isAction: false,
|
|
|
curOutline: [],
|
|
|
BIMIDToSID: {}, //bimid映射元空间id
|
|
|
+ BIMIDToSIName: {}, //bimid映射元空间名称
|
|
|
curZoneItem: {}, //当前选中的业务空间item
|
|
|
allUnRelatISP: [], //
|
|
|
zoneList: [], // 业务空间-canvas图中
|
|
|
+ groupCreateDialogVis: false, //批量创建业务空间弹窗
|
|
|
+ groupCreateType: 1, //批量创建方式
|
|
|
+ zoneDisable: true, // 重新划分是否禁用
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters('layout', ['projectId'])
|
|
|
},
|
|
|
- created() {
|
|
|
- },
|
|
|
+ created() {},
|
|
|
mounted() {
|
|
|
this.canvasWidth = this.$refs.graphy.offsetWidth;
|
|
|
this.canvasHeight = this.$refs.graphy.offsetHeight;
|
|
@@ -140,10 +163,13 @@ export default {
|
|
|
init(initType) {
|
|
|
this.type = 1;
|
|
|
if (this.scene) {
|
|
|
- this.scene.isZoneSelectable = true;
|
|
|
- this.scene.isSpaceSelectable = true;
|
|
|
this.scene.clearSpaceSelection();
|
|
|
this.scene.clearZoneSelection();
|
|
|
+ this.scene.clearCut();
|
|
|
+ this.scene.clearLikeSpaces();
|
|
|
+ this.zoneDisable = true;
|
|
|
+ this.scene.isZoneSelectable = true;
|
|
|
+ this.scene.isSpaceSelectable = false;
|
|
|
}
|
|
|
if (this.buildFloor.indexOf('all') > -1 || this.buildFloor.indexOf('noKnow') > -1) {
|
|
|
return;
|
|
@@ -155,12 +181,17 @@ export default {
|
|
|
// 业务空间
|
|
|
this.getBusinessSpace();
|
|
|
}
|
|
|
- // 获取未关联平面图的业务空间统计
|
|
|
- this.getUnrelateCount();
|
|
|
+ this.config = {
|
|
|
+ isEdit: false,
|
|
|
+ divide: true,
|
|
|
+ groupSelect: true
|
|
|
+ }
|
|
|
// 获取当前楼层的元空间
|
|
|
this.getFloorISpace();
|
|
|
// 查询未关联业务空间的元空间
|
|
|
- this.getISPSPUnrelaBSP()
|
|
|
+ this.getISPSPUnrelaBSP();
|
|
|
+ // 查询未关联平面图的业务空间
|
|
|
+ this.getBSPunrelaISP();
|
|
|
},
|
|
|
// 获取当前楼层的元空间
|
|
|
getFloorISpace() {
|
|
@@ -173,8 +204,10 @@ export default {
|
|
|
}
|
|
|
queryZone(pa, res => {
|
|
|
this.BIMIDToSID = {}
|
|
|
+ this.BIMIDToSIName = {}
|
|
|
res.Content.map(t => {
|
|
|
this.BIMIDToSID[t.BIMID.split(":")[1]] = t.RoomID;
|
|
|
+ this.BIMIDToSIName[t.BIMID.split(":")[1]] = t.RoomLocalName || t.RoomName;
|
|
|
})
|
|
|
})
|
|
|
},
|
|
@@ -200,7 +233,8 @@ export default {
|
|
|
this.scene.clearZoneSelection();
|
|
|
// 选中当前
|
|
|
zone.selected = true;
|
|
|
- this.type = 2;
|
|
|
+ this.curZoneItem = zone;
|
|
|
+ this.zoneDisable = false;
|
|
|
this.view.fitSelectedToView();
|
|
|
},
|
|
|
// 父组件调用
|
|
@@ -216,18 +250,6 @@ export default {
|
|
|
console.log(arguments)
|
|
|
this.init(initType);
|
|
|
},
|
|
|
- // 获取未关联平面图的业务空间统计
|
|
|
- getUnrelateCount() {
|
|
|
- let pa = {
|
|
|
- data: {
|
|
|
- Filters: `BuildingId='${this.buildFloor[0]}';FloorId='${this.buildFloor[1]}';Outline isNull`
|
|
|
- },
|
|
|
- zone: this.tab.code
|
|
|
- }
|
|
|
- countZone(pa, res => {
|
|
|
- this.num = res.Count
|
|
|
- })
|
|
|
- },
|
|
|
// 获取未绑定业务空间的元空间
|
|
|
getISPSPUnrelaBSP() {
|
|
|
let pa = {
|
|
@@ -263,6 +285,7 @@ export default {
|
|
|
})
|
|
|
this.scene.addSceneMark(newArr)
|
|
|
}
|
|
|
+ this.scene.isSpaceSelectable = false;
|
|
|
// 绘制业务空间
|
|
|
that.getBusinessSpace();
|
|
|
that.view.fitSceneToView();
|
|
@@ -272,12 +295,6 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 清空绘制业务空间
|
|
|
- clearZoneCanvas() {
|
|
|
- this.zoneList.map(t => {
|
|
|
- this.scene.removeItem(t);
|
|
|
- })
|
|
|
- },
|
|
|
// 获取当前分区下的业务空间
|
|
|
getBusinessSpace() {
|
|
|
this.canvasLoading = true
|
|
@@ -292,31 +309,31 @@ export default {
|
|
|
if (this.buildFloor.length && this.buildFloor.length > 1) {
|
|
|
pa.data.Filters = `BuildingId='${this.buildFloor[0]}';FloorId='${this.buildFloor[1]}'`
|
|
|
}
|
|
|
- this.clearZoneCanvas();
|
|
|
queryZone(pa, res => {
|
|
|
// 所有业务空间
|
|
|
this.businessSpaceList = res.Content;
|
|
|
- // 未关联元空间的业务空间
|
|
|
- this.BSPUnrelaISPList = [];
|
|
|
// 已关联元空间的业务空间
|
|
|
this.BSPRelaISPList = [];
|
|
|
res.Content.map(t => {
|
|
|
if (t.Outline && t.Outline.length) {
|
|
|
this.BSPRelaISPList.push(t)
|
|
|
- } else {
|
|
|
- this.BSPUnrelaISPList.push(t)
|
|
|
}
|
|
|
})
|
|
|
// 绘制业务空间
|
|
|
let tempArr = this.BSPRelaISPList.map((t, i) => {
|
|
|
- return {
|
|
|
- RoomLocalName: t.RoomLocalName,
|
|
|
- OutLine: t.Outline,
|
|
|
- RoomID: t.RoomID,
|
|
|
- Color: new SColor(colorArr[i % colorArr.length]),
|
|
|
+ if (t.FloorId == this.buildFloor[1] && t.ObjectType == this.tab.code) {
|
|
|
+ return {
|
|
|
+ RoomLocalName: t.RoomLocalName,
|
|
|
+ OutLine: t.Outline,
|
|
|
+ RoomID: t.RoomID,
|
|
|
+ Color: colorArr[i % colorArr.length],
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('internet slow')
|
|
|
+ return undefined;
|
|
|
}
|
|
|
- })
|
|
|
- this.scene.zoneList = [];
|
|
|
+ }).filter(item => item)
|
|
|
+ this.scene.removeAllZone();
|
|
|
this.scene.addZoneList(tempArr);
|
|
|
this.scene.click(this, this.canvasClick);
|
|
|
this.zoneList = this.scene.zoneList;
|
|
@@ -325,18 +342,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) {
|
|
|
- this.type = 2;
|
|
|
+ if (this.type == 3) {
|
|
|
+ this.scene.clearSpaceSelection();
|
|
|
+ }
|
|
|
+ this.zoneDisable = false;
|
|
|
this.curZoneItem = item;
|
|
|
- this.scene.isSpaceSelectable = false;
|
|
|
this.scene.clearZoneSelection();
|
|
|
item.selected = true;
|
|
|
this.$emit('copyID', this.curZoneItem.data.RoomID)
|
|
@@ -346,6 +371,12 @@ export default {
|
|
|
// 编辑平面图
|
|
|
editGraphy() {
|
|
|
this.type = 3;
|
|
|
+ this.config.isEdit = true;
|
|
|
+ this.config.groupSelect = false;
|
|
|
+ this.config.divide = true;
|
|
|
+ this.scene.isSpaceSelectable = true;
|
|
|
+ // 设置业务空间不可选
|
|
|
+ this.scene.isZoneSelectable = false
|
|
|
},
|
|
|
// 查看未关联的业务空间--flag--查看-or-选择
|
|
|
lookUnrelatBSpace(flag) {
|
|
@@ -361,7 +392,29 @@ export default {
|
|
|
cancelGraphy() {
|
|
|
this.init(2);
|
|
|
},
|
|
|
- // 批量创建业务空间
|
|
|
+ // 批量创建业务空间弹窗
|
|
|
+ handleCommand(command) {
|
|
|
+ this.groupCreateDialogVis = true;
|
|
|
+ },
|
|
|
+ // 创建弹窗确认
|
|
|
+ confirm() {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 根据未关联元空间批量创建业务空间
|
|
|
groupCreateBSpace() {
|
|
|
let text = []
|
|
|
let Spaces = this.allUnRelatISP.map(t => {
|
|
@@ -393,34 +446,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",
|
|
@@ -428,7 +456,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
- this.$message('没有未关联的元空间')
|
|
|
+ this.$message('没有未关联的空间')
|
|
|
}
|
|
|
},
|
|
|
// 创建新的业务空间
|
|
@@ -437,60 +465,82 @@ export default {
|
|
|
if (arr.length) {
|
|
|
let tempArr = [];
|
|
|
arr.map(t => {
|
|
|
- tempArr.push(t.data.Name);
|
|
|
+ tempArr.push(this.BIMIDToSIName[t.data.SourceId]);
|
|
|
})
|
|
|
this.$refs.createBSP.showDialog(tempArr.toString());
|
|
|
} else {
|
|
|
this.$message.warning('请至少选择一个空间');
|
|
|
}
|
|
|
},
|
|
|
- // 创建新的业务空间-弹窗返回确认创建
|
|
|
+ // 根据图创建新的业务空间-弹窗返回确认创建
|
|
|
createRoom(val) {
|
|
|
- let arr = this.scene.getSelectedSpaces();
|
|
|
let zoneObj = { Outline: [], Height: 0 }, IspaceIdList = [];
|
|
|
- arr.map(t => {
|
|
|
+ let selectSpaces = this.scene.getSelectedSpaces();
|
|
|
+ selectSpaces.map(t => {
|
|
|
zoneObj.Outline.push(t.data.OutLine);
|
|
|
- IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
- console.log(zoneObj.Height)
|
|
|
+ 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;
|
|
|
+ zoneObj.Height = t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height;
|
|
|
}
|
|
|
})
|
|
|
+ // 如果有划分,求交集
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
|
+ zoneObj.Outline = [];
|
|
|
+ let arr = this.scene.getIntersect();
|
|
|
+ arr.map(t => {
|
|
|
+ let temp = t.map(item => {
|
|
|
+ return {
|
|
|
+ X: item.x,
|
|
|
+ Y: -item.y,
|
|
|
+ Z: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ zoneObj.Outline.push([temp]);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (!zoneObj.Outline.length) {
|
|
|
+ zoneObj.Outline = null;
|
|
|
+ }
|
|
|
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);
|
|
|
+ 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;
|
|
|
+ BSP.Height = t.Height > 100 ? (t.Height / 1000).toFixed(2) : t.Height;
|
|
|
}
|
|
|
})
|
|
|
- let pa = {
|
|
|
- zone: BSP.ObjectType,
|
|
|
- data: {
|
|
|
- Content: [BSP],
|
|
|
- Projection: ['Outline']
|
|
|
- }
|
|
|
+ // 如果有划分,求交集
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
|
+ BSP.Outline = [];
|
|
|
+ let spaceIntersect = this.scene.getIntersect();
|
|
|
+ spaceIntersect.map(t => {
|
|
|
+ let temp = t.map(item => {
|
|
|
+ return {
|
|
|
+ X: item.x,
|
|
|
+ Y: -item.y,
|
|
|
+ Z: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ BSP.Outline.push([temp]);
|
|
|
+ })
|
|
|
}
|
|
|
- updateZone(pa, res => {
|
|
|
- this.$message.success('更新成功');
|
|
|
- this.init(2);
|
|
|
- })
|
|
|
+ if (!BSP.Outline.length) {
|
|
|
+ BSP.Outline = null;
|
|
|
+ }
|
|
|
+ this.updateBSPOutline(BSP, IspaceIdList)
|
|
|
},
|
|
|
// 编辑空间详情
|
|
|
editeSpaceDetail() {
|
|
@@ -508,51 +558,229 @@ export default {
|
|
|
},
|
|
|
// 重新划分业务空间
|
|
|
refactorBSP() {
|
|
|
+ this.config.isEdit = true;
|
|
|
+ this.config.groupSelect = false;
|
|
|
+ this.config.divide = true;
|
|
|
this.type = 4;
|
|
|
- // 清空选中空间
|
|
|
- this.scene.clearSpaceSelection();
|
|
|
// 设置空间可选
|
|
|
this.scene.isSpaceSelectable = true;
|
|
|
// 将已关联的设置不可选,并将当前选的隐藏
|
|
|
- this.scene.changeSelectZone(this.curZoneItem);
|
|
|
+ this.scene.isZoneSelectable = false;
|
|
|
+ this.curZoneItem.visible = false;
|
|
|
+ // 将当前业务空间的每个元素添加到场景中并选中
|
|
|
+ this.scene.addAllLikeSpace(this.curZoneItem.data.OutLine);
|
|
|
},
|
|
|
// 重新划分--保存
|
|
|
saveRefactorBSP() {
|
|
|
- let arr = this.scene.getSelectedSpaces();
|
|
|
+ let selectSpace = this.scene.getSelectedSpaces();
|
|
|
+ let selectLikeSpace = this.scene.getSelectedLikeSpace();
|
|
|
//更新业务空间
|
|
|
let zoneObj = { Outline: [], Height: 0 }, IspaceIdList = [];
|
|
|
- arr.map(t => {
|
|
|
+ // 空间
|
|
|
+ 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;
|
|
|
+ zoneObj.Height = t.Height > 100 ? (t.Height / 1000).toFixed(2) : t.Height;
|
|
|
}
|
|
|
})
|
|
|
- zoneObj.RoomID = this.curZoneItem.data.RoomID;
|
|
|
+ // 类空间
|
|
|
+ selectLikeSpace.map(t => {
|
|
|
+ zoneObj.Outline.push(t.data);
|
|
|
+ })
|
|
|
+ // 如果有划分,求交集
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
|
+ zoneObj.Outline = [];
|
|
|
+ let spaceIntersect = this.scene.getIntersect();
|
|
|
+ spaceIntersect.map(t => {
|
|
|
+ let temp = t.map(item => {
|
|
|
+ return {
|
|
|
+ X: item.x,
|
|
|
+ Y: -item.y,
|
|
|
+ Z: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ zoneObj.Outline.push([temp]);
|
|
|
+ })
|
|
|
+ let likeSpaceIntersect = this.scene.getLikeIntersect();
|
|
|
+ likeSpaceIntersect.map(t => {
|
|
|
+ let temp = t.map(item => {
|
|
|
+ return {
|
|
|
+ X: item.x,
|
|
|
+ Y: -item.y,
|
|
|
+ Z: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ zoneObj.Outline.push([temp]);
|
|
|
+ })
|
|
|
+ }
|
|
|
if (!zoneObj.Outline.length) {
|
|
|
zoneObj.Outline = null;
|
|
|
}
|
|
|
+ zoneObj.RoomID = this.curZoneItem.data.RoomID;
|
|
|
+ this.updateBSPOutline(zoneObj, IspaceIdList)
|
|
|
+ },
|
|
|
+ // 根据图批量创建所选业务空间
|
|
|
+ groupCreateZone() {
|
|
|
+ let arr = this.scene.getSelectedSpaces();
|
|
|
+ let spaces = [];
|
|
|
+ // 如果有划分,求交集
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
|
+ let outlines = this.scene.getIntersectInSpace();
|
|
|
+ for (let k in outlines) {
|
|
|
+ outlines[k] = outlines[k].map(t => {
|
|
|
+ t = t.map(item => {
|
|
|
+ item = item.map(j => {
|
|
|
+ return { X: j.x, Y: -j.y, Z: 0 }
|
|
|
+ })
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ return t;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ spaces = arr.map(t => {
|
|
|
+ return {
|
|
|
+ IspaceId: this.BIMIDToSID[t.data.SourceId],
|
|
|
+ RoomLocalName: this.BIMIDToSIName[t.data.SourceId],
|
|
|
+ Outline: outlines[t.data.SourceId],
|
|
|
+ BuildingId: this.buildFloor[0],
|
|
|
+ FloorId: this.buildFloor[1],
|
|
|
+ Height: t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height || 0
|
|
|
+ }
|
|
|
+ }).filter(item => item.Outline && item.Outline.length)
|
|
|
+ } else {
|
|
|
+ spaces = arr.map(t => {
|
|
|
+ return {
|
|
|
+ IspaceId: this.BIMIDToSID[t.data.SourceId],
|
|
|
+ RoomLocalName: this.BIMIDToSIName[t.data.SourceId],
|
|
|
+ Outline: [t.data.OutLine],
|
|
|
+ BuildingId: this.buildFloor[0],
|
|
|
+ FloorId: this.buildFloor[1],
|
|
|
+ Height: t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height || 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (spaces.length) {
|
|
|
+ this.canvasLoading = true;
|
|
|
+ this.groupCreateBSP(spaces)
|
|
|
+ } else {
|
|
|
+ this.$message.warning('未选择本层空间');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 更新业务空间和元空间的关系
|
|
|
+ relationInBSPandISP(SpaceId, IspaceIdList) {
|
|
|
+ let pa = {
|
|
|
+ data: { SpaceId: SpaceId, IspaceIdList: IspaceIdList },
|
|
|
+ type: this.tab.code
|
|
|
+ }
|
|
|
+ createRelateInZoneAndISp(pa, res => {
|
|
|
+ this.$message.success('创建成功');
|
|
|
+ this.init(2);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 批量更新业务空间和元空间的关系
|
|
|
+ groupCreRelaZoneAndISp(Spaces) {
|
|
|
+ Spaces = Spaces.filter(item => item.IspaceId);
|
|
|
+ if (Spaces.length) {
|
|
|
+ let param = {
|
|
|
+ data: {
|
|
|
+ Content: Spaces
|
|
|
+ },
|
|
|
+ type: this.tab.code
|
|
|
+ }
|
|
|
+ groupCreRelaZoneAndISp(param, res => {
|
|
|
+ this.$message.success('创建成功')
|
|
|
+ this.canvasLoading = false;
|
|
|
+ this.init(2)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.success('创建成功')
|
|
|
+ this.canvasLoading = false;
|
|
|
+ this.init(2)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 批量创建
|
|
|
+ groupCreateBSP(spaces) {
|
|
|
+ spaces = spaces.map(t => {
|
|
|
+ t.BIMLocation = this.getAverageVal(t.Outline);
|
|
|
+ return t;
|
|
|
+ })
|
|
|
+ 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) {
|
|
|
+ space.BIMLocation = space.Outline ? this.getAverageVal(space.Outline) : null;
|
|
|
+ let pa = {
|
|
|
+ zone: this.tab.code,
|
|
|
+ data: {
|
|
|
+ Content: [space]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createZone(pa, res => {
|
|
|
+ this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 更新业务空间区域
|
|
|
+ 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 => {
|
|
|
this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
|
|
|
})
|
|
|
},
|
|
|
- // 更新业务空间和元空间的关系
|
|
|
- relationInBSPandISP(SpaceId, IspaceIdList) {
|
|
|
+ // 查询未关联平面图的业务空间(项目下+当前分区)
|
|
|
+ getBSPunrelaISP() {
|
|
|
let pa = {
|
|
|
- data: { SpaceId: SpaceId, IspaceIdList: IspaceIdList },
|
|
|
- type: this.tab.code
|
|
|
+ zone: this.tab.code,
|
|
|
+ data: {
|
|
|
+ Filters: `Outline isNull`
|
|
|
+ }
|
|
|
}
|
|
|
- createRelateInZoneAndISp(pa, res => {
|
|
|
- this.$message.success('创建成功');
|
|
|
- this.init(2);
|
|
|
+ countZone(pa, res => {
|
|
|
+ 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() {
|
|
@@ -560,22 +788,20 @@ export default {
|
|
|
},
|
|
|
// 清除canvas
|
|
|
clearGraphy() {
|
|
|
- if (this.view && this.view.scene) {
|
|
|
+ if (this.view) {
|
|
|
this.view.scene = null;
|
|
|
return
|
|
|
}
|
|
|
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 = 1;
|
|
|
},
|
|
|
// 适配底图到窗口
|
|
|
fit() {
|
|
@@ -589,18 +815,20 @@ export default {
|
|
|
saveSvg() {
|
|
|
this.view.saveSceneSvg(`${this.buildFloor[1]}.svg`, 6400, 4800);
|
|
|
},
|
|
|
+ // 保存json
|
|
|
+ saveJson() {
|
|
|
+ this.view.saveFloorJson(`${this.buildFloor[1]}.json`)
|
|
|
+ },
|
|
|
// 切割划分
|
|
|
divide() {
|
|
|
- this.scene.isMarking = true;
|
|
|
+ this.scene.isCutting = true;
|
|
|
},
|
|
|
// 清除切割划分
|
|
|
clearDivide() {
|
|
|
- this.scene.clearSceneMark()
|
|
|
+ this.scene.clearCut();
|
|
|
},
|
|
|
// 撤销
|
|
|
- undo() {
|
|
|
-
|
|
|
- },
|
|
|
+ undo() { },
|
|
|
// 反撤销
|
|
|
redo() { },
|
|
|
// 缩放
|
|
@@ -634,7 +862,23 @@ export default {
|
|
|
this.$refs.canvasFun.sliderVal = s > 1000 ? 1000 : s;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ "scene.isRectSelection": {
|
|
|
+ handler(n) {
|
|
|
+ if (!n) {
|
|
|
+ this.$refs.canvasFun.active = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "scene.isCutting": {
|
|
|
+ handler(n) {
|
|
|
+ if (!n) {
|
|
|
+ this.$refs.canvasFun.active = '';
|
|
|
+ this.$refs.canvasFun.isSwitch = false;
|
|
|
+ this.scene.isAbsorbing = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -660,7 +904,8 @@ export default {
|
|
|
width: 320px;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
- .button-group button {
|
|
|
+ .button-group button,
|
|
|
+ .button-group .el-dropdown {
|
|
|
display: block;
|
|
|
float: left;
|
|
|
}
|
|
@@ -690,4 +935,4 @@ export default {
|
|
|
z-index: 999;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|