diff --git a/src/apis/map/type.ts b/src/apis/map/type.ts index 473fc85..9a938ed 100644 --- a/src/apis/map/type.ts +++ b/src/apis/map/type.ts @@ -16,6 +16,9 @@ export interface MapPen extends Pen { activeAttrs?: Array; // 已激活的额外属性 properties?: unknown; // 第三方附加参数 + storageStatus?: Record; // 库位状态 + statusStyle?: string; // 状态颜色 + strokeStyle?: string; // 边框颜色 } //#region 点位 diff --git a/src/apis/scene/api.ts b/src/apis/scene/api.ts index c434190..2fa7c17 100644 --- a/src/apis/scene/api.ts +++ b/src/apis/scene/api.ts @@ -14,6 +14,7 @@ const enum API { 实时监控场景 = '/scene/monitor/:id', 实时监控真实场景 = '/scene/monitor/real/:id', + 实时监控库位状态 = '/scene/monitor/storage/:id', } export async function getSceneById(id: SceneInfo['id']): Promise { @@ -89,6 +90,17 @@ export async function saveSceneByGroupId(id: RobotGroup['id'], sid: RobotGroup[' } } +export async function monitorStorageStatusById(id: SceneInfo['id']): Promise { + if (!id) return null; + try { + const socket = await ws.create(API.实时监控库位状态.replace(':id', id)); + return socket; + } catch (error) { + console.debug(error); + return null; + } +} + export async function monitorSceneById(id: SceneInfo['id']): Promise { if (!id) return null; try { diff --git a/src/assets/themes/editor-dark.json b/src/assets/themes/editor-dark.json index 5145c90..4660f63 100644 --- a/src/assets/themes/editor-dark.json +++ b/src/assets/themes/editor-dark.json @@ -12,7 +12,14 @@ }, "point-l": { "stroke": "#595959", - "strokeActive": "#FCC947" + "strokeActive": "#FCC947", + "stroke-occupied": "#ff4d4f", + "stroke-unoccupied": "#52c41a", + "stroke-empty": "#1890ff", + "stroke-disabled": "#bfbfbf", + "stroke-enabled": "#52c41a", + "stroke-locked": "#faad14", + "stroke-unlocked": "#52c41a" }, "route": { "strokeActive": "#FCC947", diff --git a/src/assets/themes/editor-light.json b/src/assets/themes/editor-light.json index 262cc2a..4676a68 100644 --- a/src/assets/themes/editor-light.json +++ b/src/assets/themes/editor-light.json @@ -12,7 +12,14 @@ }, "point-l": { "stroke": "#595959", - "strokeActive": "#EBB214" + "strokeActive": "#EBB214", + "stroke-occupied": "#ff4d4f", + "stroke-unoccupied": "#52c41a", + "stroke-empty": "#1890ff", + "stroke-disabled": "#bfbfbf", + "stroke-enabled": "#52c41a", + "stroke-locked": "#faad14", + "stroke-unlocked": "#52c41a" }, "route": { "strokeActive": "#EBB214", diff --git a/src/components/card/point-detail-card.vue b/src/components/card/point-detail-card.vue index 5849a73..7478b84 100644 --- a/src/components/card/point-detail-card.vue +++ b/src/components/card/point-detail-card.vue @@ -52,6 +52,13 @@ const mapAreas = (type: MapAreaType): string => { }; const coArea1 = computed(() => mapAreas(MapAreaType.库区)); const coArea2 = computed(() => mapAreas(MapAreaType.互斥区)); +const storageStatus = computed(() => { + const status = pen.value?.storageStatus; + if (!status) return '暂无'; + return Object.entries(status) + .map(([key, value]) => `${key}: ${value}`) + .join(', '); +}); diff --git a/src/pages/movement-supervision.vue b/src/pages/movement-supervision.vue index 5c65a81..38bf262 100644 --- a/src/pages/movement-supervision.vue +++ b/src/pages/movement-supervision.vue @@ -1,4 +1,5 @@