feat: 添加启用状态字段到停靠点接口,更新相关组件以支持启用状态的显示和编辑
This commit is contained in:
parent
2f3bfa9bc4
commit
b55dae256f
@ -30,6 +30,7 @@ export interface MapPointInfo {
|
|||||||
isForbidAvoid?: boolean; // 是否禁止避让
|
isForbidAvoid?: boolean; // 是否禁止避让
|
||||||
associatedStorageLocations?: string[]; // 库位名称
|
associatedStorageLocations?: string[]; // 库位名称
|
||||||
deviceId?: string; // 设备ID
|
deviceId?: string; // 设备ID
|
||||||
|
enabled?: 0 | 1; // 是否启用(仅停靠点使用,0=禁用,1=启用)
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ export interface StandardScenePoint {
|
|||||||
config?: object; // 其它属性配置(可按需增加)
|
config?: object; // 其它属性配置(可按需增加)
|
||||||
properties?: unknown; // 附加数据(前端不做任何处理)
|
properties?: unknown; // 附加数据(前端不做任何处理)
|
||||||
deviceId?: string; // 设备ID
|
deviceId?: string; // 设备ID
|
||||||
|
enabled?: 0 | 1; // 是否启用(仅停靠点使用,0=禁用,1=启用)
|
||||||
}
|
}
|
||||||
export interface StandardSceneRoute {
|
export interface StandardSceneRoute {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -123,6 +123,10 @@ const getStorageStatusTag = (location: StorageLocationInfo) => {
|
|||||||
<a-typography-text>{{ bindRobot || $t('暂无') }}</a-typography-text>
|
<a-typography-text>{{ bindRobot || $t('暂无') }}</a-typography-text>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
<a-list-item v-if="point.type === MapPointType.停靠点">
|
||||||
|
<a-typography-text type="secondary">{{ $t('启用状态') }}</a-typography-text>
|
||||||
|
<a-typography-text>{{ point.enabled === 1 ? $t('已启用') : $t('已禁用') }}</a-typography-text>
|
||||||
|
</a-list-item>
|
||||||
<a-list-item v-if="MapPointType.等待点 === point.type">
|
<a-list-item v-if="MapPointType.等待点 === 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>
|
||||||
|
@ -198,6 +198,20 @@ function onChangeLocation(i: number, v: string) {
|
|||||||
</a-list>
|
</a-list>
|
||||||
</a-collapse-panel>
|
</a-collapse-panel>
|
||||||
|
|
||||||
|
<a-collapse-panel v-if="point.type === MapPointType.停靠点" :header="$t('是否启用')">
|
||||||
|
<a-row :gutter="[8, 8]">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-select
|
||||||
|
:value="point.enabled ?? 1"
|
||||||
|
@change="editor.updatePen(id, { point: { ...point, enabled: $event as 0 | 1 } }, false)"
|
||||||
|
>
|
||||||
|
<a-select-option :value="1">{{ $t('是') }}</a-select-option>
|
||||||
|
<a-select-option :value="0">{{ $t('否') }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-collapse-panel>
|
||||||
|
|
||||||
<a-collapse-panel v-if="MapPointType.等待点 === point.type" :header="$t('绑定动作点')">
|
<a-collapse-panel v-if="MapPointType.等待点 === point.type" :header="$t('绑定动作点')">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-button class="icon-btn" size="small" @click.stop="refBindPoint?.open(pen, MapPointType.动作点)">
|
<a-button class="icon-btn" size="small" @click.stop="refBindPoint?.open(pen, MapPointType.动作点)">
|
||||||
|
@ -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, extensionType, robots, actions, properties, deviceId } = v;
|
const { id, name, desc, x, y, type, extensionType, robots, actions, properties, deviceId, enabled } = 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, extensionType, robots, actions, deviceId } },
|
{ id, label: name, desc, properties, point: { type, extensionType, robots, actions, deviceId, enabled } },
|
||||||
{ render: false, history: false, doEvent: false },
|
{ render: false, history: false, doEvent: false },
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -204,7 +204,7 @@ export class EditorService extends Meta2d {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const { id, label, desc, properties } = pen;
|
const { id, label, desc, properties } = pen;
|
||||||
const { type, extensionType, robots, actions, associatedStorageLocations, deviceId } = pen.point;
|
const { type, extensionType, robots, actions, associatedStorageLocations, deviceId, enabled } = pen.point;
|
||||||
const { x = 0, y = 0 } = this.getPointRect(pen) ?? {};
|
const { x = 0, y = 0 } = this.getPointRect(pen) ?? {};
|
||||||
|
|
||||||
// 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放
|
// 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放
|
||||||
@ -233,6 +233,9 @@ export class EditorService extends Meta2d {
|
|||||||
if (MapPointType.自动门点 === type) {
|
if (MapPointType.自动门点 === type) {
|
||||||
point.deviceId = deviceId;
|
point.deviceId = deviceId;
|
||||||
}
|
}
|
||||||
|
if (MapPointType.停靠点 === type) {
|
||||||
|
point.enabled = enabled;
|
||||||
|
}
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
#mapSceneRoute(pen?: MapPen): StandardSceneRoute | null {
|
#mapSceneRoute(pen?: MapPen): StandardSceneRoute | null {
|
||||||
@ -719,6 +722,13 @@ export class EditorService extends Meta2d {
|
|||||||
*/
|
*/
|
||||||
public async addPoint(p: Point, type = MapPointType.普通点, id?: string): Promise<void> {
|
public async addPoint(p: Point, type = MapPointType.普通点, id?: string): Promise<void> {
|
||||||
id ||= s8();
|
id ||= s8();
|
||||||
|
const pointInfo: MapPointInfo = { type };
|
||||||
|
|
||||||
|
// 为停靠点设置默认启用状态
|
||||||
|
if (type === MapPointType.停靠点) {
|
||||||
|
pointInfo.enabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
const pen: MapPen = {
|
const pen: MapPen = {
|
||||||
...p,
|
...p,
|
||||||
...this.#mapPoint(type),
|
...this.#mapPoint(type),
|
||||||
@ -727,7 +737,7 @@ export class EditorService extends Meta2d {
|
|||||||
name: 'point',
|
name: 'point',
|
||||||
tags: ['point'],
|
tags: ['point'],
|
||||||
label: `P${id}`,
|
label: `P${id}`,
|
||||||
point: { type },
|
point: pointInfo,
|
||||||
locked: LockState.DisableEdit,
|
locked: LockState.DisableEdit,
|
||||||
};
|
};
|
||||||
pen.x! -= pen.width! / 2;
|
pen.x! -= pen.width! / 2;
|
||||||
@ -746,6 +756,13 @@ export class EditorService extends Meta2d {
|
|||||||
const rect = this.getPointRect(pen);
|
const rect = this.getPointRect(pen);
|
||||||
if (isNil(rect)) return;
|
if (isNil(rect)) return;
|
||||||
const point = this.#mapPoint(type);
|
const point = this.#mapPoint(type);
|
||||||
|
const pointInfo: MapPointInfo = { type };
|
||||||
|
|
||||||
|
// 为停靠点设置默认启用状态
|
||||||
|
if (type === MapPointType.停靠点) {
|
||||||
|
pointInfo.enabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.setValue(
|
this.setValue(
|
||||||
{
|
{
|
||||||
id,
|
id,
|
||||||
@ -753,7 +770,7 @@ export class EditorService extends Meta2d {
|
|||||||
y: rect.y - point.height / 2,
|
y: rect.y - point.height / 2,
|
||||||
...point,
|
...point,
|
||||||
...this.#mapPointImage(type),
|
...this.#mapPointImage(type),
|
||||||
point: { type },
|
point: pointInfo,
|
||||||
},
|
},
|
||||||
{ render: true, history: true, doEvent: true },
|
{ render: true, history: true, doEvent: true },
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user