|
@@ -11,13 +11,17 @@
|
|
|
</el-col>
|
|
|
<el-col :span="0.5">
|
|
|
<span style="margin:0 10px;">业务空间类型</span>
|
|
|
- <el-select placeholder="请选择" v-model="zoneType">
|
|
|
+ <el-select placeholder="请选择" v-model="zoneType" @change="getBusinessSpace">
|
|
|
<el-option v-for="item in tabsList" :key="item.Code" :label="item.Name" :value="item.Code">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
- <el-col :span="0.5" style="float:right;" v-show='0'>
|
|
|
- <el-button @click="clearRelation">清除</el-button>
|
|
|
+ <el-col :span="0.5" style="float:right;" v-show='1'>
|
|
|
+ 当前状态{{description}}
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ <el-button @click="removeRelation">清除</el-button>
|
|
|
+ <el-button @click="removeAll">清除所有</el-button>
|
|
|
+ <el-button @click="addRelation">添加</el-button>
|
|
|
<el-button type="primary" @click="saveRelation">保存</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -45,6 +49,8 @@ import {
|
|
|
queryDictionaryHead, //空间类型查询
|
|
|
createSpaceNeighborhood, //创建邻接关系
|
|
|
querySpaceNeighborhood, // 查询邻接关系
|
|
|
+ delSpaceNeighborhood, //删除选中
|
|
|
+ delFloorNeighborhood, //删除所有
|
|
|
} from "@/api/scan/request";
|
|
|
import { SColor, SPoint } from "@saga-web/draw/lib";
|
|
|
import { RelationScene, FloorView } from "@saga-web/cad-engine/lib";
|
|
@@ -79,6 +85,7 @@ export default {
|
|
|
divide: false,
|
|
|
groupSelect: false
|
|
|
},
|
|
|
+ description: '无'
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -131,12 +138,45 @@ export default {
|
|
|
this.createRela(pa)
|
|
|
},
|
|
|
clearRelation() {
|
|
|
- console.log(355555555555)
|
|
|
if (this.scene) {
|
|
|
this.scene.removeAllRelation()
|
|
|
}
|
|
|
},
|
|
|
+ //
|
|
|
+ cancel() {
|
|
|
+ this.scene.removeRelationFlag = false;
|
|
|
+ this.scene.createRelateFlag = false;
|
|
|
+ this.scene.isAbsorbing = false;
|
|
|
+ this.description = '无'
|
|
|
+ },
|
|
|
+ //
|
|
|
+ removeRelation() {
|
|
|
+ this.scene.removeRelationFlag = true;
|
|
|
+ this.scene.createRelateFlag = false;
|
|
|
+ this.scene.isAbsorbing = false;
|
|
|
+ this.description = '清除'
|
|
|
+ },
|
|
|
+ //
|
|
|
+ addRelation() {
|
|
|
+ this.scene.createRelateFlag = true;
|
|
|
+ this.scene.removeRelationFlag = false;
|
|
|
+ this.scene.isAbsorbing = true;
|
|
|
+ this.description = '添加'
|
|
|
+ },
|
|
|
+ //
|
|
|
+ removeAll() {
|
|
|
+ let temp = {
|
|
|
+ FloorId: this.buildFloor[1],
|
|
|
+ ZoneType: this.zoneType,
|
|
|
+ GraphType: this.type
|
|
|
+ }
|
|
|
+ delFloorNeighborhood(temp, res => {
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ this.clearRelation();
|
|
|
+ })
|
|
|
+ },
|
|
|
canvasClick(item, event) {
|
|
|
+ console.log(item);
|
|
|
item.selected = false;
|
|
|
},
|
|
|
initGraphy() {
|
|
@@ -153,10 +193,7 @@ export default {
|
|
|
this.view.scene = this.scene;
|
|
|
this.view.fitSceneToView();
|
|
|
this.scene.isSpaceSelectable = false;
|
|
|
- this.scene.createRelateFlag = true;
|
|
|
this.getBusinessSpace();
|
|
|
- // 绘制关系
|
|
|
- this.getRelations();
|
|
|
this.view.minScale = this.view.scale;
|
|
|
if (this.$refs.canvasFun) {
|
|
|
this.$refs.canvasFun.everyScale = this.view.scale;
|
|
@@ -228,6 +265,7 @@ export default {
|
|
|
let pa = {
|
|
|
Filters: `FloorId='${this.buildFloor[1]}';GraphType='${this.type}';ZoneType='${this.zoneType}'`
|
|
|
}
|
|
|
+ this.canvasLoading = true;
|
|
|
querySpaceNeighborhood(pa, res => {
|
|
|
let tempArr = res.Content.map(t => {
|
|
|
let p1 = t.LocationOne.split(',');
|
|
@@ -241,6 +279,7 @@ export default {
|
|
|
})
|
|
|
this.clearRelation();
|
|
|
this.scene.addAllRelaPoint(tempArr);
|
|
|
+ this.canvasLoading = false;
|
|
|
})
|
|
|
},
|
|
|
// 获取当前分区下的业务空间
|
|
@@ -285,7 +324,9 @@ export default {
|
|
|
}).filter(item => item)
|
|
|
this.scene.removeAllZone();
|
|
|
this.scene.addZoneList(tempArr);
|
|
|
- // this.scene.click(this, this.canvasClick)
|
|
|
+ this.scene.click(this, this.canvasClick)
|
|
|
+ // 绘制关系
|
|
|
+ this.getRelations();
|
|
|
this.canvasLoading = false;
|
|
|
})
|
|
|
},
|
|
@@ -309,6 +350,21 @@ export default {
|
|
|
this.$refs.canvasFun.sliderVal = s > 1000 ? 1000 : s;
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ "scene.curRemoveItem": {
|
|
|
+ handler(n) {
|
|
|
+ if (n) {
|
|
|
+ let pa = [{
|
|
|
+ GraphType: this.type,
|
|
|
+ ZoneType: this.zoneType,
|
|
|
+ SpaceIdOne: n.startZone,
|
|
|
+ SpaceIdTwo: n.endZone
|
|
|
+ }]
|
|
|
+ delSpaceNeighborhood(pa, res => {
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|