|
|
@@ -132,7 +132,7 @@ import S8MonitoringCategoryGrid, { type CategoryGridCardData } from './component
|
|
|
import S8MonitoringEditToolbar from './components/S8MonitoringEditToolbar.vue';
|
|
|
import S8MonitoringStageConfigDrawer from './components/S8MonitoringStageConfigDrawer.vue';
|
|
|
import { useS8UnsavedLayoutEditGuard } from './useS8UnsavedLayoutEditGuard';
|
|
|
-import { useS8StageConfig, buildModuleTriColorStats } from './useS8StageConfig';
|
|
|
+import { useS8StageConfig, buildModuleTriColorStats, DEFAULT_NORMAL_WORK_ORDER_COUNT } from './useS8StageConfig';
|
|
|
import { useS8CategoryConfig } from './useS8CategoryConfig';
|
|
|
import { useS8PageConfigDriver } from './useS8PageConfigDriver';
|
|
|
|
|
|
@@ -232,10 +232,12 @@ const moduleData = reactive<{ list: S8ModuleOrderSummary[] }>({ list: [] });
|
|
|
// ─── G-09 一期 Part D:page-config driver 接入 ─────────────────────────
|
|
|
const pageConfig = useS8PageConfigDriver({ pageCode: 'SUPPLY', pageCodePrefix: 'SUPPLY' });
|
|
|
|
|
|
+// S8-MONITORING-PAGES-STAGE-CARD-SEMANTICS-UNIFY-1:主指标统一为「累计异常数」+ value=total。
|
|
|
+// S4 不再用 avgHours 作主数字;S5 不再用 closeRate% 作主数字;均时/闭环率改为底部 wideRateLabel 展示。
|
|
|
const STAGE_META_FALLBACK = [
|
|
|
- { code: 'S3', title: '物料备料', icon: ShoppingBag as Component, metricLabel: '累计异常数量' },
|
|
|
- { code: 'S4', title: '生产制造', icon: Tools as Component, metricLabel: '平均处理时长' },
|
|
|
- { code: 'S5', title: '质量检测', icon: DataAnalysis as Component, metricLabel: '异常关闭率' },
|
|
|
+ { code: 'S3', title: '物料备料', icon: ShoppingBag as Component, metricLabel: '累计异常数' },
|
|
|
+ { code: 'S4', title: '生产制造', icon: Tools as Component, metricLabel: '累计异常数' },
|
|
|
+ { code: 'S5', title: '质量检测', icon: DataAnalysis as Component, metricLabel: '累计异常数' },
|
|
|
] as const;
|
|
|
|
|
|
const ANOMALY_TYPES_FALLBACK: ReadonlyArray<{ key: string; label: string }> = [
|
|
|
@@ -282,41 +284,44 @@ async function loadPageConfig() {
|
|
|
|
|
|
const moduleMap = computed(() => new Map(moduleData.list.map((m) => [m.moduleCode, m])));
|
|
|
|
|
|
+// S8-MONITORING-PAGES-STAGE-CARD-SEMANTICS-UNIFY-1:与 overview 口径一致。
|
|
|
+// S4/S5 主数字一律改为 total(不再用 avgHours / closeRate%),均时/闭环率统一在底部 wideRateLabel 展示。
|
|
|
const stageCards = computed(() =>
|
|
|
effectiveStageMeta.value.map((meta) => {
|
|
|
const m = moduleMap.value.get(meta.code);
|
|
|
const total = Math.max(m?.total ?? 0, 0);
|
|
|
const red = Math.max(m?.red ?? 0, 0);
|
|
|
const yellow = Math.max(m?.yellow ?? 0, 0);
|
|
|
- const green = Math.max(m?.green ?? Math.max(total - red - yellow, 0), 0);
|
|
|
- const healthRate = total > 0 ? Math.round((green / total) * 100) : 0;
|
|
|
+ const closeRate = Math.max(0, Math.min(100, Math.round(m?.closeRate ?? 0)));
|
|
|
+ const avgProcessHours = m?.avgProcessHours ?? 0;
|
|
|
const tone: 'green' | 'yellow' | 'red' = red > 0 ? 'red' : yellow > 0 ? 'yellow' : 'green';
|
|
|
- let value: string;
|
|
|
- if (meta.code === 'S4') {
|
|
|
- const h = m?.avgProcessHours ?? 0;
|
|
|
- value = Number.isFinite(h) && h > 0 ? (h >= 24 ? `${Math.round(h)}h+` : `${h.toFixed(1)}h`) : '0h';
|
|
|
- } else if (meta.code === 'S5') {
|
|
|
- value = `${Math.max(0, Math.min(100, m?.closeRate ?? 0)).toFixed(0)}%`;
|
|
|
- } else {
|
|
|
- value = formatInteger(total);
|
|
|
- }
|
|
|
+ const hasSamples = total > 0;
|
|
|
+ const hasAvgHours = hasSamples && Number.isFinite(avgProcessHours) && avgProcessHours > 0;
|
|
|
+ const closeRateText = hasSamples ? formatPercent(closeRate) : '--';
|
|
|
+ const avgHoursText = hasAvgHours ? formatHours(avgProcessHours) : '--';
|
|
|
+ const normal = DEFAULT_NORMAL_WORK_ORDER_COUNT;
|
|
|
+ const denom = normal + yellow + red;
|
|
|
const raw = {
|
|
|
code: meta.code,
|
|
|
title: meta.title,
|
|
|
icon: meta.icon,
|
|
|
metricLabel: meta.metricLabel,
|
|
|
- value,
|
|
|
+ value: formatInteger(total),
|
|
|
// S8-DASHBOARD-MODULE-TRICOLOR-SEMANTICS-1:三色数字(绿正常 / 黄关注 / 红严重)
|
|
|
values: buildModuleTriColorStats({ total: red + yellow, red, yellow }),
|
|
|
- healthRate,
|
|
|
+ healthRate: closeRate,
|
|
|
+ healthRateText: hasSamples ? undefined : '--',
|
|
|
statusLabel: `${red + yellow} 异常`,
|
|
|
- progress: total > 0
|
|
|
- ? { green: (green / total) * 100, yellow: (yellow / total) * 100, red: (red / total) * 100 }
|
|
|
+ progress: denom > 0
|
|
|
+ ? { green: (normal / denom) * 100, yellow: (yellow / denom) * 100, red: (red / denom) * 100 }
|
|
|
: { green: 0, yellow: 0, red: 0 },
|
|
|
tone,
|
|
|
wide: false,
|
|
|
cardSpan: 1,
|
|
|
minHeight: 176,
|
|
|
+ wideRate: closeRate,
|
|
|
+ wideRateLabel: `闭环率 ${closeRateText} / 均时 ${avgHoursText}`,
|
|
|
+ avgProcessHours,
|
|
|
};
|
|
|
return applyConfig(raw);
|
|
|
}),
|