feat: 在区域详情和编辑卡片中新增约束区最大可容纳AMR数配置,优化区域服务逻辑

This commit is contained in:
xudan 2025-07-01 16:02:12 +08:00
parent 8ef5374fa3
commit c8085751f9
3 changed files with 13 additions and 7 deletions

View File

@ -63,13 +63,19 @@ const bindRoute = computed<string>(
</a-row>
<a-list class="block mt-16">
<a-list-item v-if="area.type === MapAreaType.约束区">
<a-flex :gap="8" vertical>
<a-typography-text type="secondary">{{ $t('最大可容纳AMR数') }}</a-typography-text>
<a-typography-text>{{ pen.area?.maxAmr ?? $t('暂无') }}</a-typography-text>
</a-flex>
</a-list-item>
<a-list-item v-if="MapAreaType.库区 === area.type">
<a-flex :gap="8" vertical>
<a-typography-text type="secondary">{{ $t('绑定动作点') }}</a-typography-text>
<a-typography-text>{{ bindAction || $t('暂无') }}</a-typography-text>
</a-flex>
</a-list-item>
<a-list-item v-if="[MapAreaType.互斥区, MapAreaType.非互斥区].includes(area.type)">
<a-list-item v-if="[MapAreaType.互斥区, MapAreaType.非互斥区, MapAreaType.约束区].includes(area.type)">
<a-flex :gap="8" vertical>
<a-typography-text type="secondary">{{ $t('绑定站点') }}</a-typography-text>
<a-typography-text>{{ bindPoint || $t('暂无') }}</a-typography-text>

View File

@ -74,7 +74,7 @@ const routes = computed<string[]>(
class="full"
:placeholder="$t('请输入数量')"
:min="0"
:max="99"
:max="9999"
:value="pen.area?.maxAmr"
@change="editor.updateArea(id, { maxAmr: $event as number })"
/>

View File

@ -146,10 +146,10 @@ export class EditorService extends Meta2d {
if (!areas?.length) return;
await Promise.all(
areas.map(async (v) => {
const { id, name, desc, x, y, w, h, type, points, routes, properties } = v;
const { id, name, desc, x, y, w, h, type, points, routes, maxAmr, properties } = v;
await this.addArea({ x, y }, { x: x + w, y: y + h }, type, id);
this.setValue(
{ id, label: name, desc, properties, area: { type, points, routes } },
{ id, label: name, desc, properties, area: { type, points, routes, maxAmr } },
{ render: false, history: false, doEvent: false },
);
}),
@ -241,6 +241,9 @@ export class EditorService extends Meta2d {
config: {},
properties,
};
if (type === MapAreaType.) {
area.maxAmr = maxAmr;
}
if (MapAreaType. === type) {
area.points = points?.filter((v) => this.getPenById(v)?.point?.type === MapPointType.);
}
@ -255,9 +258,6 @@ export class EditorService extends Meta2d {
if (MapAreaType. === type) {
area.routes = routes?.filter((v) => !isEmpty(this.getPenById(v)?.area));
}
if (MapAreaType. === type) {
area.maxAmr = maxAmr;
}
return area;
}
//#endregion