|
@@ -16,7 +16,7 @@
|
|
|
<i class="el-icon-search el-input__icon" slot="suffix" @click="handleSelect"></i>
|
|
|
<template slot-scope="{ item }">
|
|
|
<div class="name" style="position: relative;">
|
|
|
- {{ item.RoomLocalName | cutString(8) }}
|
|
|
+ {{ item.data.RoomLocalName | cutString(8) }}
|
|
|
<span class="addr" style="position: absolute;right:10px;color:#409EFF;">定位</span>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -65,11 +65,9 @@
|
|
|
<script>
|
|
|
import canvasFun from "./canvasFun"
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
-import { SGraphyView } from "@sybotan-web/graphy/lib";
|
|
|
-import { DivideFloorScene, } from "cad-engine"
|
|
|
-import { SColor, SPoint } from "@sybotan-web/draw/lib";
|
|
|
-import { SpaceItem } from "cad-engine/lib/items/SpaceItem";
|
|
|
-import { ZoneItem } from "cad-engine/lib/items/ZoneItem";
|
|
|
+import { SGraphyView } from "@saga-web/graphy/lib";
|
|
|
+import { SColor, SPoint } from "@saga-web/draw/lib";
|
|
|
+import { DivideFloorScene, SpaceItem, ZoneItem } from "@saga-web/cad-engine/lib";
|
|
|
import unRelateBSP from "./unRelateBSP";
|
|
|
import createBSP from "./createBSP";
|
|
|
import {
|
|
@@ -166,7 +164,7 @@ export default {
|
|
|
},
|
|
|
// 搜索
|
|
|
querySearch(queryString, cb) {
|
|
|
- var restaurants = this.BSPRelaISPList;
|
|
|
+ var restaurants = this.zoneList;
|
|
|
var results = queryString ?
|
|
|
restaurants.filter(this.createFilter(queryString)) :
|
|
|
restaurants;
|
|
@@ -176,12 +174,18 @@ export default {
|
|
|
// 过滤器
|
|
|
createFilter(queryString) {
|
|
|
return restaurant => {
|
|
|
- return restaurant.RoomLocalName.indexOf(queryString) > -1;
|
|
|
+ return restaurant.data.RoomLocalName.indexOf(queryString) > -1;
|
|
|
};
|
|
|
},
|
|
|
- // 查询选中
|
|
|
- handleSelect(BSP) {
|
|
|
- console.log(arguments)
|
|
|
+ // 查询选中,定位
|
|
|
+ handleSelect(zone) {
|
|
|
+ // 清空选中
|
|
|
+ this.scene.clearSpaceSelection();
|
|
|
+ this.scene.clearZoneSelection();
|
|
|
+ // 选中当前
|
|
|
+ zone.selected = true;
|
|
|
+ this.type = 2;
|
|
|
+ this.view.fitSelectedToView();
|
|
|
},
|
|
|
// 父组件调用
|
|
|
getData(buildFloor, FloorMap, tab) {
|
|
@@ -223,8 +227,13 @@ export default {
|
|
|
that.clearGraphy()
|
|
|
that.scene = new DivideFloorScene();
|
|
|
that.canvasLoading = true;
|
|
|
- that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(() => {
|
|
|
+ that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(res => {
|
|
|
that.canvasLoading = false;
|
|
|
+ if (res == 'error') {
|
|
|
+ this.FloorMap = '';
|
|
|
+ this.$message.warning('数据解析异常');
|
|
|
+ return;
|
|
|
+ }
|
|
|
that.view.scene = that.scene;
|
|
|
let tempArr = this.BSPRelaISPList.map((t, i) => {
|
|
|
return {
|
|
@@ -235,11 +244,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
that.scene.addZoneList(tempArr);
|
|
|
- that.scene.click(that, that.canvasClick)
|
|
|
+ that.scene.click(that, that.canvasClick);
|
|
|
+ that.zoneList = that.scene.zoneList;
|
|
|
that.view.fitSceneToView();
|
|
|
that.view.maxScale = that.view.scale * 10;
|
|
|
that.view.minScale = that.view.scale;
|
|
|
- that.$refs.canvasFun.everyScale = that.view.scale;
|
|
|
+ if (that.$refs.canvasFun) {
|
|
|
+ that.$refs.canvasFun.everyScale = that.view.scale;
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
// 获取当前分区下的业务空间
|
|
@@ -277,20 +289,18 @@ export default {
|
|
|
},
|
|
|
// canvas点击事件
|
|
|
canvasClick(item, event) {
|
|
|
- this.scene.setSpaceSelectable(true);
|
|
|
- this.scene.setZoneSelectable(true);
|
|
|
if (this.type == 4) {
|
|
|
|
|
|
} else {
|
|
|
- if (item instanceof SpaceItem) {
|
|
|
+ if (item instanceof SpaceItem && item.selectable) {
|
|
|
this.type = 3;
|
|
|
this.curZoneItem = {};
|
|
|
- this.scene.setZoneSelectable(false);
|
|
|
+ this.scene.isZoneSelectable = false;
|
|
|
}
|
|
|
- if (item instanceof ZoneItem) {
|
|
|
+ if (item instanceof ZoneItem && item.selectable) {
|
|
|
this.type = 2;
|
|
|
this.curZoneItem = item;
|
|
|
- this.scene.setSpaceSelectable(false);
|
|
|
+ this.scene.isSpaceSelectable = false;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -439,7 +449,7 @@ export default {
|
|
|
refactorBSP() {
|
|
|
this.type = 4;
|
|
|
// 设置空间可选
|
|
|
- this.scene.setSpaceSelectable(true);
|
|
|
+ this.scene.isSpaceSelectable = true;
|
|
|
// 将已关联的设置不可选,并将当前选的隐藏
|
|
|
this.scene.changeSelectZone(this.curZoneItem);
|
|
|
},
|
|
@@ -529,6 +539,9 @@ export default {
|
|
|
redo() { },
|
|
|
// 缩放
|
|
|
scale(val) {
|
|
|
+ if (!this.view) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
let scale = this.view.scale;
|
|
|
this.view.scaleByPoint(val / scale, this.canvasWidth / 2, this.canvasHeight / 2);
|
|
|
},
|