| | |
| | | const lines = list |
| | | .map((p) => { |
| | | const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>`; |
| | | return `${colorBox}${p.seriesName}<b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>`; |
| | | return `${colorBox}${p.seriesName}<b style="float:right;">${Number(p.value || 0).toFixed(4)}</b>`; |
| | | }) |
| | | .join("<br/>"); |
| | | return `<div style="min-width:140px;"><div style="font-weight:700;margin-bottom:6px;">${name}</div>${lines}</div>`; |
| | |
| | | value: formatNumber(productionOverviewData.value.totalOutput), |
| | | subLabel: "累计报废", |
| | | subValue: formatNumber(productionOverviewData.value.totalScrap), |
| | | trend: `良率 ${Number(productionOverviewData.value.yieldRate || 0).toFixed(2)}%`, |
| | | trend: `良率 ${Number(productionOverviewData.value.yieldRate || 0).toFixed(4)}%`, |
| | | icon: Operation, |
| | | visible: visibleModules.value.production, |
| | | }, |
| | |
| | | |
| | | const getCompareText = (value) => { |
| | | const num = Number(value || 0); |
| | | const abs = Math.abs(num).toFixed(2); |
| | | const abs = Math.abs(num).toFixed(4); |
| | | if (num > 0) return `较昨日 ↑ ${abs}%`; |
| | | if (num < 0) return `较昨日 ↓ ${abs}%`; |
| | | return "较昨日 持平"; |
| | |
| | | key: "oee", |
| | | label: "设备 OEE", |
| | | percent: clampPercent(oee), |
| | | display: `${oee.toFixed(2)}%`, |
| | | display: `${oee.toFixed(4)}%`, |
| | | delta: getCompareText(oeeCompare), |
| | | trend: getCompareTrend(oeeCompare), |
| | | color: "#2d8cff", |
| | |
| | | key: "order", |
| | | label: "订单达成率", |
| | | percent: clampPercent(orderAchievement), |
| | | display: `${orderAchievement.toFixed(2)}%`, |
| | | display: `${orderAchievement.toFixed(4)}%`, |
| | | delta: getCompareText(orderCompare), |
| | | trend: getCompareTrend(orderCompare), |
| | | color: "#31d2ff", |
| | |
| | | key: "defect", |
| | | label: "不良率", |
| | | percent: clampPercent(defectRate), |
| | | display: `${defectRate.toFixed(2)}%`, |
| | | display: `${defectRate.toFixed(4)}%`, |
| | | delta: getCompareText(defectCompare), |
| | | trend: getCompareTrend(defectCompare), |
| | | color: "#f6a23f", |
| | |
| | | const trendText = (value) => { |
| | | const num = Number(value || 0); |
| | | const flag = num >= 0 ? "↑" : "↓"; |
| | | return `${flag} ${Math.abs(num).toFixed(1)}%`; |
| | | return `${flag} ${Math.abs(num).toFixed(4)}%`; |
| | | }; |
| | | |
| | | const ratioNumber = (numerator, denominator) => { |
| | |
| | | return (n / d) * 100; |
| | | }; |
| | | |
| | | const ratioText = (numerator, denominator) => `${ratioNumber(numerator, denominator).toFixed(1)}%`; |
| | | const ratioText = (numerator, denominator) => `${ratioNumber(numerator, denominator).toFixed(4)}%`; |
| | | |
| | | const clampPercent = (val) => Math.max(0, Math.min(100, Number(val || 0))); |
| | | |