|
@@ -78,6 +78,10 @@
|
|
|
<!-- 批量创建选择弹窗 -->
|
|
|
<el-dialog title="提示" :visible.sync="groupCreateDialogVis" width="30%">
|
|
|
<div id="autoRelate">
|
|
|
+ <p>批量创建面积大于此值的默认空间为业务空间:</p>
|
|
|
+ <div style="padding:10px 20px;margin:0 0 10px 0;">
|
|
|
+ <el-slider v-model="areaValue" :marks="areaMarks" :step="10" :format-tooltip='val=>val/100'> </el-slider>
|
|
|
+ </div>
|
|
|
<p>请选择批量创建方式:</p>
|
|
|
<p>
|
|
|
<el-radio v-model="groupCreateType" :label="1">批量将所有的空白空间创建业务空间</el-radio>
|
|
@@ -151,7 +155,9 @@ export default {
|
|
|
groupCreateDialogVis: false, //批量创建业务空间弹窗
|
|
|
groupCreateType: 1, //批量创建方式
|
|
|
zoneDisable: true, // 重新划分是否禁用
|
|
|
- sourceIdToISP: {}
|
|
|
+ sourceIdToISP: {},
|
|
|
+ areaValue: 40,
|
|
|
+ areaMarks: { 0: '0m²', 100: '1m²' }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -428,6 +434,22 @@ export default {
|
|
|
let text = []
|
|
|
let Spaces = this.allUnRelatISP.map(t => {
|
|
|
if (t.Outline) {
|
|
|
+ let area = 0;
|
|
|
+ if (t.Outline[0]) {
|
|
|
+ area = this.getarea(t.Outline[0]);
|
|
|
+ if (t.Outline.length > 1) {
|
|
|
+ for (let i = 1; i < t.Outline.length; i++) {
|
|
|
+ let temp = this.getarea(t.Outline[i]);
|
|
|
+ area = area - temp
|
|
|
+ }
|
|
|
+ }
|
|
|
+ area = (area / 1000000).toFixed(2);
|
|
|
+ if (area < (this.areaValue / 100)) {
|
|
|
+ return undefined
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return undefined;
|
|
|
+ }
|
|
|
text.push(t.RoomLocalName || t.RoomName)
|
|
|
return {
|
|
|
IspaceId: t.RoomID,
|
|
@@ -774,26 +796,60 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
createSpaces = arr.map(t => {
|
|
|
+ let line = outlines[t.data.SourceId];
|
|
|
+ if (!line || !line.length) {
|
|
|
+ return undefined
|
|
|
+ } else {
|
|
|
+ let area = 0;
|
|
|
+ for (let i = 0; i < line.length; i++) {
|
|
|
+ for (let j = 0; j < line[i].length; j++) {
|
|
|
+ if (j == 0) {
|
|
|
+ area += this.getarea(line[i][0]);
|
|
|
+ } else {
|
|
|
+ area -= this.getarea(line[i][j]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ area = (area / 1000000).toFixed(2);
|
|
|
+ if (area < (this.areaValue / 100)) {
|
|
|
+ return undefined;
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
IspaceId: this.BIMIDToSID[t.data.SourceId],
|
|
|
RoomLocalName: this.BIMIDToSIName[t.data.SourceId],
|
|
|
- Outline: outlines[t.data.SourceId],
|
|
|
+ Outline: line,
|
|
|
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)
|
|
|
+ }).filter(item => item)
|
|
|
} else {
|
|
|
createSpaces = arr.map(t => {
|
|
|
+ let line = t.data.OutLine;
|
|
|
+ if (!line || !line.length) {
|
|
|
+ return undefined
|
|
|
+ } else {
|
|
|
+ let area = this.getarea(line[0]);
|
|
|
+ if (line.length > 1) {
|
|
|
+ for (let i = 1; i < line.length; i++) {
|
|
|
+ area -= this.getarea(line[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ area = (area / 1000000).toFixed(2);
|
|
|
+ if (area < (this.areaValue / 100)) {
|
|
|
+ return undefined;
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
IspaceId: this.BIMIDToSID[t.data.SourceId],
|
|
|
RoomLocalName: this.BIMIDToSIName[t.data.SourceId],
|
|
|
- Outline: [t.data.OutLine],
|
|
|
+ Outline: [line],
|
|
|
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);
|
|
|
}
|
|
|
if (createSpaces.length) {
|
|
|
this.canvasLoading = true;
|
|
@@ -921,6 +977,19 @@ export default {
|
|
|
Z = (Z / len).toFixed(2);
|
|
|
return `${X},${Y},${Z}`
|
|
|
},
|
|
|
+ // 计算面积
|
|
|
+ getarea(arr) {
|
|
|
+ if (!arr.length) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ let sum = 0;
|
|
|
+ let n = arr.length;
|
|
|
+ arr[n] = arr[0];
|
|
|
+ for (let i = 1; i <= n; i++) {
|
|
|
+ sum += arr[i].X * arr[i - 1].Y - arr[i - 1].X * arr[i].Y;
|
|
|
+ }
|
|
|
+ return Math.abs(sum / 2)
|
|
|
+ },
|
|
|
// canvas 获取焦点
|
|
|
focus() {
|
|
|
document.getElementById(`floorCanvas`).focus()
|
|
@@ -1077,5 +1146,10 @@ export default {
|
|
|
transform: translateX(-50%);
|
|
|
z-index: 99;
|
|
|
}
|
|
|
+ #autoRelate {
|
|
|
+ /deep/ .el-slider__marks-text:nth-child(2) {
|
|
|
+ width: 25px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|