|
@@ -3,7 +3,8 @@
|
|
|
<div class="tit">草稿箱</div>
|
|
|
<div class="conent">
|
|
|
<div class="left-nav">
|
|
|
- <Tree :data="treeData" @change="change"></Tree>
|
|
|
+ <Tree :data="treeData" @change="change" v-if="treeData.length"></Tree>
|
|
|
+ <div v-else style="text-align: center;margin-top: 20px;">暂无数据</div>
|
|
|
<!-- <el-tree ref="tree" :data="treeData" :props="defaultProps" @node-click="handleNodeClick" node-key="id" :expand-on-click-node="false"-->
|
|
|
<!-- :current-node-key="currentNodekey"-->
|
|
|
<!-- :default-expanded-keys="expandedkeys">-->
|
|
@@ -150,6 +151,12 @@ export default {
|
|
|
// },
|
|
|
//初始化获取蜂鸟所有底图数据
|
|
|
init() {
|
|
|
+ const loadings = Loading.service({
|
|
|
+ lock: true,
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
+ });
|
|
|
// const loadings = this.$loading({type: 'global'});
|
|
|
document.getElementById(`canvas`).focus();
|
|
|
this.scene = new EditScence();
|
|
@@ -170,6 +177,7 @@ export default {
|
|
|
)
|
|
|
.then(response => {
|
|
|
// 获取楼层数据数据
|
|
|
+ loadings.close();
|
|
|
this.getTreeData();
|
|
|
});
|
|
|
});
|
|
@@ -270,59 +278,78 @@ export default {
|
|
|
console.log(items);
|
|
|
},
|
|
|
getTreeData() {
|
|
|
+ const loadings = Loading.service({
|
|
|
+ lock: true,
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
+ });
|
|
|
queryDraftGroup({ projectId: this.projectId }).then(res => {
|
|
|
console.log(res);
|
|
|
+ loadings.close();
|
|
|
if (res.Result == "success") {
|
|
|
const data = res.Data;
|
|
|
- (function recursion(newObj) {
|
|
|
- newObj.map(function(item, index) {
|
|
|
- item.id = item.Id || item.Gname;
|
|
|
- item.name = item.Gcode;
|
|
|
+ this.systemName = '';
|
|
|
+ this.floorName = '';
|
|
|
+ this.floorId = '';
|
|
|
+ this.categoryId = '';
|
|
|
+ if(data.length){
|
|
|
+ (function recursion(newObj) {
|
|
|
+ newObj.map(function(item, index) {
|
|
|
+ item.id = item.Id || item.Gname;
|
|
|
+ item.name = item.Gcode;
|
|
|
|
|
|
- item.checked = false;
|
|
|
- if (item.Category && item.Category.length > 0) {
|
|
|
- item.children = item.Category;
|
|
|
- item.open = false;
|
|
|
- recursion(item.Category);
|
|
|
- }
|
|
|
- });
|
|
|
- })(data);
|
|
|
- data.forEach(ele => {
|
|
|
- ele.children.forEach(item => {
|
|
|
- if (item.children) {
|
|
|
- item.children.forEach(item1 => {
|
|
|
- item1.id = item.Id + item1.Gname;
|
|
|
- });
|
|
|
- } else {
|
|
|
- item.id = ele.Id + item.Gname;
|
|
|
- }
|
|
|
+ item.checked = false;
|
|
|
+ if (item.Category && item.Category.length > 0) {
|
|
|
+ item.children = item.Category;
|
|
|
+ item.open = false;
|
|
|
+ recursion(item.Category);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })(data);
|
|
|
+ data.forEach(ele => {
|
|
|
+ ele.children.forEach(item => {
|
|
|
+ if (item.children) {
|
|
|
+ item.children.forEach(item1 => {
|
|
|
+ item1.id = item.Id + item1.Gname;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ item.id = ele.Id + item.Gname;
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- this.treeData = data;
|
|
|
- if (this.treeData[0].children[0].children) {
|
|
|
- this.treeData[0].open = true;
|
|
|
- this.treeData[0].children[0].open = true;
|
|
|
- this.treeData[0].children[0].children[0].checked = "checked";
|
|
|
- this.systemName = this.treeData[0].children[0].Gcode;
|
|
|
- this.floorName = this.treeData[0].children[0].children[0].Gcode;
|
|
|
- this.floorId = this.treeData[0].children[0].Gname;
|
|
|
- this.categoryId = this.treeData[0].children[0].Id;
|
|
|
- // this.getLegend();
|
|
|
- this.checkFloor(this.treeData[0].children[0].children[0].Gname);
|
|
|
- } else {
|
|
|
- this.treeData[0].open = true;
|
|
|
- this.treeData[0].children[0].checked = "checked";
|
|
|
- this.systemName = this.treeData[0].Gcode;
|
|
|
- this.floorName = this.treeData[0].children[0].Gcode;
|
|
|
- this.floorId = this.treeData[0].Gname;
|
|
|
- this.categoryId = this.treeData[0].Id;
|
|
|
- // this.getLegend();
|
|
|
- this.checkFloor(this.treeData[0].children[0].Gname);
|
|
|
+ this.treeData = data;
|
|
|
+ if ( this.treeData[0].children[0].children) {
|
|
|
+ this.treeData[0].open = true;
|
|
|
+ this.treeData[0].children[0].open = true;
|
|
|
+ this.treeData[0].children[0].children[0].checked = "checked";
|
|
|
+ this.systemName = this.treeData[0].children[0].Gcode;
|
|
|
+ this.floorName = this.treeData[0].children[0].children[0].Gcode;
|
|
|
+ this.floorId = this.treeData[0].children[0].children[0].Gname;
|
|
|
+ this.categoryId = this.treeData[0].children[0].Id;
|
|
|
+ // this.getLegend();
|
|
|
+ this.checkFloor(this.treeData[0].children[0].children[0].Gname);
|
|
|
+ } else {
|
|
|
+ this.treeData[0].open = true;
|
|
|
+ this.treeData[0].children[0].checked = "checked";
|
|
|
+ this.systemName = this.treeData[0].Gcode;
|
|
|
+ this.floorName = this.treeData[0].children[0].Gcode;
|
|
|
+ this.floorId = this.treeData[0].children[0].Gname;
|
|
|
+ this.categoryId = this.treeData[0].Id;
|
|
|
+ // this.getLegend();
|
|
|
+ this.checkFloor(this.treeData[0].children[0].Gname);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.treeData = data;
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
this.treeData = [];
|
|
|
this.$message.error("获取楼层结构失败");
|
|
|
}
|
|
|
+ }).catch(()=>{
|
|
|
+ loadings.close();
|
|
|
+ this.$message.error('请求失败')
|
|
|
});
|
|
|
},
|
|
|
//获取补充图例
|
|
@@ -364,6 +391,7 @@ export default {
|
|
|
if (res.Result == "success") {
|
|
|
this.$message.success("删除成功");
|
|
|
this.getTreeData();
|
|
|
+ this.init();
|
|
|
this.legendData = [];
|
|
|
} else {
|
|
|
this.$message.error(res.Message);
|
|
@@ -378,6 +406,7 @@ export default {
|
|
|
spinner: "el-icon-loading",
|
|
|
background: "rgba(0, 0, 0, 0.7)"
|
|
|
});
|
|
|
+ console.log(this.floorId);
|
|
|
const data = {
|
|
|
BuildingID: this.BuildingID,
|
|
|
CategoryID: this.categoryId,
|