|
@@ -13,14 +13,13 @@
|
|
|
<script>
|
|
|
import { SFloorParser, getJsonz } from "@persagy-web/big";
|
|
|
import { SImageItem, SImageShowType } from "@persagy-web/graph";
|
|
|
-import { SPlanView, SPlanParser, SPlanScene, SPlanDecorator, SPlanEquipment } from "@/lib";
|
|
|
+import { SPlanView, SPlanParser, SPlanScene, SPlanDecorator, SPlanEquipment, SPlanZone } from "@/lib";
|
|
|
import { SGraphPropertyCommand } from "@persagy-web/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 { publishGraph } from "@/api/home";
|
|
|
import { planerSave, planerRead, planerPublish } from "@/api/labsl";
|
|
|
import { equipQuery } from "@/api/equipcomponent";
|
|
|
import { imgBaseUrl } from "@/api/imageservice";
|
|
@@ -103,7 +102,8 @@ export default {
|
|
|
"SETPROJECT",
|
|
|
"SETVERSION",
|
|
|
"ADDEQUIP",
|
|
|
- "DELETEQUIP",
|
|
|
+ "ADDZONE",
|
|
|
+ "DELETEITEM",
|
|
|
"INITSTYLE",
|
|
|
"INITRULELIST",
|
|
|
"INITOBJEXTINFO",
|
|
@@ -263,7 +263,7 @@ export default {
|
|
|
bus.$off("deleteItem");
|
|
|
bus.$on("deleteItem", (val) => {
|
|
|
this.scene.deleteItem([val]);
|
|
|
- this.DELETEQUIP();
|
|
|
+ this.DELETEITEM();
|
|
|
});
|
|
|
// 复制
|
|
|
bus.$off("copy");
|
|
@@ -359,20 +359,18 @@ export default {
|
|
|
this.INITRULELIST(res.content.ruleList);
|
|
|
this.ruleNum = res.content.ruleList.length;
|
|
|
res.content.ruleList.forEach(async (rule) => {
|
|
|
- this.loadedRuleNum++;
|
|
|
if (rule.commond && rule.commond === "query") {
|
|
|
- if (rule.returnType && rule.returnType === "equip") {
|
|
|
- const params = { ...rule.params, buildingId: this.buildingId, floorId: this.floorId };
|
|
|
+ const params = { ...rule.params, buildingId: this.buildingId, floorId: this.floorId };
|
|
|
+ if (rule?.returnType === "equip") {
|
|
|
const res = await equipQuery(params);
|
|
|
if (res.result === "success") this.mergeEquipData(res.content);
|
|
|
- } else if (rule.returnType && rule.returnType === "zone") {
|
|
|
- setTimeout(() => {
|
|
|
- console.error("请求空间数据");
|
|
|
- if (this.ruleNum === this.loadedRuleNum) this.loadMarkRelation();
|
|
|
- }, 1000);
|
|
|
- } else if (rule.returnType && rule.returnType === "equipGroup") {
|
|
|
+ } else if (rule?.returnType === "zone") {
|
|
|
+ const res = await equipQuery(params);
|
|
|
+ if (res.result === "success") this.mergeZoneData(res.content);
|
|
|
+ } else if (rule?.returnType === "equipGroup") {
|
|
|
setTimeout(() => {
|
|
|
console.error("请求设备组数据");
|
|
|
+ this.loadedRuleNum++;
|
|
|
if (this.ruleNum === this.loadedRuleNum) this.loadMarkRelation();
|
|
|
}, 1000);
|
|
|
}
|
|
@@ -381,6 +379,7 @@ export default {
|
|
|
* 暂未实现
|
|
|
*/
|
|
|
console.error("删除命令!!!", rule);
|
|
|
+ this.loadedRuleNum++;
|
|
|
if (this.ruleNum === this.loadedRuleNum) this.loadMarkRelation();
|
|
|
}
|
|
|
});
|
|
@@ -425,6 +424,46 @@ export default {
|
|
|
this.ADDEQUIP(equipItem);
|
|
|
}
|
|
|
});
|
|
|
+ this.loadedRuleNum++;
|
|
|
+ if (this.ruleNum === this.loadedRuleNum) this.loadMarkRelation();
|
|
|
+ },
|
|
|
+ // 解析空间数据
|
|
|
+ mergeZoneData(zoneList) {
|
|
|
+ zoneList.forEach((zone) => {
|
|
|
+ if (!this.zoneItemMap[zone.id]) {
|
|
|
+ if (this.objExtInfo[zone.id]) {
|
|
|
+ zone = { ...this.objExtInfo[zone.id], ...zone };
|
|
|
+ }
|
|
|
+ if (!zone.pos) {
|
|
|
+ //如果未维护设备在图中的坐标
|
|
|
+ if (zone.locationJson) {
|
|
|
+ // 判断设备是否维护BIM坐标
|
|
|
+ const { x, y, z } = zone.locationJson;
|
|
|
+ zone.pos = { x, y: -y, z };
|
|
|
+ } else {
|
|
|
+ // 否则显示默认坐标位置
|
|
|
+ zone.pos = { x: 0, y: 0, z: 0 };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 添加设备对象类型
|
|
|
+ zone.properties = { type: "BaseZone" };
|
|
|
+ const zoneItem = new SPlanZone(null, zone);
|
|
|
+ zoneItem.selectable = true;
|
|
|
+ zoneItem.moveable = true;
|
|
|
+ zoneItem.connect("finishCreated", this.scene, this.scene.finishCreated);
|
|
|
+ zoneItem.connect("onContextMenu", this, this.scene.getItem);
|
|
|
+ if (this.styleMap[zone.id]) {
|
|
|
+ SPlanDecorator.zoneDecorator(zoneItem, this.styleMap[zone.id]);
|
|
|
+ } else if (this.styleMap[zone.classCode]) {
|
|
|
+ SPlanDecorator.zoneDecorator(zoneItem, this.styleMap[zone.classCode]);
|
|
|
+ } else {
|
|
|
+ SPlanDecorator.zoneDecorator(zoneItem, this.styleMap["defaultEquipStyle"]);
|
|
|
+ }
|
|
|
+ this.scene.addItem(zoneItem);
|
|
|
+ this.ADDZONE(zoneItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.loadedRuleNum++;
|
|
|
if (this.ruleNum === this.loadedRuleNum) this.loadMarkRelation();
|
|
|
},
|
|
|
// 加载通用元素和管线元素
|
|
@@ -484,7 +523,6 @@ export default {
|
|
|
});
|
|
|
if (this.view?.scene) this.view.fitSceneToView();
|
|
|
},
|
|
|
-
|
|
|
// 生成快照并保存草稿
|
|
|
saveTopoDraft() {
|
|
|
const uuid = uuidv1();
|