|
@@ -89,7 +89,7 @@ import { uuid } from "@/components/mapClass/until";
|
|
import { SImageItem } from "@saga-web/graph/lib";
|
|
import { SImageItem } from "@saga-web/graph/lib";
|
|
import store from "../store";
|
|
import store from "../store";
|
|
import { Loading } from "element-ui";
|
|
import { Loading } from "element-ui";
|
|
-import {getUrlMsg} from '@/components/urlMsg.js'
|
|
|
|
|
|
+import { getUrlMsg } from "@/components/urlMsg.js";
|
|
let fengmap = null;
|
|
let fengmap = null;
|
|
export default {
|
|
export default {
|
|
components: { Tree },
|
|
components: { Tree },
|
|
@@ -283,75 +283,80 @@ export default {
|
|
spinner: "el-icon-loading",
|
|
spinner: "el-icon-loading",
|
|
background: "rgba(0, 0, 0, 0.7)"
|
|
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;
|
|
|
|
- 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;
|
|
|
|
|
|
+ queryDraftGroup({ projectId: this.projectId })
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ loadings.close();
|
|
|
|
+ if (res.Result == "success") {
|
|
|
|
+ const data = res.Data;
|
|
|
|
+ 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);
|
|
|
|
- }
|
|
|
|
|
|
+ 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 => {
|
|
|
|
+ ele.open = true;
|
|
|
|
+ if (item.children) {
|
|
|
|
+ item.open = true;
|
|
|
|
+ item.children.forEach(item1 => {
|
|
|
|
+ item1.id = item.Id + item1.Gname;
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ item.id = ele.Id + item.Gname;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
- })(data);
|
|
|
|
- data.forEach(ele => {
|
|
|
|
- ele.children.forEach(item => {
|
|
|
|
- ele.open=true;
|
|
|
|
- if (item.children) {
|
|
|
|
- item.open=true;
|
|
|
|
- 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].children[0].Gname;
|
|
|
|
- this.categoryId = this.treeData[0].children[0].Id;
|
|
|
|
- // this.getLegend();
|
|
|
|
- this.checkFloor(this.treeData[0].children[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 {
|
|
} 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);
|
|
|
|
|
|
+ this.treeData = data;
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- this.treeData = data;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.treeData = [];
|
|
|
|
+ this.$message.error("获取楼层结构失败");
|
|
}
|
|
}
|
|
-
|
|
|
|
- } else {
|
|
|
|
- this.treeData = [];
|
|
|
|
- this.$message.error("获取楼层结构失败");
|
|
|
|
- }
|
|
|
|
- }).catch(()=>{
|
|
|
|
- loadings.close();
|
|
|
|
- this.$message.error('请求失败')
|
|
|
|
- });
|
|
|
|
|
|
+ // 如果没有楼层则底图清空
|
|
|
|
+ if (this.treeData.length == 0) {
|
|
|
|
+ this.checkFloor("");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ loadings.close();
|
|
|
|
+ this.$message.error("请求失败");
|
|
|
|
+ });
|
|
},
|
|
},
|
|
//获取补充图例
|
|
//获取补充图例
|
|
getLegend() {
|
|
getLegend() {
|
|
@@ -360,7 +365,7 @@ export default {
|
|
queryStatistic({
|
|
queryStatistic({
|
|
projectId: this.projectId,
|
|
projectId: this.projectId,
|
|
graphId: this.graphId,
|
|
graphId: this.graphId,
|
|
- categoryId:this.categoryId
|
|
|
|
|
|
+ categoryId: this.categoryId
|
|
}).then(res => {
|
|
}).then(res => {
|
|
console.log(res);
|
|
console.log(res);
|
|
this.legendLoading = false;
|
|
this.legendLoading = false;
|
|
@@ -468,7 +473,7 @@ export default {
|
|
// 切换草稿箱楼层
|
|
// 切换草稿箱楼层
|
|
checkFloor(floorid) {
|
|
checkFloor(floorid) {
|
|
this.scene = new EditScence();
|
|
this.scene = new EditScence();
|
|
- this.scene.isEditStatus = false
|
|
|
|
|
|
+ this.scene.isEditStatus = false;
|
|
this.clearGraphy();
|
|
this.clearGraphy();
|
|
const loadings = Loading.service({
|
|
const loadings = Loading.service({
|
|
lock: true,
|
|
lock: true,
|
|
@@ -476,48 +481,59 @@ export default {
|
|
spinner: "el-icon-loading",
|
|
spinner: "el-icon-loading",
|
|
background: "rgba(0, 0, 0, 0.7)"
|
|
background: "rgba(0, 0, 0, 0.7)"
|
|
});
|
|
});
|
|
|
|
+ if(!floorid){
|
|
|
|
+ loadings.close();
|
|
|
|
+ this.view.fitSceneToView();
|
|
|
|
+ return
|
|
|
|
+ }
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
this.parserData(floorid);
|
|
this.parserData(floorid);
|
|
this.readGroup(floorid).then(data => {
|
|
this.readGroup(floorid).then(data => {
|
|
- this.graphId = data.Data[0].ID;
|
|
|
|
- if (data.Data) {
|
|
|
|
|
|
+ if (data.Result == "success") {
|
|
|
|
+ this.graphId = data.Data[0].ID;
|
|
|
|
+ if (data.Data) {
|
|
|
|
+ loadings.close();
|
|
|
|
+ const parserData = new STopologyParser(null);
|
|
|
|
+ parserData.parseData(data.Data[0].Elements);
|
|
|
|
+ // 多边形
|
|
|
|
+ parserData.zoneLegendList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Nodes.push(t);
|
|
|
|
+ });
|
|
|
|
+ // 增加文字
|
|
|
|
+ parserData.textMarkerList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Markers.push(t);
|
|
|
|
+ });
|
|
|
|
+ // 增加图片
|
|
|
|
+ parserData.imageMarkerList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Markers.push(t);
|
|
|
|
+ });
|
|
|
|
+ // 增加直线
|
|
|
|
+ parserData.lineMarkerList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Markers.push(t);
|
|
|
|
+ });
|
|
|
|
+ // 增加图标类图例
|
|
|
|
+ parserData.imageLegendList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Nodes.push(t);
|
|
|
|
+ });
|
|
|
|
+ // 增加管线类
|
|
|
|
+ // 增加图标类图例
|
|
|
|
+ parserData.relationList.forEach(t => {
|
|
|
|
+ this.scene.addItem(t);
|
|
|
|
+ this.scene.Relations.push(t);
|
|
|
|
+ });
|
|
|
|
+ this.view.fitSceneToView();
|
|
|
|
+ this.getLegend();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
loadings.close();
|
|
loadings.close();
|
|
- const parserData = new STopologyParser(null);
|
|
|
|
- parserData.parseData(data.Data[0].Elements);
|
|
|
|
- // 多边形
|
|
|
|
- parserData.zoneLegendList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Nodes.push(t);
|
|
|
|
- });
|
|
|
|
- // 增加文字
|
|
|
|
- parserData.textMarkerList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Markers.push(t);
|
|
|
|
- });
|
|
|
|
- // 增加图片
|
|
|
|
- parserData.imageMarkerList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Markers.push(t);
|
|
|
|
- });
|
|
|
|
- // 增加直线
|
|
|
|
- parserData.lineMarkerList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Markers.push(t);
|
|
|
|
- });
|
|
|
|
- // 增加图标类图例
|
|
|
|
- parserData.imageLegendList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Nodes.push(t);
|
|
|
|
- });
|
|
|
|
- // 增加管线类
|
|
|
|
- // 增加图标类图例
|
|
|
|
- parserData.relationList.forEach(t => {
|
|
|
|
- this.scene.addItem(t);
|
|
|
|
- this.scene.Relations.push(t);
|
|
|
|
- });
|
|
|
|
- this.view.fitSceneToView();
|
|
|
|
- this.getLegend();
|
|
|
|
}
|
|
}
|
|
|
|
+ }).catch(()=>{
|
|
|
|
+ loadings.close();
|
|
});
|
|
});
|
|
}, 100);
|
|
}, 100);
|
|
}
|
|
}
|