|
@@ -3,12 +3,14 @@
|
|
|
<div class="tit">草稿箱</div>
|
|
|
<div class="conent">
|
|
|
<div class="left-nav">
|
|
|
- <!-- <Tree :data="treeData" @change="change"></Tree>-->
|
|
|
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick">
|
|
|
- <span class="span-ellipsis" slot-scope="{ node, data }">
|
|
|
- <span :title="node.label">{{ node.label }}</span>
|
|
|
- </span>
|
|
|
- </el-tree>
|
|
|
+ <Tree :data="treeData" @change="change"></Tree>
|
|
|
+<!-- <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">-->
|
|
|
+<!-- <span class="span-ellipsis" slot-scope="{ node, data }">-->
|
|
|
+<!-- <span :title="node.label">{{ node.label }}</span>-->
|
|
|
+<!-- </span>-->
|
|
|
+<!-- </el-tree>-->
|
|
|
</div>
|
|
|
<div class="conent-right">
|
|
|
<div class="conent-tit">
|
|
@@ -126,23 +128,25 @@ export default {
|
|
|
floorName: "",
|
|
|
floorId: "", //楼层id
|
|
|
BuildingID: "1", // 建筑id
|
|
|
- categoryId: "" //系统类id
|
|
|
+ categoryId: "", //系统类id
|
|
|
+ currentNodekey: "", //默认选中的节点树
|
|
|
+ expandedkeys: [], //默认展开的节点树
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- handleNodeClick(data, node) {
|
|
|
- this.legendData = [];
|
|
|
- this.systemName = "";
|
|
|
- this.floorName = "";
|
|
|
- if (data.Gname) {
|
|
|
- this.systemName = node.parent.data.Gcode;
|
|
|
- this.floorName = data.Gcode;
|
|
|
- this.floorId = data.Gname;
|
|
|
- this.categoryId = node.parent.data.Id;
|
|
|
- this.getLegend();
|
|
|
- this.checkFloor(data.Gname);
|
|
|
- }
|
|
|
- },
|
|
|
+ // handleNodeClick(data, node) {
|
|
|
+ // this.legendData = [];
|
|
|
+ // this.systemName = "";
|
|
|
+ // this.floorName = "";
|
|
|
+ // if (data.Gname) {
|
|
|
+ // this.systemName = node.parent.data.Gcode;
|
|
|
+ // this.floorName = data.Gcode;
|
|
|
+ // this.floorId = data.Gname;
|
|
|
+ // this.categoryId = node.parent.data.Id;
|
|
|
+ // this.getLegend();
|
|
|
+ // this.checkFloor(data.Gname);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
init() {
|
|
|
// const loadings = this.$loading({type: 'global'});
|
|
|
document.getElementById(`canvas`).focus();
|
|
@@ -207,11 +211,103 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ change(id){
|
|
|
+ let data = this.treeData;
|
|
|
+ (function recursion(newObj) {
|
|
|
+ newObj.map(function(item, index) {
|
|
|
+ item.open = false;
|
|
|
+ item.checked = false;
|
|
|
+ if (item.Category && item.Category.length > 0) {
|
|
|
+ item.children = item.Category;
|
|
|
+ recursion(item.Category);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })(data);
|
|
|
+ let items = null;
|
|
|
+ data.forEach(ele=>{
|
|
|
+ ele.children.forEach(item=>{
|
|
|
+ if(item.children){
|
|
|
+ item.children.forEach(item1=>{
|
|
|
+ if(item1.id==id.id){
|
|
|
+ items = item;
|
|
|
+ item.open=true;
|
|
|
+ ele.open=true;
|
|
|
+ item1.checked='checked';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ if(item.id==id.id){
|
|
|
+ items = ele;
|
|
|
+ ele.open=true;
|
|
|
+ item.checked='checked';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.legendData = [];
|
|
|
+ this.systemName = "";
|
|
|
+ this.floorName = "";
|
|
|
+ this.systemName = items.Gcode;
|
|
|
+ this.floorName = id.Gcode;
|
|
|
+ this.floorId = id.Gname;
|
|
|
+ this.categoryId = items.Id;
|
|
|
+ this.getLegend();
|
|
|
+ this.checkFloor(id.Gname);
|
|
|
+ console.log(items);
|
|
|
+ },
|
|
|
getTreeData() {
|
|
|
queryDraftGroup({ projectId: this.projectId }).then(res => {
|
|
|
console.log(res);
|
|
|
if (res.Result == "success") {
|
|
|
- this.treeData = res.Data;
|
|
|
+ let data = res.Data;
|
|
|
+ (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;
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
this.treeData = [];
|
|
|
this.$message.error("获取楼层结构失败");
|
|
@@ -316,6 +412,12 @@ export default {
|
|
|
},
|
|
|
// 切换草稿箱楼层
|
|
|
checkFloor(floorid) {
|
|
|
+ const loadings = Loading.service({
|
|
|
+ lock: true,
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
+ });
|
|
|
fengmap.loadMap(this.fmapID, resp => {
|
|
|
this.floorList = resp;
|
|
|
fengmap
|
|
@@ -332,6 +434,7 @@ export default {
|
|
|
this.readGroup(floorid).then(data => {
|
|
|
this.graphId = data.Data[0].ID;
|
|
|
if (data.Data) {
|
|
|
+ loadings.close();
|
|
|
const parserData = new STopologyParser(null);
|
|
|
parserData.parseData(data.Data[0].Elements);
|
|
|
// 多边形
|