feat: 大屏新增虚拟工位滚动栏与多订单轮播,附件表增加删除原因及彻底清除留痕字段
This commit is contained in:
@@ -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' }}>
|
||||
|
||||
Reference in New Issue
Block a user