必填参数显示出来
This commit is contained in:
parent
73ef21855a
commit
3e4a925c8c
@ -309,6 +309,39 @@ namespace CadParamPluging.UI
|
||||
AddField(def, valueKey, labelText, tip);
|
||||
}
|
||||
}
|
||||
|
||||
// 收集所有已绑定的参数 key
|
||||
var boundKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var key in (_schema?.SelectedParamKeys ?? new List<string>()))
|
||||
{
|
||||
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<ParamDefinition>())
|
||||
.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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user