feat: 新增产线看板功能并优化多端系统体验
1. 新增SSE看板广播机制,业务操作后主动推送刷新事件 2. 新增产线工序横道图与工位状态展示面板 3. 移除dashboard无用的three.js依赖 4. 重构WMS客户端布局与WMS前端资源哈希 5. 新增工位终端时钟图标与大屏自适应布局 6. 新增系统截图脚本与说明书生成工具 7. 修复多处代码细节与空值处理逻辑
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
.linemodel-shell {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: linear-gradient(180deg, #040912, #050b1a 60%);
|
||||
border: 1px solid rgba(125, 211, 252, 0.18);
|
||||
border-radius: 6px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.linemodel-shell.is-pulsing {
|
||||
animation: linemodel-pulse 0.6s ease-out 1;
|
||||
}
|
||||
|
||||
@keyframes linemodel-pulse {
|
||||
0% { box-shadow: inset 0 0 0 0 rgba(125, 211, 252, 0.85); }
|
||||
35% { box-shadow: inset 0 0 0 6px rgba(125, 211, 252, 0.45); }
|
||||
100% { box-shadow: inset 0 0 0 12px rgba(125, 211, 252, 0); }
|
||||
}
|
||||
|
||||
.linemodel-shell .lm-titlebar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 6px 12px;
|
||||
border-bottom: 1px solid rgba(125, 211, 252, 0.18);
|
||||
background: linear-gradient(90deg, rgba(13, 26, 51, 0.6), rgba(13, 26, 51, 0.0));
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.linemodel-shell .lm-titlebar .lm-title {
|
||||
color: #67e8f9;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.linemodel-shell .lm-titlebar .lm-stat {
|
||||
color: #94a3b8;
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.linemodel-shell .lm-titlebar .lm-stat b {
|
||||
color: #f1f5f9;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.linemodel-svg {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: block;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.linemodel-shell .lm-watermark {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 6px;
|
||||
font-size: 10px;
|
||||
color: rgba(148, 163, 184, 0.55);
|
||||
letter-spacing: 1px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.linemodel-svg .legend-text {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
fill: #cbd5e1;
|
||||
font-size: 3px;
|
||||
dominant-baseline: middle;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
import type { EChartsOption } from 'echarts';
|
||||
import type { DashboardData, Station } from '../types';
|
||||
import type { DashboardData, Station, ProgressGanttStep } from '../types';
|
||||
import { EChart } from '../components/EChart';
|
||||
|
||||
const C = {
|
||||
@@ -54,7 +54,7 @@ export function ProductionBoard({ data }: { data: DashboardData }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14 }}>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14, gridAutoRows: 'min-content' }}>
|
||||
<Kpi value={production.outputToday} label="今日产量" sub={`目标 ${production.targetToday}`} color={C.cyan} />
|
||||
<Kpi value={production.passCount} label="一次通过" sub="件 · 全工序合格" color={C.green} />
|
||||
<Kpi value={production.inLine} label="在制工件" sub="产线流转中" color={C.blue} />
|
||||
@@ -66,17 +66,18 @@ export function ProductionBoard({ data }: { data: DashboardData }) {
|
||||
/>
|
||||
|
||||
<Panel title="近 7 日产量趋势" style={{ gridColumn: 'span 2' }}>
|
||||
<EChart option={trendOption} height={230} />
|
||||
<EChart option={trendOption} height={200} />
|
||||
</Panel>
|
||||
|
||||
<Panel title="当前订单" style={{ gridColumn: 'span 2' }} accent>
|
||||
<Panel title="当前订单 · 工期横道" style={{ gridColumn: 'span 2' }} accent>
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'auto 1fr',
|
||||
rowGap: 10,
|
||||
rowGap: 8,
|
||||
columnGap: 14,
|
||||
alignItems: 'center',
|
||||
marginBottom: 12,
|
||||
}}
|
||||
>
|
||||
<Field label="合同号" />
|
||||
@@ -89,77 +90,85 @@ export function ProductionBoard({ data }: { data: DashboardData }) {
|
||||
<span style={{ fontSize: 14, color: C.cyan }}>{progress.owner || '—'}</span>
|
||||
|
||||
<Field label="工期" />
|
||||
<span style={{ fontSize: 14 }}>
|
||||
{progress.planStart} ~ {progress.planEnd}
|
||||
<span style={{ fontSize: 13 }}>
|
||||
{progress.planStart || '—'} ~ {progress.planEnd || '—'}
|
||||
<span style={{ marginLeft: 10, color: progress.remainDays >= 0 ? C.green : C.amber }}>
|
||||
剩余 {Math.max(progress.remainDays, 0)} 天
|
||||
剩余 {progress.remainDays >= 0 ? progress.remainDays : 0} 天
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 16 }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'baseline',
|
||||
marginBottom: 8,
|
||||
}}
|
||||
>
|
||||
<span style={{ fontSize: 13, color: C.sub }}>完成度</span>
|
||||
<span style={{ fontSize: 13, color: C.sub }}>
|
||||
<span style={{ fontSize: 20, fontWeight: 500, color: C.cyan }}>{progress.doneQty}</span>
|
||||
{' / '}
|
||||
{progress.totalQty} 台
|
||||
</span>
|
||||
</div>
|
||||
<Bar percent={progress.progress} />
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'baseline',
|
||||
marginBottom: 8,
|
||||
}}
|
||||
>
|
||||
<span style={{ fontSize: 13, color: C.sub }}>
|
||||
完成度 {progress.progress}% · 工序 {progress.processDone}/{progress.processTotal}
|
||||
</span>
|
||||
<span style={{ fontSize: 13, color: C.sub }}>
|
||||
<span style={{ fontSize: 18, fontWeight: 500, color: C.cyan }}>{progress.doneQty}</span>
|
||||
{' / '}{progress.totalQty} 台
|
||||
</span>
|
||||
</div>
|
||||
<Bar percent={progress.progress} />
|
||||
|
||||
<div style={{ display: 'flex', gap: 10, marginTop: 16 }}>
|
||||
<Chip label="工序进度" value={`${progress.processDone} / ${progress.processTotal} 序`} color={C.cyan} />
|
||||
<Chip label="当前工序" value={progress.currentProcess || '—'} color={C.blue} />
|
||||
<Chip
|
||||
label="责任追溯"
|
||||
value={progress.traceable ? `${progress.traceStepCount} 条 · 全程可追溯` : '待采集'}
|
||||
color={progress.traceable ? C.green : C.dim}
|
||||
/>
|
||||
<div style={{ marginTop: 14, height: 260 }}>
|
||||
{progress.steps.length > 0 ? (
|
||||
<GanttChart steps={progress.steps} />
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
color: C.dim,
|
||||
fontSize: 13,
|
||||
border: `1px dashed ${C.border}`,
|
||||
borderRadius: 6,
|
||||
}}
|
||||
>
|
||||
暂无工序横道数据
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel title="工位状态(12 工位 · 扫码枪 + 拧紧枪)" style={{ gridColumn: 'span 4' }}>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: 10 }}>
|
||||
{equipment.map((s) => (
|
||||
<Panel title="工位作业(12 工位 · 详见产线 2D 顶视)" style={{ gridColumn: 'span 4' }}>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: 6 }}>
|
||||
{equipment.map((s, i) => (
|
||||
<div
|
||||
key={s.id}
|
||||
title={`${s.name} · ${s.currentOperator || '—'} · ${s.currentSn || ''}`}
|
||||
style={{
|
||||
border: `1px solid ${statusColor[s.status]}55`,
|
||||
borderLeft: `3px solid ${statusColor[s.status]}`,
|
||||
borderRadius: 6,
|
||||
padding: '8px 10px',
|
||||
border: `1px solid ${statusColor[s.status]}33`,
|
||||
borderTop: `3px solid ${statusColor[s.status]}`,
|
||||
borderRadius: 4,
|
||||
padding: '4px 4px',
|
||||
background: 'rgba(255,255,255,0.02)',
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 13, fontWeight: 500 }}>{s.name}</span>
|
||||
<span style={{ fontSize: 11, color: statusColor[s.status] }}>
|
||||
{s.status === 'running'
|
||||
? '作业中'
|
||||
: s.status === 'idle'
|
||||
? '待料'
|
||||
: s.status === 'alarm'
|
||||
? '异常'
|
||||
: '离线'}
|
||||
</span>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 10 }}>
|
||||
<span style={{ color: C.text, fontWeight: 600 }}>{s.name}</span>
|
||||
<span style={{ color: C.dim, fontVariantNumeric: 'tabular-nums' }}>{i + 1}</span>
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: C.dim, marginTop: 4 }}>
|
||||
{s.currentOperator || '—'}
|
||||
<div style={{ fontSize: 10, color: statusColor[s.status], marginTop: 2, fontWeight: 500 }}>
|
||||
{s.status === 'running'
|
||||
? '作业中'
|
||||
: s.status === 'idle'
|
||||
? '待料'
|
||||
: s.status === 'alarm'
|
||||
? '异常'
|
||||
: '离线'}
|
||||
</div>
|
||||
{s.currentSn && <div style={{ fontSize: 11, color: C.sub, marginTop: 2 }}>{s.currentSn}</div>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div style={{ marginTop: 12, fontSize: 12, color: C.dim }}>
|
||||
<div style={{ marginTop: 6, fontSize: 11, color: C.dim }}>
|
||||
运行中 {production.stationSummary.running} · 待料 {production.stationSummary.idle} · 离线{' '}
|
||||
{production.stationSummary.offline}
|
||||
</div>
|
||||
@@ -235,19 +244,98 @@ function Bar({ percent }: { percent: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Chip({ label, value, color }: { label: string; value: string; color: string }) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
border: `1px solid ${color}44`,
|
||||
borderRadius: 6,
|
||||
padding: '8px 10px',
|
||||
background: 'rgba(255,255,255,0.02)',
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: 11, color: C.dim }}>{label}</div>
|
||||
<div style={{ fontSize: 13, color, marginTop: 3 }}>{value}</div>
|
||||
</div>
|
||||
);
|
||||
function GanttChart({ steps }: { steps: ProgressGanttStep[] }) {
|
||||
const names = steps.map((s) => s.name);
|
||||
const now = new Date();
|
||||
|
||||
const planData = steps.map((s, i) => ({
|
||||
value: [i, new Date(s.planStart).getTime(), new Date(s.planEnd).getTime(), 'plan'],
|
||||
itemStyle: { color: 'rgba(148, 163, 184, 0.12)' },
|
||||
}));
|
||||
|
||||
const actualData = steps
|
||||
.filter((s) => s.actualStart)
|
||||
.map((s, i) => {
|
||||
const start = new Date(s.actualStart!).getTime();
|
||||
const end = s.actualEnd ? new Date(s.actualEnd).getTime() : now.getTime();
|
||||
const color = s.status === 'done' ? C.green : C.cyan;
|
||||
return {
|
||||
value: [i, start, end, 'actual'],
|
||||
itemStyle: { color },
|
||||
};
|
||||
});
|
||||
|
||||
const option: EChartsOption = {
|
||||
tooltip: {
|
||||
formatter: (params: any) => {
|
||||
const s = steps[params.value[0] as number];
|
||||
const start = new Date(params.value[1] as number).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' });
|
||||
const end = new Date(params.value[2] as number).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' });
|
||||
return `<div style="font-size:12px"><b>${s.name}</b><br/>负责人:${s.owner}<br/>状态:${s.status === 'done' ? '已完成' : s.status === 'running' ? '进行中' : '未开始'}<br/>${start} ~ ${end}</div>`;
|
||||
},
|
||||
},
|
||||
grid: { left: 96, right: 24, top: 10, bottom: 24 },
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
axisLine: { lineStyle: { color: '#335' } },
|
||||
axisLabel: { color: '#8fa3bf', fontSize: 11, formatter: '{MM}-{dd}' },
|
||||
splitLine: { lineStyle: { color: '#1f2a3f' } },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: names,
|
||||
inverse: true,
|
||||
axisLine: { lineStyle: { color: '#335' } },
|
||||
axisLabel: { color: '#94a3b8', fontSize: 11 },
|
||||
splitLine: { show: false },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'custom',
|
||||
name: '计划工期',
|
||||
renderItem: (_params: any, api: any) => {
|
||||
const categoryIndex = api.value(0);
|
||||
const start = api.coord([api.value(1), categoryIndex]);
|
||||
const end = api.coord([api.value(2), categoryIndex]);
|
||||
const height = api.size([0, 1])[1] * 0.55;
|
||||
return {
|
||||
type: 'rect',
|
||||
shape: {
|
||||
x: start[0],
|
||||
y: start[1] - height / 2,
|
||||
width: Math.max(end[0] - start[0], 2),
|
||||
height,
|
||||
},
|
||||
style: api.style(),
|
||||
};
|
||||
},
|
||||
encode: { x: [1, 2], y: 0 },
|
||||
data: planData,
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
name: '实际进度',
|
||||
renderItem: (_params: any, api: any) => {
|
||||
const categoryIndex = api.value(0);
|
||||
const start = api.coord([api.value(1), categoryIndex]);
|
||||
const end = api.coord([api.value(2), categoryIndex]);
|
||||
const height = api.size([0, 1])[1] * 0.32;
|
||||
return {
|
||||
type: 'rect',
|
||||
shape: {
|
||||
x: start[0],
|
||||
y: start[1] - height / 2,
|
||||
width: Math.max(end[0] - start[0], 2),
|
||||
height,
|
||||
},
|
||||
style: api.style(),
|
||||
};
|
||||
},
|
||||
encode: { x: [1, 2], y: 0 },
|
||||
data: actualData,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return <EChart option={option} height={260} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user