From a73571bd73f8cd59235e44c2158b44e833be8a36 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 2 Feb 2026 15:26:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(annotation):=20=E4=BC=98=E5=8C=96=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=85=8D=E7=BD=AE=E6=A0=91=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=B1=9E=E6=80=A7=E5=A1=AB=E5=85=85=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改对象配置属性填充条件,仅在名称不存在时设置默认值 - 为控制配置添加标签类别判断逻辑 - 区分标注类和布局类控件的属性填充策略 - 标注类控件始终填充必需属性,布局类控件仅在需要时填充 - 修复属性值设置逻辑,确保正确引用名称属性 --- .../TemplateConfigurationTreeEditor.tsx | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx index 19ce402..6b7f01f 100644 --- a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx +++ b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx @@ -247,18 +247,34 @@ const createNode = ( attrs[attr] = ""; }); - if (objectConfig && attrs.name !== undefined) { + if (objectConfig) { const name = getDefaultName(tag); - attrs.name = name; - if (attrs.value !== undefined) { - attrs.value = `$${name}`; + if (!attrs.name) { + attrs.name = name; + } + if (!attrs.value) { + attrs.value = `$${attrs.name}`; } } - if (controlConfig && attrs.name !== undefined) { - attrs.name = getDefaultName(tag); - if (attrs.toName !== undefined) { - attrs.toName = objectNames[0] || ""; + if (controlConfig) { + const isLabeling = controlConfig.category === "labeling"; + + if (isLabeling) { + if (!attrs.name) { + attrs.name = getDefaultName(tag); + } + if (!attrs.toName) { + attrs.toName = objectNames[0] || ""; + } + } else { + // For layout controls, only fill if required + if (attrs.name !== undefined && !attrs.name) { + attrs.name = getDefaultName(tag); + } + if (attrs.toName !== undefined && !attrs.toName) { + attrs.toName = objectNames[0] || ""; + } } }