feat: 大屏新增虚拟工位滚动栏与多订单轮播,附件表增加删除原因及彻底清除留痕字段
This commit is contained in:
@@ -249,6 +249,31 @@ export function getDemoData(): DashboardData {
|
||||
],
|
||||
},
|
||||
equipment: buildStations(),
|
||||
// 虚拟工位(OFFLINE,不连PLC):产线动态地图右侧滚动栏演示
|
||||
virtualStations: [
|
||||
{
|
||||
id: 14,
|
||||
name: '虚拟工位14',
|
||||
status: 'running',
|
||||
scanGun: { status: 'online', processedCount: 6 },
|
||||
tighteningGun: { status: 'online', processedCount: 6 },
|
||||
currentSn: 'SN202609280014',
|
||||
currentOperator: '刘洋',
|
||||
currentProcess: '辅助装配(虚拟)',
|
||||
doneCount: 6,
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
name: '虚拟工位15',
|
||||
status: 'idle',
|
||||
scanGun: { status: 'online', processedCount: 0 },
|
||||
tighteningGun: { status: 'online', processedCount: 0 },
|
||||
currentSn: '',
|
||||
currentOperator: '',
|
||||
currentProcess: '',
|
||||
doneCount: 0,
|
||||
},
|
||||
],
|
||||
progress: {
|
||||
orderNo: 'WO-20260825-007',
|
||||
contractNo: 'HT-2026-0825-007',
|
||||
@@ -268,6 +293,66 @@ export function getDemoData(): DashboardData {
|
||||
traceable: true,
|
||||
steps: progressSteps,
|
||||
},
|
||||
// 多订单轮播演示:首条与 progress 一致,另补两条在产订单
|
||||
progressList: [
|
||||
{
|
||||
orderNo: 'WO-20260825-007',
|
||||
contractNo: 'HT-2026-0825-007',
|
||||
productName: '智能电能表 DDS-02',
|
||||
owner: '张伟',
|
||||
planStart: fmtDate(planStart),
|
||||
planEnd: fmtDate(planEnd),
|
||||
remainDays: daysFromToday(planEnd),
|
||||
totalQty,
|
||||
doneQty,
|
||||
progress: Math.round((doneQty / totalQty) * 100),
|
||||
processDone: 7,
|
||||
processTotal: 12,
|
||||
currentProcess: '工序 8 · 面板固定',
|
||||
status: '生产中',
|
||||
traceStepCount: 2016,
|
||||
traceable: true,
|
||||
steps: progressSteps,
|
||||
},
|
||||
{
|
||||
orderNo: 'WO-20260910-012',
|
||||
contractNo: 'HT-2026-0910-012',
|
||||
productName: '智能电能表 DDS-03',
|
||||
owner: '李强',
|
||||
planStart: fmtDate(planEnd),
|
||||
planEnd: fmtDate(new Date(planEnd.getTime() + 30 * 86400000)),
|
||||
remainDays: daysFromToday(new Date(planEnd.getTime() + 30 * 86400000)),
|
||||
totalQty: 3200,
|
||||
doneQty: 860,
|
||||
progress: Math.round((860 / 3200) * 100),
|
||||
processDone: 4,
|
||||
processTotal: 12,
|
||||
currentProcess: '工序 5 · 计量模块装配',
|
||||
status: '生产中',
|
||||
traceStepCount: 2016,
|
||||
traceable: true,
|
||||
steps: progressSteps,
|
||||
},
|
||||
{
|
||||
orderNo: 'WO-20260920-018',
|
||||
contractNo: 'HT-2026-0920-018',
|
||||
productName: '采集终端 DC-01',
|
||||
owner: '王芳',
|
||||
planStart: fmtDate(new Date(planEnd.getTime() + 10 * 86400000)),
|
||||
planEnd: fmtDate(new Date(planEnd.getTime() + 50 * 86400000)),
|
||||
remainDays: daysFromToday(new Date(planEnd.getTime() + 50 * 86400000)),
|
||||
totalQty: 1800,
|
||||
doneQty: 120,
|
||||
progress: Math.round((120 / 1800) * 100),
|
||||
processDone: 2,
|
||||
processTotal: 12,
|
||||
currentProcess: '工序 3 · 主板焊接',
|
||||
status: '生产中',
|
||||
traceStepCount: 2016,
|
||||
traceable: true,
|
||||
steps: progressSteps,
|
||||
},
|
||||
],
|
||||
traces,
|
||||
trends: { production: trends },
|
||||
points: buildDemoPoints(),
|
||||
|
||||
@@ -113,3 +113,16 @@
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
|
||||
/* 虚拟工位滚动栏:两份内容拷贝拼接,translateY 到 -contentH 实现无缝循环
|
||||
(--scroll-to 由组件按内容高度内联注入;速度 = 高度/22px 每秒,最低 12s) */
|
||||
.linemodel-svg .lm-vscroll-track {
|
||||
animation-name: lm-vscroll;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
|
||||
@keyframes lm-vscroll {
|
||||
from { transform: translateY(0); }
|
||||
to { transform: translateY(var(--scroll-to, -200px)); }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { AgvRobot, DashboardData, LinePoint, Station } from '../types';
|
||||
import './LineModel.css';
|
||||
|
||||
@@ -11,9 +12,13 @@ import './LineModel.css';
|
||||
// 缓存位 C2C3 / C5C6 / C8C9 / C11C12 / C14
|
||||
// 接驳台:工位 1~10 各 2 个(L=左 / R=右,共 20 个 AGV 点位)+ 库房接驳台 JBT21
|
||||
//
|
||||
// 画布比例 1900×540(≈ 全宽主视觉容器 3.5:1)——横长比例与真实产线一致,SVG 铺满不留黑边。
|
||||
// 画布比例 2080×540——横长比例与真实产线一致,SVG 铺满不留黑边。
|
||||
// 纵向分区:上排接驳台(64~94) / 上排工位(100~204) / 主线带(240~288) / 下排工位(324~428) / 下排接驳台(438~468)
|
||||
// 横向分区:主线+工位(x 40~1560) / 库房侧 JBT21+AGV+图例(x 1610~1810)
|
||||
// 横向分区:主线+工位(x 40~1560) / 库房侧 JBT21+AGV+图例(x 1610~1810) / 虚拟工位滚动栏(x 1840~2070)
|
||||
//
|
||||
// 展示命名(产品口径,人能看懂):工位卡=工位1~工位12;接驳台=工位N左/工位N右;
|
||||
// 主线块=停靠位/缓存位(缓存区成组框标注);数据通道 code(C1~C15/G1L..G10R/JBT21)保持不变,
|
||||
// 仅改显示文本,PLC 点位映射不受影响。
|
||||
//
|
||||
// 数据:工位状态/SN/操作人/完成数 ← equipment;点位亮灭 ← points(PLC 48 位);
|
||||
// 在途流光 ← points.transit(MW 非 0 的真实路径指令,同一时刻至多一条);
|
||||
@@ -21,7 +26,7 @@ import './LineModel.css';
|
||||
// 动效:全部 CSS 动画 / transition,无 JS 帧循环(4K 不掉帧)
|
||||
// ============================================================
|
||||
|
||||
const VIEW_W = 1900;
|
||||
const VIEW_W = 2080;
|
||||
const VIEW_H = 540;
|
||||
|
||||
// 主线 15 个位置:块宽 76、步长 96(C1 中心 140 → C15 中心 1484)
|
||||
@@ -33,6 +38,14 @@ const cx = (i: number) => 140 + (i - 1) * C_STEP;
|
||||
|
||||
// 停靠位(不缓存,正对工位对)
|
||||
const STOP_C = [1, 4, 7, 10, 13, 15];
|
||||
// 缓存区(非停靠位成组框标注):C2C3 / C5C6 / C8C9 / C11C12 / C14
|
||||
const CACHE_GROUPS: number[][] = [
|
||||
[2, 3],
|
||||
[5, 6],
|
||||
[8, 9],
|
||||
[11, 12],
|
||||
[14],
|
||||
];
|
||||
// 工位对 → 停靠位
|
||||
const PAIR_STOP: Array<[number, number, number]> = [
|
||||
[1, 2, 1],
|
||||
@@ -62,6 +75,13 @@ const JBT_X = WAREHOUSE_X + WAREHOUSE_W / 2;
|
||||
const JBT_Y = 120;
|
||||
const AGV_LANE_Y = 190;
|
||||
|
||||
// 虚拟工位滚动栏(库房侧右侧):数量不定,超出可视高度自动无缝滚动
|
||||
const VIRT_X = 1840;
|
||||
const VIRT_W = 230;
|
||||
const VIRT_Y = 56;
|
||||
const VIRT_H = 412;
|
||||
const VIRT_ROW_H = 46;
|
||||
|
||||
// ============================================================
|
||||
// 点位坐标表(流光端点 / AGV 目标定位)
|
||||
// ============================================================
|
||||
@@ -156,6 +176,11 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
const agv1 = data.agv.find((a) => a.code.endsWith('01'));
|
||||
const agv2 = data.agv.find((a) => a.code.endsWith('02'));
|
||||
|
||||
const virtuals = data.virtualStations || [];
|
||||
const virtContentH = virtuals.length * VIRT_ROW_H;
|
||||
// 内容超过可视高度才滚动(两份拷贝拼接 → translateY(-contentH) 无缝循环)
|
||||
const virtScroll = virtuals.length > Math.floor((VIRT_H - 60) / VIRT_ROW_H);
|
||||
|
||||
return (
|
||||
<div className={`linemodel-shell${pulsing ? ' is-pulsing' : ''}`}>
|
||||
<div className="lm-titlebar">
|
||||
@@ -164,7 +189,7 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
<span>在制 <b>{data.production.inLine ?? 0}</b> 件</span>
|
||||
<span>工位 <b>{inStation}</b> · 主线 <b>{inMain}</b> · 接驳台 <b>{inDock}</b></span>
|
||||
{data.points.mock && <span className="lm-mock">点位模拟数据</span>}
|
||||
<span className="lm-note">上排 1/3/5/7/9 + 末端 11 · 下排 2/4/6/8/10 + 末端 12</span>
|
||||
<span className="lm-note">上排 工位1/3/5/7/9 + 末端11 · 下排 工位2/4/6/8/10 + 末端12</span>
|
||||
</span>
|
||||
</div>
|
||||
<div className="lm-canvas">
|
||||
@@ -176,6 +201,9 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
<marker id="arr" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M2 1L8 5L2 9" fill="none" stroke={COLOR.dim} strokeWidth="1.5" strokeLinecap="round" />
|
||||
</marker>
|
||||
<clipPath id="virtClip">
|
||||
<rect x={VIRT_X + 4} y={VIRT_Y + 46} width={VIRT_W - 8} height={VIRT_H - 56} rx="6" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
{/* 满幅底纹:铺满整个主视觉区,不留"黑洞" */}
|
||||
@@ -213,7 +241,24 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
);
|
||||
})}
|
||||
|
||||
{/* ---------- 主线 C1~C15 ---------- */}
|
||||
{/* ---------- 缓存区分组框(C2C3 / C5C6 / C8C9 / C11C12 / C14) ---------- */}
|
||||
{CACHE_GROUPS.map((group, gi) => {
|
||||
const x1 = cx(group[0]) - C_W / 2 - 5;
|
||||
const x2 = cx(group[group.length - 1]) + C_W / 2 + 5;
|
||||
return (
|
||||
<g key={`cachegroup-${gi}`}>
|
||||
<rect
|
||||
x={x1} y={C_Y - 16} width={x2 - x1} height={C_H + 32} rx="8"
|
||||
fill="rgba(234,179,8,0.05)" stroke="rgba(234,179,8,0.3)" strokeDasharray="4 4"
|
||||
/>
|
||||
<text x={(x1 + x2) / 2} y={C_Y - 22} textAnchor="middle" fontSize="11" fill="rgba(234,179,8,0.85)">
|
||||
缓存区
|
||||
</text>
|
||||
</g>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* ---------- 主线 C1~C15(显示命名:停靠位 / 缓存位) ---------- */}
|
||||
{Array.from({ length: 15 }, (_, i) => {
|
||||
const n = i + 1;
|
||||
const isStop = STOP_C.includes(n);
|
||||
@@ -229,7 +274,7 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
/>
|
||||
{has && <rect x={bx + 12} y={C_Y + 8} width={C_W - 24} height={C_H - 26} rx="3" fill={COLOR.tray} opacity="0.9" />}
|
||||
<text x={cx(n)} y={C_Y + C_H - 10} textAnchor="middle" fontSize="13" fontWeight="600" fill={has ? COLOR.cyan : '#94a3b8'}>
|
||||
C{n}
|
||||
{isStop ? '停靠位' : '缓存位'}
|
||||
</text>
|
||||
</g>
|
||||
);
|
||||
@@ -245,10 +290,10 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
<StationBox x={center} y={STATION_BOT_Y} station={byNo.get(down)} no={down} />
|
||||
{!isEnd && (
|
||||
<>
|
||||
<DockBox x={dockX(center, 1)} y={DOCK_TOP_Y} has={hasDock(up, 1)} label={`G${up}L`} />
|
||||
<DockBox x={dockX(center, 2)} y={DOCK_TOP_Y} has={hasDock(up, 2)} label={`G${up}R`} />
|
||||
<DockBox x={dockX(center, 1)} y={DOCK_BOT_Y} has={hasDock(down, 1)} label={`G${down}L`} below />
|
||||
<DockBox x={dockX(center, 2)} y={DOCK_BOT_Y} has={hasDock(down, 2)} label={`G${down}R`} below />
|
||||
<DockBox x={dockX(center, 1)} y={DOCK_TOP_Y} has={hasDock(up, 1)} label={`工位${up}左`} />
|
||||
<DockBox x={dockX(center, 2)} y={DOCK_TOP_Y} has={hasDock(up, 2)} label={`工位${up}右`} />
|
||||
<DockBox x={dockX(center, 1)} y={DOCK_BOT_Y} has={hasDock(down, 1)} label={`工位${down}左`} below />
|
||||
<DockBox x={dockX(center, 2)} y={DOCK_BOT_Y} has={hasDock(down, 2)} label={`工位${down}右`} below />
|
||||
</>
|
||||
)}
|
||||
</g>
|
||||
@@ -265,8 +310,8 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
stroke={hasJbt ? COLOR.dockOn : COLOR.dockEdge} strokeWidth="1.4"
|
||||
/>
|
||||
{hasJbt && <rect x={WAREHOUSE_X + 18} y={JBT_Y - 20} width={WAREHOUSE_W - 36} height="30" rx="4" fill={COLOR.dockOn} opacity="0.85" />}
|
||||
<text x={JBT_X} y={JBT_Y + 8} textAnchor="middle" fontSize="17" fontWeight="600" fill={hasJbt ? '#0b1220' : COLOR.text}>JBT21</text>
|
||||
<text x={JBT_X} y={JBT_Y + 50} textAnchor="middle" fontSize="12" fill={COLOR.dim}>库房接驳台</text>
|
||||
<text x={JBT_X} y={JBT_Y + 8} textAnchor="middle" fontSize="16" fontWeight="600" fill={hasJbt ? '#0b1220' : COLOR.text}>库房接驳台</text>
|
||||
<text x={JBT_X} y={JBT_Y + 50} textAnchor="middle" fontSize="12" fill={COLOR.dim}>JBT21</text>
|
||||
</g>
|
||||
|
||||
<g>
|
||||
@@ -281,13 +326,51 @@ export function LineModel({ data }: { data: DashboardData }) {
|
||||
|
||||
<g transform={`translate(${WAREHOUSE_X}, 424)`}>
|
||||
<LegendRow y={0} color={COLOR.stopOn} label="停靠位(到位即进工位)" />
|
||||
<LegendRow y={22} color={COLOR.cacheEdge} label="缓存位(可临时停放)" />
|
||||
<LegendRow y={22} color={COLOR.cacheEdge} label="缓存区(可临时停放)" />
|
||||
<LegendRow y={44} color={COLOR.tray} label="托盘 / 在制工件" />
|
||||
<LegendRow y={66} color={COLOR.dockOn} label="接驳台有料(AGV 点位)" />
|
||||
</g>
|
||||
|
||||
{/* ---------- 虚拟工位滚动栏(库房侧右侧):不连 PLC 的记录型工位,数量不定 → 超高自动无缝滚动 ---------- */}
|
||||
<g>
|
||||
<rect
|
||||
x={VIRT_X} y={VIRT_Y} width={VIRT_W} height={VIRT_H} rx="8"
|
||||
fill="rgba(13,26,51,0.4)" stroke="rgba(125,211,252,0.28)" strokeDasharray="6 6"
|
||||
/>
|
||||
<text x={VIRT_X + VIRT_W / 2} y={VIRT_Y + 24} textAnchor="middle" fontSize="13" fill="#7dd3fc" letterSpacing="2">
|
||||
虚拟工位
|
||||
</text>
|
||||
<text x={VIRT_X + VIRT_W / 2} y={VIRT_Y + 42} textAnchor="middle" fontSize="11" fill={COLOR.dim}>
|
||||
不连 PLC · 仅记录{virtScroll ? ' · 自动滚动' : ''}
|
||||
</text>
|
||||
{virtuals.length === 0 ? (
|
||||
<text x={VIRT_X + VIRT_W / 2} y={VIRT_Y + VIRT_H / 2} textAnchor="middle" fontSize="12" fill={COLOR.dim}>
|
||||
暂无虚拟工位
|
||||
</text>
|
||||
) : (
|
||||
<g clipPath="url(#virtClip)">
|
||||
<g
|
||||
className={virtScroll ? 'lm-vscroll-track' : undefined}
|
||||
style={virtScroll ? ({ '--scroll-to': `-${virtContentH}px`, animationDuration: `${Math.max(12, Math.round(virtContentH / 22))}s` } as CSSProperties) : undefined}
|
||||
>
|
||||
{[0, 1].map((copy) =>
|
||||
virtuals.map((v, i) => (
|
||||
<VirtualRow
|
||||
key={`${copy}-${v.id}`}
|
||||
x={VIRT_X + 10}
|
||||
y={VIRT_Y + 52 + (copy * virtuals.length + i) * VIRT_ROW_H}
|
||||
w={VIRT_W - 20}
|
||||
station={v}
|
||||
/>
|
||||
)),
|
||||
)}
|
||||
</g>
|
||||
</g>
|
||||
)}
|
||||
</g>
|
||||
|
||||
<text x="60" y="526" fontSize="12" fill={COLOR.dim}>
|
||||
虚线箭头 = 主线自左向右单向流动 · 布局依据:产线布局说明(停靠位 C1/C4/C7/C10/C13/C15;缓存位 C2C3 / C5C6 / C8C9 / C11C12 / C14)
|
||||
虚线箭头 = 主线自左向右单向流动 · 停靠位(C1/C4/C7/C10/C13/C15,到位即顶升进工位)· 缓存区(C2C3 / C5C6 / C8C9 / C11C12 / C14,可临时停放)
|
||||
</text>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -314,7 +397,7 @@ function StationBox({
|
||||
return (
|
||||
<g transform={`translate(${x - W / 2}, ${y})`}>
|
||||
<rect width={W} height={STATION_H} rx="8" fill={fill} stroke={edge} strokeWidth="1.6" strokeDasharray={end ? '6 4' : undefined} />
|
||||
<text x="12" y="28" fontSize="19" fontWeight="700" fill="#f1f5f9">{end ? `G${no} 下料` : `G${no}`}</text>
|
||||
<text x="12" y="28" fontSize="19" fontWeight="700" fill="#f1f5f9">{end ? `工位${no} 下料` : `工位${no}`}</text>
|
||||
<circle cx={W - 15} cy="19" r="5" fill={running ? '#67e8f9' : offline ? '#94a3b8' : '#60a5fa'} className={running ? 'status-blink' : undefined} />
|
||||
{paused && (
|
||||
<g transform={`translate(${W - 40}, 11)`}>
|
||||
@@ -365,6 +448,35 @@ function LegendRow({ y, color, label }: { y: number; color: string; label: strin
|
||||
);
|
||||
}
|
||||
|
||||
/** 虚拟工位状态文案 */
|
||||
const VIRT_STATUS: Record<string, { label: string; color: string }> = {
|
||||
running: { label: '作业中', color: '#67e8f9' },
|
||||
idle: { label: '空闲', color: '#94a3b8' },
|
||||
alarm: { label: '报警', color: '#f59e0b' },
|
||||
offline: { label: '离线', color: '#64748b' },
|
||||
};
|
||||
|
||||
/** 虚拟工位行卡(滚动栏内):名称+状态+今日完成 / 在制 SN 或最近工序 */
|
||||
function VirtualRow({ x, y, w, station }: { x: number; y: number; w: number; station: Station }) {
|
||||
const st = VIRT_STATUS[station.status] || VIRT_STATUS.idle;
|
||||
const info = station.currentSn
|
||||
? `SN ${station.currentSn}`
|
||||
: station.currentProcess
|
||||
? station.currentProcess
|
||||
: '无在制工件';
|
||||
return (
|
||||
<g transform={`translate(${x}, ${y})`}>
|
||||
<rect width={w} height={VIRT_ROW_H - 8} rx="5" fill="rgba(30,64,175,0.28)" stroke={st.color} strokeOpacity="0.5" strokeWidth="1" />
|
||||
<text x="10" y="17" fontSize="12.5" fontWeight="600" fill="#e2e8f0">
|
||||
{station.name || `虚拟工位${station.id}`}
|
||||
<tspan fill={st.color} dx="8">{st.label}</tspan>
|
||||
{station.doneCount ? <tspan fill={COLOR.dim} dx="8">今日完成 {station.doneCount}</tspan> : null}
|
||||
</text>
|
||||
<text x="10" y="33" fontSize="11.5" fill={station.currentSn ? COLOR.cyan : COLOR.dim}>{info}</text>
|
||||
</g>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* AGV 小车:真实备料任务驱动。
|
||||
* 无任务 → 待命区;loading → 停起点;moving → CSS transition 平滑滑向目标;到位 → 停目标。
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import type { EChartsOption } from 'echarts';
|
||||
import type { DashboardData } from '../types';
|
||||
import type { DashboardData, ProductionProgress } from '../types';
|
||||
import { EChart } from '../components/EChart';
|
||||
import { dash0 } from './WarehouseBoard';
|
||||
|
||||
@@ -11,9 +12,79 @@ const C = {
|
||||
dim: '#64748b',
|
||||
};
|
||||
|
||||
/** 底部左块 · 当前订单(合同/工期/完成度)+ 近 7 日产量趋势 */
|
||||
/** 轮播间隔(毫秒):多订单时逐单展示 */
|
||||
const ROTATE_MS = 10000;
|
||||
|
||||
/** 单张订单卡(左块):合同/工期/完成度 */
|
||||
function OrderCard({ order }: { order: ProductionProgress }) {
|
||||
return (
|
||||
<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' }}>
|
||||
{order.contractNo || order.orderNo || '暂无在产订单'}
|
||||
</div>
|
||||
|
||||
<div style={{ fontSize: 'clamp(11px, 0.85vw, 33px)', color: C.sub, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||
{order.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 }}>{order.planEnd || '—'}</span>
|
||||
</span>
|
||||
<span style={{ whiteSpace: 'nowrap', color: order.remainDays >= 0 ? C.green : '#fbbf24' }}>
|
||||
剩余 {order.planEnd ? Math.max(order.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(order.doneQty)}</span>
|
||||
<span style={{ fontSize: 'clamp(10px, 0.8vw, 31px)', color: C.sub }}> / {dash0(order.totalQty)} 台</span>
|
||||
</span>
|
||||
</div>
|
||||
<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, order.progress))}%`,
|
||||
height: '100%',
|
||||
background: 'linear-gradient(90deg, #0ea5e9, #22d3ee)',
|
||||
transition: 'width 0.6s ease',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ fontSize: 'clamp(10px, 0.78vw, 29px)', color: C.dim, marginTop: 4, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||
工序 {dash0(order.processDone)}/{dash0(order.processTotal)}
|
||||
{order.currentProcess ? ` · 当前 ${order.currentProcess}` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 底部左块 · 当前订单(多订单自动轮播)+ 近 7 日产量趋势 */
|
||||
export function ProductionBoard({ data }: { data: DashboardData }) {
|
||||
const { progress, trends } = data;
|
||||
const { trends } = data;
|
||||
|
||||
// 多订单轮播:progressList 优先(后端下发,进行中排前),未升级时退回单条 progress
|
||||
const orders = useMemo<ProductionProgress[]>(() => {
|
||||
const list = (data.progressList || []).filter((o) => o && (o.orderNo || o.contractNo));
|
||||
if (list.length > 0) return list;
|
||||
return data.progress ? [data.progress] : [];
|
||||
}, [data.progressList, data.progress]);
|
||||
|
||||
const [idx, setIdx] = useState(0);
|
||||
useEffect(() => {
|
||||
setIdx(0);
|
||||
}, [orders.length]);
|
||||
useEffect(() => {
|
||||
if (orders.length <= 1) return;
|
||||
const t = setInterval(() => setIdx((i) => (i + 1) % orders.length), ROTATE_MS);
|
||||
return () => clearInterval(t);
|
||||
}, [orders.length]);
|
||||
|
||||
const current = orders[Math.min(idx, orders.length - 1)];
|
||||
|
||||
const trendOption: EChartsOption = {
|
||||
grid: { left: 8, right: 12, top: 14, bottom: 4, containLabel: true },
|
||||
@@ -50,51 +121,15 @@ export function ProductionBoard({ data }: { data: DashboardData }) {
|
||||
<div className="panel-head">
|
||||
当前订单
|
||||
<span className="note">合同 · 工期 · 完成度</span>
|
||||
{orders.length > 1 && (
|
||||
<span style={{ marginLeft: 'auto', fontSize: 'clamp(9px, 0.7vw, 26px)', color: C.dim }}>
|
||||
{idx + 1}/{orders.length}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<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>
|
||||
</span>
|
||||
<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>
|
||||
</div>
|
||||
<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',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
{/* 左:订单信息(多订单轮播,无鼠标大屏 10s 自动切换) */}
|
||||
{current && <OrderCard key={current.orderNo} order={current} />}
|
||||
|
||||
{/* 右:近 7 日产量趋势(height:100% 跟随容器) */}
|
||||
<div style={{ flex: '1 1 54%', minWidth: 0, display: 'flex', flexDirection: 'column' }}>
|
||||
|
||||
@@ -247,7 +247,11 @@ export interface DashboardData {
|
||||
production: ProductionOverview;
|
||||
warehouse: WarehouseOverview;
|
||||
equipment: Station[];
|
||||
/** 虚拟工位(OFFLINE,不连PLC):产线动态地图"虚拟工位"滚动栏展示;后端未升级时为空 */
|
||||
virtualStations?: Station[];
|
||||
progress: ProductionProgress;
|
||||
/** 当前在产订单列表(多订单轮播):进行中排前,最多 6 条,首条与 progress 一致;后端未升级时为空 */
|
||||
progressList?: ProductionProgress[];
|
||||
/** 追溯轮播数据(最近完工工件) */
|
||||
traces: TraceItem[];
|
||||
trends: TrendData;
|
||||
|
||||
Reference in New Issue
Block a user