+ 指标定义清单 · {metrics.length} 项
+ {noticeText}
+ {progress &&
+
本次处理 {progress.total} 项:已生成 {progress.completed} 项,待处理 {progress.pending} 项,需补充信息 {progress.blocked} 项
+
+ {draft.status === 'drafting' && !!progress.active_names.length &&
正在处理:{progress.active_names.join('、')}
}
+ {!!draft.definition_issues?.length &&
另有 {draft.definition_issues.length} 项因来源缺失或定义冲突暂未自动处理,详见清单。
}
+
}
+ {canStart &&
+ {partial ? `已选择 ${picked.length} 项` : `将自动处理 ${automatic.length} 项`}
+
+
}
+ {canStart &&
+
+
+
}
+ {!canStart && metrics.length > 6 && (
+
+ {([
+ ['all', `全部(${metrics.length})`, true],
+ ['unresolved', `待补充或未过(${unresolvedItems.length})`, unresolvedItems.length > 0],
+ ['implemented', `已有实现(${implementedItems.length})`, implementedItems.length > 0],
+ ['excluded', `暂不处理(${excludedItems.length})`, excludedItems.length > 0],
+ ] as const).filter(([, , show]) => show).map(([key, label]) => (
+
+ ))}
+
+ )}
+ {!!catalog.warnings?.length && {catalog.warnings.map((w, i) => 第 {w.line} 行:{w.reason}。{w.quote}
)}}
+
+ {visibleMetrics.map(item => {
+ const itemDone = isItemImplemented(item)
+ const diagnostic = resolveItemDiagnostic(draft, item, itemDone)
+ const statusText = item.status === 'unavailable' ? '原文注明无数据源'
+ : itemDone ? '已有实现 · 待核验'
+ : (counts.get(item.name) ?? 0) > 1 ? '同名定义 · 需确认口径'
+ : draft.selected_definition_ids?.length && !draft.selected_definition_ids.includes(item.id) ? '未纳入本次处理'
+ : draft.status === 'drafting' ? '待处理'
+ : diagnostic?.kind === 'validation_failed' ? '校验未通过 · 待补充或重试'
+ : progress ? '未完成 · 需补充信息' : '待实现'
+ return
+
+ {canStart && partial && e.stopPropagation()}
+ onChange={e => setPicked(e.target.checked ? [...picked, item.id] : picked.filter(id => id !== item.id))} />}
+ {item.name}
+ {statusText}
+
+
+ {(draft.definition_issues ?? []).filter(i => i.definition_id === item.id).map(i => (
+ {i.reason}
+ ))}
+ {diagnostic && (
+
+ {diagnostic.questions.map((q, idx) => (
+
待确认:{q}
+ ))}
+ {diagnostic.reasons.map((r, idx) => (
+
未通过原因:{r}
+ ))}
+
+ )}
+ {Object.entries(item.fields).map(([name, value]) => - {name}:
- {value || '未说明'}
)}
+ {!!item.dependencies.length && 依赖:{item.dependencies.join('、')}
}
+
+ 原文 · 第 {item.source.line} 行
{item.source.quote}
+
+ })}
+ {!canStart && filteredMetrics.length > COLLAPSE_LIMIT && (
+
+ )}
+
+ 基础量与全局规则(随选中指标一起用于实现)
+
+ {catalog.items.filter(i => i.kind === 'input').map(i =>
{i.name}:{i.formula};{i.policy}
)}
+ {catalog.rules.map((r, i) =>
{r.text}
)}
+
+
+ {error != null && }
+
+}
+
+export function QuerySemanticEditor({ draft, metric, onSaved }: {
+ draft: CaliberDraft; metric: DraftMetric; onSaved: (fresh: CaliberDraft) => void
+}) {
+ const [value, setValue] = useState