|
@@ -517,6 +517,12 @@ function buildStageCard(
|
|
|
// 不再用异常总数 total(不含正常底数会导致绿色永远 0);
|
|
// 不再用异常总数 total(不含正常底数会导致绿色永远 0);
|
|
|
// - 均时接入真实 API avgProcessHours,不再写死 0h。
|
|
// - 均时接入真实 API avgProcessHours,不再写死 0h。
|
|
|
const normal = DEFAULT_NORMAL_WORK_ORDER_COUNT;
|
|
const normal = DEFAULT_NORMAL_WORK_ORDER_COUNT;
|
|
|
|
|
+ // S8-MODULE-CARD-ZERO-TOTAL-EMPTY-STATE-1:total=0 模块无样本,闭环率/均时不可计算 → 显示「--」;
|
|
|
|
|
+ // total>0 但 avgProcessHours 无效(NaN/<=0)时均时也走空态,避免 0h 误读。
|
|
|
|
|
+ const hasSamples = total > 0;
|
|
|
|
|
+ const hasAvgHours = hasSamples && Number.isFinite(avgProcessHours) && avgProcessHours > 0;
|
|
|
|
|
+ const closeRateText = hasSamples ? formatPercent(closeRate, closeRate > 0 && closeRate < 10 ? 1 : 0) : '--';
|
|
|
|
|
+ const avgHoursText = hasAvgHours ? formatHours(avgProcessHours) : '--';
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
code: meta.code,
|
|
code: meta.code,
|
|
@@ -528,6 +534,7 @@ function buildStageCard(
|
|
|
// 全部为自然数;warning + serious = 异常总数;绿色暂用 DEFAULT_NORMAL_WORK_ORDER_COUNT。
|
|
// 全部为自然数;warning + serious = 异常总数;绿色暂用 DEFAULT_NORMAL_WORK_ORDER_COUNT。
|
|
|
values: buildModuleTriColorStats({ total: anomalyCount, red, yellow }),
|
|
values: buildModuleTriColorStats({ total: anomalyCount, red, yellow }),
|
|
|
healthRate: closeRate,
|
|
healthRate: closeRate,
|
|
|
|
|
+ healthRateText: hasSamples ? undefined : '--',
|
|
|
statusLabel: timeout > 0 ? `${timeout} 超时` : `${anomalyCount} 异常`,
|
|
statusLabel: timeout > 0 ? `${timeout} 超时` : `${anomalyCount} 异常`,
|
|
|
progress: toProgress(normal, yellow, red),
|
|
progress: toProgress(normal, yellow, red),
|
|
|
tone,
|
|
tone,
|
|
@@ -535,7 +542,7 @@ function buildStageCard(
|
|
|
cardSpan: meta.wide ? 2 : 1,
|
|
cardSpan: meta.wide ? 2 : 1,
|
|
|
minHeight: meta.wide ? 196 : 176,
|
|
minHeight: meta.wide ? 196 : 176,
|
|
|
wideRate: closeRate,
|
|
wideRate: closeRate,
|
|
|
- wideRateLabel: `闭环率 ${formatPercent(closeRate, closeRate > 0 && closeRate < 10 ? 1 : 0)} / 均时 ${formatHours(avgProcessHours)}`,
|
|
|
|
|
|
|
+ wideRateLabel: `闭环率 ${closeRateText} / 均时 ${avgHoursText}`,
|
|
|
avgProcessHours,
|
|
avgProcessHours,
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|