|
@@ -21,7 +21,7 @@ import { readPubGroup } from "@/api/tuopu"; // 引入获取底图得接口
|
|
|
import scaleBtn from "./scale";
|
|
|
import { PTopoParser } from "./topuClass/PTopoParser";
|
|
|
import { SColor, SFont, SPoint } from "@persagy-web/draw";
|
|
|
-import {SLineStyle} from "@persagy-web/graph"
|
|
|
+import { SLineStyle } from "@persagy-web/graph";
|
|
|
export default {
|
|
|
components: { scaleBtn },
|
|
|
props: {
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- fixWindow(){
|
|
|
+ fixWindow() {
|
|
|
this.view.fitSceneToView();
|
|
|
},
|
|
|
// 初始化
|
|
@@ -59,7 +59,7 @@ export default {
|
|
|
// graphId: "0314991b0cd148ba89da60eddf30efd1",
|
|
|
projectId: "Pj4403070003",
|
|
|
graphId: "994d0f65d647426f854d2a5f7f0173a4",
|
|
|
- id: "be4c75daf4d44cb89b447eb7581614da"
|
|
|
+ id: "be4c75daf4d44cb89b447eb7581614da",
|
|
|
};
|
|
|
}
|
|
|
const obj = {
|
|
@@ -79,35 +79,48 @@ export default {
|
|
|
// 'url 新增路径'
|
|
|
if (res.result == "failure") return;
|
|
|
const parse = new PTopoParser();
|
|
|
- if(this.scene){
|
|
|
- const backgroundColor = res.data.content.viewBackground ? res.data.content.viewBackground : '#1f1f27'
|
|
|
+ if (this.scene) {
|
|
|
+ const backgroundColor = res.data.content.viewBackground
|
|
|
+ ? res.data.content.viewBackground
|
|
|
+ : "#1f1f27";
|
|
|
this.scene.changeBackgroundColor(backgroundColor);
|
|
|
}
|
|
|
- window.parse = parse
|
|
|
- if (res.data.content.elements.nodes && res.data.content.elements.nodes.length) {
|
|
|
- res.data.content.elements.nodes = res.data.content.elements.nodes.map((obj) => {
|
|
|
- if (obj.properties.type == "BaseEquipment") {
|
|
|
- if (obj.style.default.url) {
|
|
|
- obj.style.default.url =
|
|
|
- window.img_baseurl+"/image-service/common/image_get?systemId=dataPlatform&key=" +
|
|
|
- obj.style.default.url;
|
|
|
- } else {
|
|
|
- // 默认图标
|
|
|
- obj.style.default.url =
|
|
|
- window.img_baseurl+"/image-service/common/image_get?systemId=dataPlatform&key=" +
|
|
|
- "1607752841478.svg";
|
|
|
+ window.parse = parse;
|
|
|
+ if (
|
|
|
+ res.data.content.elements.nodes &&
|
|
|
+ res.data.content.elements.nodes.length
|
|
|
+ ) {
|
|
|
+ res.data.content.elements.nodes = res.data.content.elements.nodes.map(
|
|
|
+ (obj) => {
|
|
|
+ if (obj.properties.type == "BaseEquipment") {
|
|
|
+ if (obj.style.default.url) {
|
|
|
+ obj.style.default.url =
|
|
|
+ window.img_baseurl +
|
|
|
+ "/image-service/common/image_get?systemId=dataPlatform&key=" +
|
|
|
+ obj.style.default.url;
|
|
|
+ } else {
|
|
|
+ // 默认图标
|
|
|
+ obj.style.default.url =
|
|
|
+ window.img_baseurl +
|
|
|
+ "/image-service/common/image_get?systemId=dataPlatform&key=" +
|
|
|
+ "1607752841478.svg";
|
|
|
+ }
|
|
|
}
|
|
|
+ return obj;
|
|
|
}
|
|
|
- return obj;
|
|
|
- });
|
|
|
+ );
|
|
|
}
|
|
|
parse.parseData(res.data.content.elements);
|
|
|
parse.markers.forEach((item) => {
|
|
|
- // this.scene.addItem(item);
|
|
|
+ this.scene.addItem(item);
|
|
|
});
|
|
|
parse.nodes.forEach((item) => {
|
|
|
+ // item.moveable = false;
|
|
|
+ if ("BaseEquipment" == item.data.properties.type) {
|
|
|
+ item.setEquipName();
|
|
|
+ item.setStatusPointColor("#7ed321");
|
|
|
+ }
|
|
|
// 相关事件触发
|
|
|
- // console.log('item.data.style.default.url',item.data.style.default.url)
|
|
|
item.connect("onMouseDown", this, this.onMousedown);
|
|
|
item.connect("onMouseUp", this, this.onMouseup);
|
|
|
item.connect("onMouseLeave", this, this.onMouseleave);
|
|
@@ -144,7 +157,7 @@ export default {
|
|
|
}
|
|
|
this.scene.addItem(t);
|
|
|
});
|
|
|
- this.fixWindow()
|
|
|
+ this.fixWindow();
|
|
|
},
|
|
|
// 读图成功回调
|
|
|
statDeviceIds(res) {
|
|
@@ -152,15 +165,18 @@ export default {
|
|
|
// 'url 新增路径'
|
|
|
if (res.result == "failure") return;
|
|
|
const parse = new PTopoParser();
|
|
|
- if (res.data.content.elements.nodes && res.data.content.elements.nodes.length) {
|
|
|
+ if (
|
|
|
+ res.data.content.elements.nodes &&
|
|
|
+ res.data.content.elements.nodes.length
|
|
|
+ ) {
|
|
|
let tempDatas = res.data.content.elements.nodes.map((obj) => {
|
|
|
return obj.attachObjectIds[0];
|
|
|
});
|
|
|
// console.log('tempDatas:', tempDatas)
|
|
|
setInterval(() => {
|
|
|
- this.$emit('postDeviceIds', tempDatas)
|
|
|
+ this.$emit("postDeviceIds", tempDatas);
|
|
|
}, 5000);
|
|
|
- this.$emit('postDeviceIds', tempDatas)
|
|
|
+ this.$emit("postDeviceIds", tempDatas);
|
|
|
}
|
|
|
},
|
|
|
// 图片缩小
|
|
@@ -199,12 +215,12 @@ export default {
|
|
|
// 鼠标事件移入
|
|
|
onMouseenter(item, e) {
|
|
|
// 判断是否为设备图例
|
|
|
- item.showImgShadow = true
|
|
|
+ item.showImgShadow = true;
|
|
|
console.log("鼠标移入!", item.img, e);
|
|
|
},
|
|
|
// 鼠标事件移出
|
|
|
onMouseleave(item, e) {
|
|
|
- item.showImgShadow = false
|
|
|
+ item.showImgShadow = false;
|
|
|
console.log("鼠标移出!", item, e);
|
|
|
},
|
|
|
},
|