数字推演复核修正(第 2 轮,界面):整个指标推演不了时只写原因,check-whatif 补遮罩列、输入还原不了的用例

- 后端对整个推演不了的指标(口径卡没记输入、用到了遮罩列、有输入还原不了)都给了 input 为空的那一条,界面沿用 wholeReason:
  结果区只写原值和原因,不写「无变化」,不画输入框、勾选框,不列报告里引用它的地方;注释和类型说明跟着改
- 推演结果里的原因写着输入路径,窄屏里允许在任意处折行
- check-whatif:假接口照后端新的形状作答。新增「输入还原不了」「用到了遮罩列」两段:一打开就写原因、本来能改的数也不给
  输入框、查询步骤里不出勾选框、不说报告引用处「不受影响」;口径卡没记输入那段改成后端新给的 unsupported;「不支持的
  输入」改用推演得了的指标(文本条件、加工过的列表);窄屏、深浅色补整个推演不了时的检查。把 wholeReason 改坏后这几段
  都变红。ESTIMATE 按实测改成 33 秒
This commit is contained in:
ThearchyHelios
2026-10-05 06:49:45 +08:00
parent bfc0e88e9a
commit 4debcf2ef3
5 changed files with 177 additions and 34 deletions
+1 -1
View File
@@ -323,7 +323,7 @@ function SegmentBody({ panelId, doc, artifact, runId, runClass, seg, unit, block
// 每份快照里这个指标用得到的行:别的行勾了不影响结果,表格里不让勾
const whatifUsable = useMemo(() => usableRows(pickMetric(whatifView.data, whatifMetric)), [whatifView.data, whatifMetric])
// 能勾行的查询步骤:指标的输入(单元格取数、Agent 字段)落在它上面。合并查询的输入步骤不给——指标引用的是合并结果。
// 整个指标推演不了(口径卡没记输入)时一行都不给勾
// 整个指标推演不了(口径卡没记输入、用到了遮罩列、有输入还原不了)时一行都不给勾
const pickable = new Set(wholeReason(whatifView.data, whatifMetric) ? []
: inputs.map((inp) => inp.artifact).filter((a): a is string => !!a))
const queryLink = (artifactOf?: string) => {
+12 -4
View File
@@ -25,6 +25,8 @@ import type { EvidenceStep, WhatIfInput, WhatIfMetric, WhatIfOverrides, WhatIfRe
* 整份快照的(SnapshotRows)。只有这个指标的输入实际用到的行可勾(row_span),别的行勾了也不影响结果
*
* 不能改的输入(文本、对不上快照的列表、遮罩列、决定取哪一格的下标)照实显示,原因列在「不支持推演的输入」里。
* 整个指标推演不了的(口径卡没记输入、用到了遮罩列、有输入还原不了或所在的快照读不出来,见 wholeReason)只写原因:
* 不写「无变化」,不画输入框、勾选框,也不列报告里引用它的地方——改了、勾了也推演不出来。
*/
/** 输入框停顿多久提交一次:边打字边请求,结果跟着抖 */
@@ -197,7 +199,11 @@ export function pickMetric(data: WhatIfResult | undefined, metric: string | unde
return data?.metrics.find((x) => String(x.id) === metric) ?? data?.metrics[0]
}
/** 整个指标推演不了(口径卡没记输入):unsupported 里 input 为空的那一条 */
/**
* 整个指标推演不了(口径卡没记输入、用到了遮罩列、有输入还原不了或所在的快照读不出来):unsupported 里 input 为空的
* 那一条。不论改什么都推演不了,后端不改动也照实给;排除行后才说不准的(只在这次改动下推演不了)没有这一条,照常画
* 输入和勾选框,好让人把行勾回去
*/
export const wholeReason = (data: WhatIfResult | undefined, metric: string | undefined) =>
data?.unsupported.find((u) => String(u.metric) === metric && u.input == null)?.reason
@@ -307,7 +313,7 @@ export function WhatIf({ id, runId, report, metric, draft, view, queryOf, onLoca
const failed = status === 'error'
const m = pickMetric(data, metric)
const unsupported = (data?.unsupported ?? []).filter((u) => String(u.metric) === metric)
// 整个指标推演不了(口径卡没记输入):只说原因,不画输入、不写「无变化」
// 整个指标推演不了(口径卡没记输入、用到了遮罩列、有输入还原不了):只说原因,不画输入、不写「无变化」
const whole = wholeReason(data, metric)
const unknown = !!m && m.rendered_new == null
const changedSegs = (data?.segments ?? []).filter((s) => s.changed)
@@ -344,12 +350,14 @@ export function WhatIf({ id, runId, report, metric, draft, view, queryOf, onLoca
{whole ? (
<>
<span className="mono tnum text-dim" data-whatif-old="">{m.rendered_old}</span>
<p className="mt-0.5" style={{ color: 'var(--st-waiting)' }} data-whatif-reason="">{whole}</p>
<p className="mt-0.5 [overflow-wrap:anywhere]" style={{ color: 'var(--st-waiting)' }} data-whatif-reason="">{whole}</p>
</>
) : (
<>
<Outcome m={m} loading={loading} big tag="whatif" />
{m.reason && <p className="mt-0.5" style={{ color: 'var(--st-waiting)' }} data-whatif-reason="">{m.reason}</p>}
{m.reason && (
<p className="mt-0.5 [overflow-wrap:anywhere]" style={{ color: 'var(--st-waiting)' }} data-whatif-reason="">{m.reason}</p>
)}
{m.status === 'ok' && m.changed && m.substituted && (
<div className="mt-1">
<div className="text-2xs text-faint">{WHATIF_TEXT.substituted}</div>