From 3e4a925c8c2df22ccae3a6f2eeaa328a21fd5745 Mon Sep 17 00:00:00 2001 From: sladro Date: Thu, 18 Dec 2025 15:29:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=85=E5=A1=AB=E5=8F=82=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/DrawingParamsForm.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UI/DrawingParamsForm.cs b/UI/DrawingParamsForm.cs index e2d1150..7c9b59e 100644 --- a/UI/DrawingParamsForm.cs +++ b/UI/DrawingParamsForm.cs @@ -309,6 +309,39 @@ namespace CadParamPluging.UI AddField(def, valueKey, labelText, tip); } } + + // 收集所有已绑定的参数 key + var boundKeys = new HashSet(StringComparer.OrdinalIgnoreCase); + foreach (var key in (_schema?.SelectedParamKeys ?? new List())) + { + if (!string.IsNullOrWhiteSpace(key)) + { + boundKeys.Add(key.Trim()); + } + } + foreach (var b in noteBindings) + { + var key = (b.ParamKey ?? string.Empty).Trim(); + if (key.Length > 0) + { + boundKeys.Add(key); + } + } + + // 查找必填但未绑定的参数 + var unboundRequiredDefs = (_catalog.Items ?? Enumerable.Empty()) + .Where(p => p != null && p.Required && !boundKeys.Contains(p.Key ?? string.Empty)) + .OrderBy(p => p.Order) + .ToList(); + + if (unboundRequiredDefs.Count > 0) + { + AddSectionHeader("其他必填参数"); + foreach (var def in unboundRequiredDefs) + { + AddField(def, def.Key, def.Label, null); + } + } } private string BuildOccurrenceTip(int placeholderIndex)