diff --git a/src/commands/form/_smart_props.ts b/src/commands/form/_smart_props.ts index 4fcb0ea..06a7115 100644 --- a/src/commands/form/_smart_props.ts +++ b/src/commands/form/_smart_props.ts @@ -190,9 +190,17 @@ export async function applySmartProps( // BS-新61: select 字段字典 if (jk === 'select' && aiProp.dictionaryType && !cfg.dictionaryType) { - cfg.dictionaryType = aiProp.dictionaryType cfg.dataType = 'dictionary' + // v0.18+ (2026-07-07): LLM 可能返 enCode (s52.status) 或 dict id (UUID) + // 优先按 id 匹配; 兜底按 enCode 匹配 const matched = ctx.dicts.find((d: any) => d.id === aiProp.dictionaryType) + || ctx.dicts.find((d: any) => d.enCode === aiProp.dictionaryType) + if (matched) { + cfg.dictionaryType = matched.id // 写 id (JNPF schema 要求) + } else { + cfg.dictionaryType = aiProp.dictionaryType // 兜底: 写 LLM 原值 + log.warn(`smartProps: ${vm} dictionaryType="${aiProp.dictionaryType}" 在 ctx.dicts 未找到匹配`) + } applied.push({ field: vm, bs: 'BS-新61',