2026-08-28 15:06:01 +08:00
|
|
|
import type { EChartsOption } from 'echarts';
|
2026-10-28 10:10:17 +08:00
|
|
|
import type { DashboardData } from '../types';
|
2026-08-28 15:06:01 +08:00
|
|
|
import { EChart } from '../components/EChart';
|
2026-10-28 10:10:17 +08:00
|
|
|
import { dash0 } from './WarehouseBoard';
|
2026-08-28 15:06:01 +08:00
|
|
|
|
2026-09-04 14:18:53 +08:00
|
|
|
const C = {
|
|
|
|
|
cyan: '#22d3ee',
|
|
|
|
|
green: '#34d399',
|
|
|
|
|
text: '#e2e8f0',
|
|
|
|
|
sub: '#94a3b8',
|
|
|
|
|
dim: '#64748b',
|
2026-08-28 15:06:01 +08:00
|
|
|
};
|
|
|
|
|
|
2026-10-28 10:10:17 +08:00
|
|
|
/** 底部左块 · 当前订单(合同/工期/完成度)+ 近 7 日产量趋势 */
|
2026-08-28 15:06:01 +08:00
|
|
|
export function ProductionBoard({ data }: { data: DashboardData }) {
|
2026-10-28 10:10:17 +08:00
|
|
|
const { progress, trends } = data;
|
2026-08-28 15:06:01 +08:00
|
|
|
|
|
|
|
|
const trendOption: EChartsOption = {
|
2026-10-28 10:10:17 +08:00
|
|
|
grid: { left: 8, right: 12, top: 14, bottom: 4, containLabel: true },
|
2026-08-28 15:06:01 +08:00
|
|
|
tooltip: { trigger: 'axis' },
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
data: trends.production.map((t) => t.time),
|
2026-10-28 10:10:17 +08:00
|
|
|
axisTick: { show: false },
|
|
|
|
|
axisLine: { lineStyle: { color: 'rgba(56,189,248,0.25)' } },
|
|
|
|
|
axisLabel: { color: '#8fa3bf', fontSize: 11 },
|
2026-08-28 15:06:01 +08:00
|
|
|
},
|
2026-09-04 14:18:53 +08:00
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
2026-10-28 10:10:17 +08:00
|
|
|
splitLine: { lineStyle: { color: 'rgba(56,189,248,0.1)' } },
|
|
|
|
|
axisLabel: { color: '#8fa3bf', fontSize: 11 },
|
2026-09-04 14:18:53 +08:00
|
|
|
},
|
2026-08-28 15:06:01 +08:00
|
|
|
series: [
|
|
|
|
|
{
|
2026-09-04 14:18:53 +08:00
|
|
|
name: '日产量',
|
2026-08-28 15:06:01 +08:00
|
|
|
type: 'line',
|
|
|
|
|
smooth: true,
|
2026-10-28 10:10:17 +08:00
|
|
|
symbol: 'circle',
|
|
|
|
|
symbolSize: 6,
|
2026-08-28 15:06:01 +08:00
|
|
|
data: trends.production.map((t) => t.output),
|
2026-09-04 14:18:53 +08:00
|
|
|
itemStyle: { color: C.cyan },
|
2026-10-28 10:10:17 +08:00
|
|
|
lineStyle: { width: 2.5 },
|
2026-09-04 14:18:53 +08:00
|
|
|
areaStyle: { color: 'rgba(34,211,238,0.18)' },
|
2026-08-28 15:06:01 +08:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-10-28 10:10:17 +08:00
|
|
|
<div className="panel">
|
|
|
|
|
<div className="panel-head">
|
|
|
|
|
当前订单
|
|
|
|
|
<span className="note">合同 · 工期 · 完成度</span>
|
2026-10-20 16:36:26 +08:00
|
|
|
</div>
|
2026-10-28 10:10:17 +08:00
|
|
|
<div className="panel-body" style={{ flexDirection: 'row', gap: 'clamp(8px, 0.9vw, 40px)' }}>
|
|
|
|
|
{/* 左:订单信息 */}
|
|
|
|
|
<div style={{ flex: '1 1 46%', minWidth: 0, display: 'flex', flexDirection: 'column', gap: 'clamp(4px, 0.7vh, 9px)' }}>
|
|
|
|
|
<div style={{ fontSize: 'clamp(15px, 1.25vw, 48px)', fontWeight: 600, color: '#eaf6ff', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
|
|
|
{progress.contractNo || progress.orderNo || '暂无在产订单'}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style={{ fontSize: 'clamp(11px, 0.85vw, 33px)', color: C.sub, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
|
|
|
{progress.productName || '—'}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style={{ display: 'flex', gap: 'clamp(10px, 1vw, 44px)', fontSize: 'clamp(10px, 0.8vw, 31px)', color: C.sub, flexWrap: 'nowrap' }}>
|
|
|
|
|
<span style={{ whiteSpace: 'nowrap' }}>
|
|
|
|
|
交期 <span style={{ color: C.text }}>{progress.planEnd || '—'}</span>
|
2026-09-04 14:18:53 +08:00
|
|
|
</span>
|
2026-10-28 10:10:17 +08:00
|
|
|
<span style={{ whiteSpace: 'nowrap', color: progress.remainDays >= 0 ? C.green : '#fbbf24' }}>
|
|
|
|
|
剩余 {progress.planEnd ? Math.max(progress.remainDays, 0) : '—'} 天
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style={{ marginTop: 'auto' }}>
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 8 }}>
|
|
|
|
|
<span style={{ fontSize: 'clamp(10px, 0.8vw, 31px)', color: C.sub }}>完成进度</span>
|
|
|
|
|
<span style={{ fontVariantNumeric: 'tabular-nums' }}>
|
|
|
|
|
<span style={{ fontSize: 'clamp(17px, 1.5vw, 62px)', fontWeight: 700, color: C.cyan }}>{dash0(progress.doneQty)}</span>
|
|
|
|
|
<span style={{ fontSize: 'clamp(10px, 0.8vw, 31px)', color: C.sub }}> / {dash0(progress.totalQty)} 台</span>
|
|
|
|
|
</span>
|
2026-09-04 17:31:18 +08:00
|
|
|
</div>
|
2026-10-28 10:10:17 +08:00
|
|
|
<div style={{ height: 'clamp(6px, 0.9vh, 10px)', background: '#16233a', borderRadius: 6, overflow: 'hidden', marginTop: 6 }}>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
width: `${Math.max(0, Math.min(100, progress.progress))}%`,
|
|
|
|
|
height: '100%',
|
|
|
|
|
background: 'linear-gradient(90deg, #0ea5e9, #22d3ee)',
|
|
|
|
|
transition: 'width 0.6s ease',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2026-09-04 14:18:53 +08:00
|
|
|
</div>
|
2026-10-28 10:10:17 +08:00
|
|
|
<div style={{ fontSize: 'clamp(10px, 0.78vw, 29px)', color: C.dim, marginTop: 4, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
|
|
|
工序 {dash0(progress.processDone)}/{dash0(progress.processTotal)}
|
|
|
|
|
{progress.currentProcess ? ` · 当前 ${progress.currentProcess}` : ''}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-08-28 15:06:01 +08:00
|
|
|
</div>
|
|
|
|
|
|
2026-10-28 10:10:17 +08:00
|
|
|
{/* 右:近 7 日产量趋势(height:100% 跟随容器) */}
|
|
|
|
|
<div style={{ flex: '1 1 54%', minWidth: 0, display: 'flex', flexDirection: 'column' }}>
|
|
|
|
|
<div style={{ fontSize: 'clamp(10px, 0.8vw, 31px)', color: C.sub, flexShrink: 0, marginBottom: 2 }}>近 7 日产量</div>
|
|
|
|
|
<div style={{ flex: 1, minHeight: 0, position: 'relative' }}>
|
|
|
|
|
<EChart option={trendOption} height="100%" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-09-04 14:18:53 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|