refactor: 移除操作类型显示名称函数,直接使用操作类型字符串,优化代码简洁性;更新编辑器服务以支持关联存储位置

This commit is contained in:
xudan 2025-08-20 14:10:41 +08:00
parent a1e126c471
commit 0c44af67a0
2 changed files with 23 additions and 23 deletions

View File

@ -118,26 +118,6 @@ const getTaskOperations = (task: BinTaskItem) => {
return operations;
};
//
const getOperationDisplayName = (operationType: string): string => {
const operationNames: Record<string, string> = {
Load: '装载',
JackLoad: '装载',
Unload: '卸载',
JackUnload: '卸载',
Move: '移动',
Pick: '拾取',
Place: '放置',
Scan: '扫描',
Check: '检查',
Wait: '等待',
Charge: '充电',
Clean: '清理',
};
return operationNames[operationType] || operationType || '未知操作';
};
//
const binTaskData = computed(() => {
try {
@ -302,7 +282,7 @@ const binTaskData = computed(() => {
class="task-operation"
>
<a-typography-text class="operation-title">
{{ getOperationDisplayName(operationType) }}
{{ operationType }}
</a-typography-text>
<div class="operation-summary">
<span class="operation-type">{{ operation.operation || '未知操作' }}</span>

View File

@ -236,7 +236,21 @@ export class EditorService extends Meta2d {
if (!points?.length) return;
await Promise.all(
points.map(async (v) => {
const { id, name, desc, x, y, type, extensionType, robots, actions, properties, deviceId, enabled } = v;
const {
id,
name,
desc,
x,
y,
type,
extensionType,
robots,
actions,
associatedStorageLocations,
properties,
deviceId,
enabled,
} = v;
// 只有在导入场景文件时才进行反向坐标转换
let finalX = x;
let finalY = y;
@ -247,7 +261,13 @@ export class EditorService extends Meta2d {
}
await this.addPoint({ x: finalX, y: finalY }, type, id);
this.setValue(
{ id, label: name, desc, properties, point: { type, extensionType, robots, actions, deviceId, enabled } },
{
id,
label: name,
desc,
properties,
point: { type, extensionType, robots, actions, associatedStorageLocations, deviceId, enabled },
},
{ render: false, history: false, doEvent: false },
);
}),