|
@@ -12,7 +12,7 @@ import { SFloorParser } from "@saga-web/big";
|
|
|
import { FloorView } from "./../lib/FloorView";
|
|
|
import { EditScence } from "./mapClass/EditScence";
|
|
|
import bus from "@/bus";
|
|
|
-import { saveGroup, readGroup, queryTypeGraph,publishGraph } from "@/api/editer.js";
|
|
|
+import { saveGroup, readGroup, queryTypeGraph, publishGraph } from "@/api/editer.js";
|
|
|
import { STopologyParser } from "./../lib/parsers/STopologyParser";
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
import { SImageItem } from "@saga-web/graph/lib";
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
urlMsg: {},
|
|
|
chiceItemList: [], //选中itemlist
|
|
|
hasTypeList: [], // 当前类型下包含的typeid(提取)
|
|
|
- graphId:'',
|
|
|
+ graphId: '',
|
|
|
initScale: 1, //加载好底图之后的,初始缩放比例
|
|
|
changeScaleByClick: false, //区分 滚轮,点击 事件改变的缩放比例
|
|
|
};
|
|
@@ -152,10 +152,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 读取绘制数据
|
|
|
- readGraph(){
|
|
|
+ readGraph() {
|
|
|
this.readGroup().then(data => {
|
|
|
this.graphId = data.Data[0].ID;
|
|
|
- bus.$emit('setGraphId',this.graphId)
|
|
|
+ bus.$emit('setGraphId', this.graphId)
|
|
|
if (data.Data) {
|
|
|
const parserData = new STopologyParser(null);
|
|
|
parserData.parseData(data.Data[0].Elements);
|
|
@@ -183,16 +183,34 @@ export default {
|
|
|
this.scene.addItem(t);
|
|
|
this.scene.Markers.push(t);
|
|
|
});
|
|
|
- // 增加图标类图例
|
|
|
+ // 增加图标类图例(此item需在管线item添加之前添加)
|
|
|
+ const ancToAnchor = {}
|
|
|
parserData.imageLegendList.forEach(t => {
|
|
|
this.scene.addItem(t);
|
|
|
this.scene.Nodes.push(t);
|
|
|
+ if (t.anchorList && t.anchorList.length) {
|
|
|
+ t.anchorList.forEach(anc => {
|
|
|
+ ancToAnchor[anc.id] = anc
|
|
|
+ })
|
|
|
+ }
|
|
|
});
|
|
|
- // 增加管线类
|
|
|
- // 增加图标类图例
|
|
|
+ // 增加管线类(需在图标类图例添加后添加)
|
|
|
parserData.relationList.forEach(t => {
|
|
|
this.scene.addItem(t);
|
|
|
this.scene.Relations.push(t);
|
|
|
+ // 设置锚点
|
|
|
+ if (t.anchor1ID) {
|
|
|
+ const startAnc = ancToAnchor[t.anchor1ID]
|
|
|
+ startAnc.isConnected = true
|
|
|
+ startAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
+ t.startAnchor = startAnc || null
|
|
|
+ }
|
|
|
+ if (t.anchor2ID) {
|
|
|
+ const endAnc = ancToAnchor[t.anchor2ID]
|
|
|
+ endAnc.isConnected = true
|
|
|
+ endAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
+ t.endAnchor = endAnc || null
|
|
|
+ }
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
|
bus.$emit("elementDataChange", this.scene);
|
|
@@ -388,14 +406,14 @@ export default {
|
|
|
bus.$on("changeDrawType", val => {
|
|
|
this.scene.isSelecting = val == "select";
|
|
|
}),
|
|
|
- //发布图
|
|
|
- bus.$on("publishMap", () => {
|
|
|
- if(this.graphId==''){
|
|
|
- this.$message.error('请先保存');
|
|
|
- return false;
|
|
|
- }
|
|
|
- this.publishBtn()
|
|
|
- })
|
|
|
+ //发布图
|
|
|
+ bus.$on("publishMap", () => {
|
|
|
+ if (this.graphId == '') {
|
|
|
+ this.$message.error('请先保存');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.publishBtn()
|
|
|
+ })
|
|
|
/**
|
|
|
* @name changeScale缩放底图
|
|
|
* @param { Number } zoom 缩放比例
|
|
@@ -421,7 +439,7 @@ export default {
|
|
|
};
|
|
|
return readGroup(data);
|
|
|
},
|
|
|
- //发布
|
|
|
+ //发布
|
|
|
publishBtn() {
|
|
|
console.log(this.graphId);
|
|
|
const loadings = Loading.service({
|
|
@@ -442,14 +460,14 @@ export default {
|
|
|
loadings.close();
|
|
|
if (res.Result == "success") {
|
|
|
this.$message.success('发布成功');
|
|
|
- setTimeout(()=>{
|
|
|
- const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
|
|
|
- const url =
|
|
|
- window.location.origin +
|
|
|
- "/wandaEditer/drafts?" +
|
|
|
- encodeURIComponent(data);
|
|
|
- window.open(url, true);
|
|
|
- },1000);
|
|
|
+ setTimeout(() => {
|
|
|
+ const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
|
|
|
+ const url =
|
|
|
+ window.location.origin +
|
|
|
+ "/wandaEditer/drafts?" +
|
|
|
+ encodeURIComponent(data);
|
|
|
+ window.open(url, true);
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
this.$message.error(res.Message);
|
|
|
}
|