|
@@ -21,13 +21,13 @@ import {
|
|
|
PTopoParser,
|
|
|
PTopoView,
|
|
|
} from "@/components/editClass/persagy-edit";
|
|
|
-// import { SGraphView } from "@persagy-web/graph";
|
|
|
-// import { SFloorParser } from "@persagy-web/big/lib";
|
|
|
+import { SBaseEquipment } from "@/components/editClass/big-edit";
|
|
|
import topoTooltip from "./topoTooltip.vue";
|
|
|
import { mapState, mapMutations } from "vuex";
|
|
|
import base64ToFile from "@/utils/base64ToFile";
|
|
|
import { v1 as uuidv1 } from "uuid";
|
|
|
import bus from "@/bus/bus";
|
|
|
+import axios from "axios";
|
|
|
import {
|
|
|
saveGroup,
|
|
|
readGroup,
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
readPubGroup,
|
|
|
} from "@/api/editer";
|
|
|
import { publishGraph } from "@/api/home";
|
|
|
+import crypto from "crypto-js/";
|
|
|
export default {
|
|
|
components: { topoTooltip },
|
|
|
data() {
|
|
@@ -88,6 +89,8 @@ export default {
|
|
|
"SETPROJECT",
|
|
|
"SETCATEGROY",
|
|
|
"SETISPUB",
|
|
|
+ "ADDEQUIPITEM",
|
|
|
+ "EDITEQUIPITEM",
|
|
|
]),
|
|
|
// 恢复命令状态
|
|
|
clearCmdStatus() {
|
|
@@ -184,9 +187,14 @@ export default {
|
|
|
this.addEquipmentList(val);
|
|
|
});
|
|
|
// 更改设备信息点
|
|
|
- bus.$off('changeEquipMsgPoint');
|
|
|
+ bus.$off("changeEquipMsgPoint");
|
|
|
bus.$on("changeEquipMsgPoint", (val) => {
|
|
|
- this.scene.changeEquipMsgPoint(val)
|
|
|
+ this.scene.changeEquipMsgPoint(val);
|
|
|
+ });
|
|
|
+ // 选中item
|
|
|
+ bus.$off("chioceItem");
|
|
|
+ bus.$on("chioceItem", (item) => {
|
|
|
+ this.scene.toggleItem(item);
|
|
|
});
|
|
|
},
|
|
|
// 读取拓扑图
|
|
@@ -224,8 +232,11 @@ export default {
|
|
|
item.connect("finishCreated", this.scene, this.scene.finishCreated);
|
|
|
item.connect("onContextMenu", this, this.scene.getItem);
|
|
|
this.scene.addItem(item);
|
|
|
+ // 如果为设备则存于vuex中便于联动
|
|
|
+ if (item instanceof SBaseEquipment) {
|
|
|
+ this.ADDEQUIPITEM(item);
|
|
|
+ }
|
|
|
});
|
|
|
- this.view.fitSceneToView();
|
|
|
},
|
|
|
// 保存草稿
|
|
|
saveTopoDraft() {
|
|
@@ -341,9 +352,13 @@ export default {
|
|
|
addEquipmentList(list) {
|
|
|
const parse = new PTopoParser();
|
|
|
list.forEach((item, i) => {
|
|
|
- const x = (i + 1) * 100;
|
|
|
- const baseUrl = "/image-service/common/image_get?systemId=dataPlatform&key=";
|
|
|
- const url = item.url ? baseUrl+ item.url : require("./../../assets/images/equip/lengganji.svg");
|
|
|
+ const x = (i + 1) * 100 + 300;
|
|
|
+ const baseUrl =
|
|
|
+ "/image-service/common/image_get?systemId=dataPlatform&key=";
|
|
|
+ const url = baseUrl + item.url;
|
|
|
+ let svg2Base = "";
|
|
|
+ let EquipHeight = this.canvasHeight - 100;
|
|
|
+
|
|
|
let data = {
|
|
|
/** 名称 */
|
|
|
name: "基础设备",
|
|
@@ -358,21 +373,28 @@ export default {
|
|
|
properties: {
|
|
|
type: "BaseEquipment",
|
|
|
classCode: item.classCode, // 设备类型
|
|
|
+ localId: item.localId, // 本地编码
|
|
|
+ localName: item.localName, //本地名称
|
|
|
},
|
|
|
style: {
|
|
|
default: {
|
|
|
strokecolor: "#c0ccda",
|
|
|
url: url,
|
|
|
+ base64Url: "",
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
parse.addNode(data);
|
|
|
- parse.nodes.forEach((item) => {
|
|
|
- item.connect("finishCreated", this.scene, this.scene.finishCreated);
|
|
|
- item.connect("onContextMenu", this, this.scene.getItem);
|
|
|
- this.scene.addItem(item);
|
|
|
- });
|
|
|
- this.view.fitSceneToView();
|
|
|
+ });
|
|
|
+ // 添加到 scence 中
|
|
|
+ parse.nodes.forEach((item) => {
|
|
|
+ item.connect("finishCreated", this.scene, this.scene.finishCreated);
|
|
|
+ item.connect("onContextMenu", this, this.scene.getItem);
|
|
|
+ this.scene.addItem(item);
|
|
|
+ // 如果为设备则存于vuex中便于联动
|
|
|
+ if (item instanceof SBaseEquipment) {
|
|
|
+ this.ADDEQUIPITEM(item);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
},
|