|
@@ -193,6 +193,10 @@ export default {
|
|
|
bus.$on("setItemStatus", (val) => {
|
|
|
this.scene.setItemStatus();
|
|
|
});
|
|
|
+ // 手动添加设备实例
|
|
|
+ bus.$on("addEquipment", (val) => {
|
|
|
+ this.addEquipmentList(val);
|
|
|
+ });
|
|
|
},
|
|
|
// 读取拓扑图
|
|
|
readtopoMsg() {
|
|
@@ -229,7 +233,42 @@ export default {
|
|
|
item.connect("onContextMenu", this, this.scene.getItem);
|
|
|
this.scene.addItem(item);
|
|
|
});
|
|
|
- this.view.fitSceneToView()
|
|
|
+ this.view.fitSceneToView();
|
|
|
+ },
|
|
|
+ // 手动添加设备
|
|
|
+ addEquipmentList(list) {
|
|
|
+ const parse = new PTopoParser();
|
|
|
+ list.forEach((item, i) => {
|
|
|
+ x = (i + 1) * 100;
|
|
|
+ let data = {
|
|
|
+ /** 名称 */
|
|
|
+ name: "基础设备",
|
|
|
+ /** 返回物理世界对象 ID 列表 */
|
|
|
+ attachObjectIds: [item.id],
|
|
|
+ size: { width: 50, height: 50 },
|
|
|
+ /** 图标 (Image),线类型 (Line) */
|
|
|
+ type: "Image",
|
|
|
+ /** 位置 */
|
|
|
+ pos: { x: x, y: 100 },
|
|
|
+ /** 由应用自己定义 */
|
|
|
+ properties: {
|
|
|
+ type: "BaseEquipment",
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ default: {
|
|
|
+ strokecolor: "#c0ccda",
|
|
|
+ url: require("./../../assets/images/equip/lengganji.svg"),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ 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();
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
watch: {
|