feat: 添加点位扩展类型支持,更新相关接口和组件以处理扩展类型信息
This commit is contained in:
parent
d5b7a29163
commit
9a1cd82a26
@ -18,6 +18,8 @@ export enum MapPointType {
|
|||||||
临时避让点,
|
临时避让点,
|
||||||
/** 库区点 - 仓储作业区域 */
|
/** 库区点 - 仓储作业区域 */
|
||||||
库区点,
|
库区点,
|
||||||
|
/** 密集库区点 - 密集库区点位 */
|
||||||
|
密集库区点,
|
||||||
|
|
||||||
/** 电梯点 - 机器人乘坐电梯的专用点位 */
|
/** 电梯点 - 机器人乘坐电梯的专用点位 */
|
||||||
电梯点 = 11,
|
电梯点 = 11,
|
||||||
@ -42,6 +44,17 @@ export const MAP_POINT_TYPES = Object.freeze(
|
|||||||
);
|
);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点位扩展类型映射,用于UI显示和选择
|
||||||
|
*/
|
||||||
|
export const MAP_POINT_EXTENSION_TYPES = Object.freeze({
|
||||||
|
[MapPointType.等待点]: [MapPointType.临时避让点],
|
||||||
|
[MapPointType.库区点]: [MapPointType.临时避让点],
|
||||||
|
[MapPointType.临时避让点]: [MapPointType.等待点, MapPointType.库区点, MapPointType.密集库区点],
|
||||||
|
[MapPointType.密集库区点]: [MapPointType.动作点, MapPointType.临时避让点],
|
||||||
|
[MapPointType.动作点]: [MapPointType.密集库区点],
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图路线类型枚举
|
* 地图路线类型枚举
|
||||||
* 定义了连接点位之间的路径类型
|
* 定义了连接点位之间的路径类型
|
||||||
|
@ -23,6 +23,7 @@ export interface MapPen extends Pen {
|
|||||||
//#region 点位
|
//#region 点位
|
||||||
export interface MapPointInfo {
|
export interface MapPointInfo {
|
||||||
type: MapPointType; // 点位类型
|
type: MapPointType; // 点位类型
|
||||||
|
extensionType?: MapPointType; // 扩展类型
|
||||||
robots?: Array<RobotInfo['id']>; // 绑定机器人id集合
|
robots?: Array<RobotInfo['id']>; // 绑定机器人id集合
|
||||||
actions?: Array<string>; // 绑定动作点id集合
|
actions?: Array<string>; // 绑定动作点id集合
|
||||||
isBlock?: boolean; // 是否禁行
|
isBlock?: boolean; // 是否禁行
|
||||||
|
@ -38,6 +38,7 @@ export interface StandardScenePoint {
|
|||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
type: number; // 点位类型
|
type: number; // 点位类型
|
||||||
|
extensionType?: number; // 扩展类型
|
||||||
robots?: Array<string>; // 绑定机器人id集合
|
robots?: Array<string>; // 绑定机器人id集合
|
||||||
actions?: Array<string>; // 绑定动作点id集合
|
actions?: Array<string>; // 绑定动作点id集合
|
||||||
associatedStorageLocations?: string[]; // 库位名称
|
associatedStorageLocations?: string[]; // 库位名称
|
||||||
|
@ -76,6 +76,10 @@ const coArea2 = computed<string>(() => mapAreas(MapAreaType.互斥区));
|
|||||||
<a-typography-text type="secondary">{{ $t('站点坐标') }}</a-typography-text>
|
<a-typography-text type="secondary">{{ $t('站点坐标') }}</a-typography-text>
|
||||||
<a-typography-text>({{ rect.x?.toFixed() }},{{ rect.y?.toFixed() }})</a-typography-text>
|
<a-typography-text>({{ rect.x?.toFixed() }},{{ rect.y?.toFixed() }})</a-typography-text>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
<a-list-item v-if="point.extensionType">
|
||||||
|
<a-typography-text type="secondary">{{ $t('扩展类型') }}</a-typography-text>
|
||||||
|
<a-typography-text>{{ $t(MapPointType[point.extensionType]) }}</a-typography-text>
|
||||||
|
</a-list-item>
|
||||||
<a-list-item v-if="[MapPointType.充电点, MapPointType.停靠点].includes(point.type)">
|
<a-list-item v-if="[MapPointType.充电点, MapPointType.停靠点].includes(point.type)">
|
||||||
<a-flex :gap="8" vertical>
|
<a-flex :gap="8" vertical>
|
||||||
<a-typography-text type="secondary">{{ $t('绑定机器人') }}</a-typography-text>
|
<a-typography-text type="secondary">{{ $t('绑定机器人') }}</a-typography-text>
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import { MAP_POINT_TYPES, MapAreaType, type MapPen, type MapPointInfo, MapPointType, type Rect } from '@api/map';
|
import {
|
||||||
|
MAP_POINT_EXTENSION_TYPES,
|
||||||
|
MAP_POINT_TYPES,
|
||||||
|
MapAreaType,
|
||||||
|
type MapPen,
|
||||||
|
type MapPointInfo,
|
||||||
|
MapPointType,
|
||||||
|
type Rect,
|
||||||
|
} from '@api/map';
|
||||||
import type { RobotInfo } from '@api/robot';
|
import type { RobotInfo } from '@api/robot';
|
||||||
import type { PointBindModalRef } from '@common/modal/point-bind-modal.vue';
|
import type { PointBindModalRef } from '@common/modal/point-bind-modal.vue';
|
||||||
import type { RobotBindModalRef } from '@common/modal/robot-bind-modal.vue';
|
import type { RobotBindModalRef } from '@common/modal/robot-bind-modal.vue';
|
||||||
@ -227,6 +235,26 @@ function onChangeLocation(i: number, v: string) {
|
|||||||
</a-flex>
|
</a-flex>
|
||||||
</a-collapse-panel>
|
</a-collapse-panel>
|
||||||
|
|
||||||
|
<a-collapse-panel
|
||||||
|
v-if="Object.keys(MAP_POINT_EXTENSION_TYPES).map(Number).includes(point.type)"
|
||||||
|
:header="$t('扩展类型')"
|
||||||
|
>
|
||||||
|
<a-select
|
||||||
|
:value="point.extensionType"
|
||||||
|
:placeholder="$t('请选择扩展类型')"
|
||||||
|
@change="editor.updatePen(id, { point: { ...point, extensionType: $event as MapPointType } }, false)"
|
||||||
|
allow-clear
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="extType in MAP_POINT_EXTENSION_TYPES[point.type as keyof typeof MAP_POINT_EXTENSION_TYPES]"
|
||||||
|
:key="extType"
|
||||||
|
:value="extType"
|
||||||
|
>
|
||||||
|
{{ $t(MapPointType[extType]) }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-collapse-panel>
|
||||||
|
|
||||||
<a-collapse-panel
|
<a-collapse-panel
|
||||||
v-if="
|
v-if="
|
||||||
[
|
[
|
||||||
|
@ -110,10 +110,10 @@ export class EditorService extends Meta2d {
|
|||||||
if (!points?.length) return;
|
if (!points?.length) return;
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
points.map(async (v) => {
|
points.map(async (v) => {
|
||||||
const { id, name, desc, x, y, type, robots, actions, properties } = v;
|
const { id, name, desc, x, y, type, extensionType, robots, actions, properties } = v;
|
||||||
await this.addPoint({ x, y }, type, id);
|
await this.addPoint({ x, y }, type, id);
|
||||||
this.setValue(
|
this.setValue(
|
||||||
{ id, label: name, desc, properties, point: { type, robots, actions } },
|
{ id, label: name, desc, properties, point: { type, extensionType, robots, actions } },
|
||||||
{ render: false, history: false, doEvent: false },
|
{ render: false, history: false, doEvent: false },
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -191,7 +191,7 @@ export class EditorService extends Meta2d {
|
|||||||
#mapScenePoint(pen?: MapPen): StandardScenePoint | null {
|
#mapScenePoint(pen?: MapPen): StandardScenePoint | null {
|
||||||
if (!pen?.id || isEmpty(pen?.point)) return null;
|
if (!pen?.id || isEmpty(pen?.point)) return null;
|
||||||
const { id, label, desc, properties } = pen;
|
const { id, label, desc, properties } = pen;
|
||||||
const { type, robots, actions, associatedStorageLocations } = pen.point;
|
const { type, extensionType, robots, actions, associatedStorageLocations } = pen.point;
|
||||||
const { x = 0, y = 0 } = this.getPointRect(pen) ?? {};
|
const { x = 0, y = 0 } = this.getPointRect(pen) ?? {};
|
||||||
|
|
||||||
// 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放
|
// 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放
|
||||||
@ -204,6 +204,7 @@ export class EditorService extends Meta2d {
|
|||||||
x: transformedCoords.x,
|
x: transformedCoords.x,
|
||||||
y: transformedCoords.y,
|
y: transformedCoords.y,
|
||||||
type,
|
type,
|
||||||
|
extensionType,
|
||||||
config: {},
|
config: {},
|
||||||
properties,
|
properties,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user