自适应完成

This commit is contained in:
mmc
2026-05-14 12:44:18 +08:00
parent d7808a38e1
commit 5e397698d2
7 changed files with 1793 additions and 1409 deletions

View File

@@ -10,7 +10,8 @@ import {
EyeOutlined, CommentOutlined, PauseOutlined, FormOutlined,
ReloadOutlined, FilterOutlined, MoreOutlined,
CheckCircleFilled, PlayCircleFilled, InfoCircleFilled,
RobotOutlined, ThunderboltOutlined, AlertOutlined
RobotOutlined, ThunderboltOutlined, AlertOutlined,
CheckCircleOutlined
} from '@ant-design/icons';
import { Pie, Line } from '@ant-design/charts';
import {
@@ -82,55 +83,6 @@ const WorkOrderPage = () => {
{ title: 'AI建议生成', value: 7, unit: '单', subValue: '', subText: '今日自动生成', icon: <Cpu size={24} color="#722ed1" />, bg: '#f9f0ff' },
];
// 表格列【已适配后端真实字段】
const columns = [
{ title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 130 },
{ title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 180, ellipsis: true },
{
title: '类型',
dataIndex: 'orderType',
key: 'orderType',
width: 80,
render: (val) => orderTypeConfig[val] || '未知'
},
{
title: '优先级',
dataIndex: 'priorityLevel',
key: 'priorityLevel',
width: 80,
render: (p) => (
<Tag
style={{
color: priorityConfig[p]?.color,
background: priorityConfig[p]?.bg,
border: `1px solid ${priorityConfig[p]?.border}`,
borderRadius: 4
}}
>
{priorityConfig[p]?.label}
</Tag>
)
},
{ title: '负责人', dataIndex: 'assigneeName', key: 'assigneeName', width: 80 },
{ title: '截止时间', dataIndex: 'deadlineTime', key: 'deadlineTime', width: 150 },
{
title: '状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
width: 90,
render: (s) => (
<span style={{ color: orderStatusConfig[s]?.textColor }}>{orderStatusConfig[s]?.label}</span>
)
},
{
title: '操作',
key: 'action',
width: 60,
fixed: "right",
render: () => <Button type="link" size="small">查看</Button>
},
];
// 图表模拟数据保留不变
const pieData = [
{ type: '待处理', value: 12 },
@@ -259,11 +211,101 @@ const WorkOrderPage = () => {
getWorkOrderList();
}, []);
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
overflow: 'hidden'
};
// 表格列【已适配后端真实字段】
const columns = [
{ title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 130 },
{ title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 180, ellipsis: true },
{ title: '来源', dataIndex: 'sourceType', key: 'sourceType', width: 100 },
{
title: '类型',
dataIndex: 'orderType',
key: 'orderType',
width: 80,
render: (val) => orderTypeConfig[val] || '未知'
},
{
title: '优先级',
dataIndex: 'priorityLevel',
key: 'priorityLevel',
width: 80,
render: (p) => (
<Tag
style={{
color: priorityConfig[p]?.color,
background: priorityConfig[p]?.bg,
border: `1px solid ${priorityConfig[p]?.color}`,
borderRadius: 4,
margin: 0
}}
>
{priorityConfig[p]?.label}
</Tag>
)
},
{ title: '负责人', dataIndex: 'assigneeName', key: 'assigneeName', width: 80 },
{ title: '截止时间', dataIndex: 'deadlineTime', key: 'deadlineTime', width: 150 },
{
title: '状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
width: 90,
render: (s) => (
<Space size={6}>
<div style={{ width: 6, height: 6, borderRadius: '50%', background: orderStatusConfig[s]?.textColor }}></div>
<span style={{ color: orderStatusConfig[s]?.textColor, fontWeight: 500 }}>{orderStatusConfig[s]?.label}</span>
</Space>
)
},
{
title: '操作',
key: 'action',
width: 60,
fixed: "right",
render: () => <Button type="link" size="small">查看</Button>
},
];
return (
<div style={{ padding: '16px 24px', background: '#f0f2f5', minHeight: '100vh' }}>
<div style={{ padding: '16px 24px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
<style>
{`
.compact-table .ant-table-thead > tr > th {
background: #f8fafc;
padding: 10px 12px !important;
font-size: 12px;
color: #4E5969;
}
.compact-table .ant-table-tbody > tr > td {
padding: 10px 12px !important;
font-size: 12px;
}
.filter-label {
font-size: 12px;
color: #4E5969;
white-space: nowrap;
margin-right: 8px;
}
.schedule-item {
transition: all 0.3s;
cursor: pointer;
}
.schedule-item:hover {
filter: brightness(0.95);
transform: translateY(-1px);
}
`}
</style>
{/* 顶部标题和页签 */}
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16 }}>
<Title level={4} style={{ margin: '0 32px 0 0' }}>工单任务</Title>
<Title level={4} style={{ margin: '0 32px 0 0', fontWeight: 800 }}>工单任务管理</Title>
<Tabs
activeKey={activeTab}
onChange={setActiveTab}
@@ -279,62 +321,33 @@ const WorkOrderPage = () => {
</div>
{/* 统计卡片 */}
{/* 统一风格统计卡片 —— 宽高一致 + 自动换行 + 最小宽度168px */}
<Row
gutter={[16, 16]}
style={{
marginBottom: 16,
flexWrap: 'wrap',
}}
>
<Row gutter={[12, 12]} style={{ marginBottom: 16 }}>
{stats.map((item, index) => (
<Col key={index} style={{ minWidth: '168px', flex: '1 0 auto' }}>
<Card
bordered={false}
bodyStyle={{ padding: '16px' }}
style={{ borderRadius: 8, height: 120 }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', height: '100%' }}>
{/* 左侧文字 */}
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
<div style={{ fontSize: 13, color: '#86909C' }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 4, margin: '4px 0' }}>
<span style={{ fontSize: 24, fontWeight: 700, color: '#333' }}>{item.value}</span>
{item.unit && <span style={{ fontSize: 14, color: '#666' }}>{item.unit}</span>}
<Col key={index} xs={24} sm={12} md={8} xl={4}>
<Card bordered={false} bodyStyle={{ padding: '20px 16px' }} style={cardStyle}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 'clamp(12px, 0.8vw, 13px)', color: '#86909C', marginBottom: 8 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginBottom: 8 }}>
<div style={{ fontSize: 'clamp(20px, 1.4vw, 24px)', fontWeight: 800, color: '#1D2129' }}>{item.value}</div>
{item.unit && <span style={{ fontSize: 13, color: '#1D2129', fontWeight: 600 }}>{item.unit}</span>}
</div>
<div style={{ fontSize: 12 }}>
<span style={{ color: '#86909C' }}>{item.subText}</span>
<span
style={{
marginLeft: 4,
fontWeight: 'bold',
color: item.subValue.startsWith('+')
? '#52c41a'
: item.subValue.startsWith('-')
? '#ff4d4f'
: '#1890ff',
}}
>
<div style={{ fontSize: 11, color: '#86909C' }}>
{item.subText}
<span style={{
marginLeft: 4,
fontWeight: 700,
color: item.subValue.includes('+') ? '#00B42A' : (item.subValue.includes('-') ? '#F53F3F' : '#165DFF')
}}>
{item.subValue}
</span>
</div>
</div>
{/* 右侧图标 */}
<div
style={{
width: 48,
height: 48,
borderRadius: '50%',
background: item.bg,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
}}
>
<div style={{
width: 52, height: 52, borderRadius: 14, background: item.bg,
display: 'flex', alignItems: 'center', justifyContent: 'center',
boxShadow: `0 4px 10px ${item.bg}80`
}}>
{item.icon}
</div>
</div>
@@ -342,78 +355,80 @@ const WorkOrderPage = () => {
</Col>
))}
</Row>
{/* 筛选栏 */}
<Card bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ borderRadius: 8, marginBottom: 16 }}>
<Row gutter={16} align="middle">
<Col span={3}>
<Card bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ ...cardStyle, marginBottom: 16 }}>
<Row gutter={[16, 12]} align="middle">
<Col xs={12} sm={8} md={4} xl={3}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>工单类型</Text>
<Select defaultValue="all" style={{ width: '100%' }}>
<span className="filter-label">工单类型</span>
<Select defaultValue="all" style={{ width: '100%' }} size="small">
<Option value="all">全部</Option>
</Select>
</div>
</Col>
<Col span={3}>
<Col xs={12} sm={8} md={4} xl={3}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>优先级</Text>
<Select defaultValue="all" style={{ width: '100%' }}>
<span className="filter-label">优先级</span>
<Select defaultValue="all" style={{ width: '100%' }} size="small">
<Option value="all">全部</Option>
</Select>
</div>
</Col>
<Col span={3}>
<Col xs={12} sm={8} md={4} xl={3}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>负责人</Text>
<Select defaultValue="all" style={{ width: '100%' }}>
<span className="filter-label">负责人</span>
<Select defaultValue="all" style={{ width: '100%' }} size="small">
<Option value="all">全部</Option>
</Select>
</div>
</Col>
<Col span={5}>
<Col xs={24} sm={16} md={8} xl={5}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>时间范围</Text>
<RangePicker style={{ width: '100%' }} />
<span className="filter-label">时间范围</span>
<RangePicker style={{ width: '100%' }} size="small" />
</div>
</Col>
<Col span={3}>
<Col xs={12} sm={8} md={4} xl={3}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>状态</Text>
<Select defaultValue="all" style={{ width: '100%' }}>
<span className="filter-label">状态</span>
<Select defaultValue="all" style={{ width: '100%' }} size="small">
<Option value="all">全部</Option>
</Select>
</div>
</Col>
<Col span={4}>
<Col xs={24} sm={16} md={10} xl={4}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Text style={{ marginRight: 8, whiteSpace: 'nowrap' }}>关键词</Text>
<Input placeholder="请输入工单编号/标题" suffix={<SearchOutlined />} />
<span className="filter-label">关键词</span>
<Input placeholder="请输入工单编号/标题" prefix={<SearchOutlined />} size="small" />
</div>
</Col>
<Col span={3} style={{ textAlign: 'right' }}>
<Col xs={24} sm={8} md={4} xl={3} style={{ textAlign: 'right' }}>
<Space>
<Button>重置</Button>
<Button type="primary">查询</Button>
<Button size="small">重置</Button>
<Button type="primary" size="small" icon={<SearchOutlined />}>查询</Button>
</Space>
</Col>
</Row>
</Card>
<Row gutter={16}>
<Row gutter={[12, 12]}>
{/* 左侧:列表 + 底部图表 */}
<Col span={15}>
<Col xs={24} xl={15}>
<Card
bordered={false}
title={<div style={{ display: 'flex', alignItems: 'center' }}><Text strong style={{ fontSize: 16 }}>工单列表</Text><Text type="secondary" style={{ fontSize: 12, marginLeft: 8 }}>(共 {workOrderTotal} 条)</Text></div>}
title={<Space size={8}><Text strong style={{ fontSize: 15, color: '#1D2129' }}>工单列表</Text><Text type="secondary" style={{ fontSize: 12 }}>(共 {workOrderTotal} 条)</Text></Space>}
bodyStyle={{ padding: 0 }}
style={{ borderRadius: 8, marginBottom: 16 }}
style={{ ...cardStyle, marginBottom: 16 }}
>
<Table
dataSource={workOrderList}
columns={columns}
pagination={false}
loading={loading}
size="middle"
size="small"
rowKey="id"
className="compact-table"
scroll={{ x: 'max-content' }}
rowSelection={{
type: 'radio',
@@ -421,74 +436,76 @@ const WorkOrderPage = () => {
onChange: handleRowSelect
}}
/>
<div style={{ padding: '16px', textAlign: 'right' }}>
<div style={{ padding: '12px 16px', textAlign: 'right' }}>
<Pagination size="small" total={workOrderTotal} showSizeChanger showQuickJumper />
</div>
</Card>
<Row gutter={16}>
<Col span={10}>
<Card bordered={false} title="工单状态分布" style={{ borderRadius: 8, height: 360 }}>
<div style={{ height: 280, position: 'relative' }}>
<Row gutter={[12, 12]}>
<Col xs={24} md={9}>
<Card bordered={false} title={<Text strong style={{ fontSize: 14 }}>工单状态分布</Text>} style={{ ...cardStyle, height: 380 }}>
<div style={{ height: 300, position: 'relative' }}>
<Pie
data={pieData}
angleField="value"
colorField="type"
radius={1}
innerRadius={0.6}
innerRadius={0.65}
label={false}
color={['#1890ff', '#165DFF', '#00B42A', '#F53F3F']}
legend={{
position: 'right',
layout: 'vertical',
itemValueLabel: {
formatter: (text, item) => {
const total = pieData.reduce((a, b) => a + b.value, 0);
const percent = ((item.value / total) * 100).toFixed(2);
const percent = ((item.value / total) * 100).toFixed(1);
return `${item.value} (${percent}%)`;
}
}
}}
height={240}
height={260}
/>
<div style={{ position: 'absolute', top: '42%', left: '30%', textAlign: 'center', transform: 'translate(-50%, -50%)' }}>
<div style={{ fontSize: 14, color: '#8c8c8c' }}>总数</div>
<div style={{ fontSize: 24, fontWeight: 'bold' }}>{workOrderTotal}</div>
<div style={{ fontSize: 12, color: '#86909C' }}>总数</div>
<div style={{ fontSize: 28, fontWeight: 800, color: '#1D2129' }}>{workOrderTotal}</div>
</div>
</div>
</Card>
</Col>
<Col span={14}>
<Col xs={24} md={15}>
<Card
bordered={false}
title="任务排班 / 日历视图"
title={<Text strong style={{ fontSize: 14 }}>任务排班 / 日历视图</Text>}
extra={<Button type="link" size="small">更多 <ChevronRight size={14} /></Button>}
style={{ borderRadius: 8, height: 360 }}
style={{ ...cardStyle, height: 380 }}
bodyStyle={{ padding: '16px' }}
>
<div style={{ marginBottom: 12 }}>
<div style={{ marginBottom: 16 }}>
<Space>
<Button size="small" icon={<ChevronRight style={{ transform: 'rotate(180deg)' }} size={14} />} />
<Text strong>2025-05-24 (今天)</Text>
<Text strong style={{ fontSize: 13 }}>2025-05-24 (今天)</Text>
<Button size="small" icon={<ChevronRight size={14} />} />
</Space>
</div>
<div style={{ border: '1px solid #f0f0f0', borderRadius: 4, overflow: 'hidden' }}>
<div style={{ display: 'flex', background: '#fafafa', borderBottom: '1px solid #f0f0f0' }}>
<div style={{ width: 60, padding: '8px', borderRight: '1px solid #f0f0f0' }}></div>
<div style={{ border: '1px solid #f0f0f0', borderRadius: 8, overflow: 'hidden' }}>
<div style={{ display: 'flex', background: '#f8fafc', borderBottom: '1px solid #f0f0f0' }}>
<div style={{ width: 60, padding: '10px 0', borderRight: '1px solid #f0f0f0' }}></div>
{['08:00', '10:00', '12:00', '14:00', '16:00', '18:00'].map(t => (
<div key={t} style={{ flex: 1, padding: '8px', textAlign: 'center', fontSize: 12 }}>{t}</div>
<div key={t} style={{ flex: 1, padding: '10px 0', textAlign: 'center', fontSize: 11, color: '#86909C', fontWeight: 500 }}>{t}</div>
))}
</div>
{['李工', '王工', '赵工', '陈工'].map((name, idx) => (
<div key={name} style={{ display: 'flex', borderBottom: idx === 3 ? 'none' : '1px solid #f0f0f0', height: 50, position: 'relative' }}>
<div style={{ width: 60, padding: '8px', borderRight: '1px solid #f0f0f0', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12 }}>{name}</div>
<div key={name} style={{ display: 'flex', borderBottom: idx === 3 ? 'none' : '1px solid #f0f0f0', height: 56, position: 'relative' }}>
<div style={{ width: 60, padding: '8px 0', borderRight: '1px solid #f0f0f0', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12, fontWeight: 600, color: '#4E5969' }}>{name}</div>
<div style={{ flex: 1, position: 'relative' }}>
{idx === 0 && <div style={{ position: 'absolute', left: '10%', top: 5, width: '40%', height: 40, background: '#f6ffed', border: '1px solid #b7eb8f', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>INV-05 告警排查<br />08:30 - 12:00</div>}
{idx === 1 && <div style={{ position: 'absolute', left: '55%', top: 5, width: '30%', height: 40, background: '#e6f7ff', border: '1px solid #91d5ff', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>B-12 热斑复检<br />13:30 - 15:00</div>}
{idx === 1 && <div style={{ position: 'absolute', left: '86%', top: 5, width: '12%', height: 40, background: '#f0f5ff', border: '1px solid #adc6ff', borderRadius: 4, borderStyle: 'dashed', padding: '2px 4px', fontSize: 10 }}>无人机巡检<br />16:00-18:00</div>}
{idx === 2 && <div style={{ position: 'absolute', left: '20%', top: 5, width: '35%', height: 40, background: '#f9f0ff', border: '1px solid #d3adf7', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>组件清洗 C-05<br />09:00 - 12:00</div>}
{idx === 2 && <div style={{ position: 'absolute', left: '70%', top: 5, width: '25%', height: 40, background: '#fff7e6', border: '1px solid #ffe7ba', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>清洗效果复检<br />15:00 - 17:00</div>}
{idx === 3 && <div style={{ position: 'absolute', left: '30%', top: 5, width: '30%', height: 40, background: '#fff2e8', border: '1px solid #ffbb96', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>周界摄像头修复<br />10:00 - 12:30</div>}
{idx === 3 && <div style={{ position: 'absolute', left: '75%', top: 5, width: '20%', height: 40, background: '#fffbe6', border: '1px solid #ffe58f', borderRadius: 4, padding: '2px 8px', fontSize: 10 }}>设备巡检<br />15:30 - 17:30</div>}
{idx === 0 && <div className="schedule-item" style={{ position: 'absolute', left: '5%', top: 8, width: '45%', height: 40, background: '#E8FFEA', border: '1px solid #00B42A', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#00B42A' }}><b>INV-05 告警排查</b><br />08:30 - 12:00</div>}
{idx === 1 && <div className="schedule-item" style={{ position: 'absolute', left: '55%', top: 8, width: '25%', height: 40, background: '#E8F3FF', border: '1px solid #165DFF', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#165DFF' }}><b>B-12 热斑复检</b><br />13:30 - 15:00</div>}
{idx === 1 && <div className="schedule-item" style={{ position: 'absolute', left: '82%', top: 8, width: '15%', height: 40, background: '#F5F8FF', border: '1px dashed #2F54EB', borderRadius: 6, padding: '4px 8px', fontSize: 10, color: '#2F54EB' }}><b>无人机巡检</b><br />16:00-18:00</div>}
{idx === 2 && <div className="schedule-item" style={{ position: 'absolute', left: '15%', top: 8, width: '35%', height: 40, background: '#F9F0FF', border: '1px solid #722ED1', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#722ED1' }}><b>组件清洗 C-05</b><br />09:00 - 12:00</div>}
{idx === 2 && <div className="schedule-item" style={{ position: 'absolute', left: '70%', top: 8, width: '25%', height: 40, background: '#FFF7E8', border: '1px solid #F7BA1E', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#F7BA1E' }}><b>清洗效果复检</b><br />15:00 - 17:00</div>}
{idx === 3 && <div className="schedule-item" style={{ position: 'absolute', left: '25%', top: 8, width: '30%', height: 40, background: '#FFF1F0', border: '1px solid #F53F3F', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#F53F3F' }}><b>周界摄像头修复</b><br />10:00 - 12:30</div>}
{idx === 3 && <div className="schedule-item" style={{ position: 'absolute', left: '75%', top: 8, width: '22%', height: 40, background: '#EFFFF4', border: '1px solid #00B42A', borderRadius: 6, padding: '4px 10px', fontSize: 10, color: '#00B42A' }}><b>设备巡检</b><br />15:30 - 17:30</div>}
</div>
</div>
))}
@@ -499,26 +516,29 @@ const WorkOrderPage = () => {
</Col>
{/* 右侧:详情 + AI + 告警 */}
<Col span={9}>
<Col xs={24} xl={9}>
<Card
bordered={false}
style={{ borderRadius: 8, marginBottom: 16 }}
bodyStyle={{ padding: '16px' }}
style={cardStyle}
bodyStyle={{ padding: '20px' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Text strong style={{ fontSize: 16 }}>工单详情</Text>
<Text type="secondary" style={{ fontSize: 12 }}>工单编号: {currentDetail?.orderNo || '--'}</Text>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 }}>
<Text strong style={{ fontSize: 16, color: '#1D2129' }}>工单详情</Text>
<Text type="secondary" style={{ fontSize: 12 }}>工单编号: <span style={{ color: '#4E5969', fontWeight: 600 }}>{currentDetail?.orderNo || '--'}</span></Text>
</div>
<div style={{ marginBottom: 20 }}>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Title level={4} style={{ margin: '0 12px 0 0' }}>{currentDetail?.orderTitle || '暂无标题'}</Title>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}>
<Title level={4} style={{ margin: 0, fontSize: 18, fontWeight: 800 }}>{currentDetail?.orderTitle || '暂无标题'}</Title>
{currentDetail?.priorityLevel && (
<Tag
style={{
color: priorityConfig[currentDetail.priorityLevel]?.color,
background: priorityConfig[currentDetail.priorityLevel]?.bg,
border: `1px solid ${priorityConfig[currentDetail.priorityLevel]?.border}`
border: `1px solid ${priorityConfig[currentDetail.priorityLevel]?.color}`,
borderRadius: 4,
fontWeight: 600,
margin: 0
}}
>
{priorityConfig[currentDetail.priorityLevel].label}优先级
@@ -526,126 +546,133 @@ const WorkOrderPage = () => {
)}
</div>
<Row gutter={[0, 12]}>
<Col span={12}><Text type="secondary">来源:</Text><Text>{currentDetail?.sourceType || '--'}</Text></Col>
<Col span={12}><Text type="secondary">工单类型:</Text><Text>{orderTypeConfig[currentDetail?.orderType] || '--'}</Text></Col>
<Col span={12}><Text type="secondary">负责人:</Text><Text>{currentDetail?.assigneeName || '--'}</Text></Col>
<Col span={12}><Text type="secondary">协同人员:</Text><Text>{currentDetail?.collaboratorNames || '无'}</Text></Col>
<Col span={24}><Text type="secondary">计划时间:</Text><Text>{currentDetail?.planStartTime ? `${currentDetail.planStartTime} ~ ${currentDetail.planEndTime}` : '--'}</Text></Col>
<Col span={12}><Text type="secondary">关联设备:</Text><Text style={{ color: '#1890ff' }}>{currentDetail?.deviceName || '无'}</Text></Col>
<Col span={12}><Text type="secondary">关联电站:</Text><Text>{currentDetail?.siteName || '无'}</Text></Col>
<Row gutter={[16, 16]} style={{ background: '#f8fafc', padding: 16, borderRadius: 12, marginBottom: 20 }}>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>来源:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.sourceType || '--'}</Text></Col>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>工单类型:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{orderTypeConfig[currentDetail?.orderType] || '--'}</Text></Col>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>负责人:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.assigneeName || '--'}</Text></Col>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>协同人员:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.collaboratorNames || '无'}</Text></Col>
<Col span={24}><Text type="secondary" style={{ fontSize: 12 }}>计划时间:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.planStartTime ? `${currentDetail.planStartTime} ~ ${currentDetail.planEndTime}` : '--'}</Text></Col>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>关联设备:</Text><Text style={{ fontSize: 12, color: '#165DFF', fontWeight: 600 }}>{currentDetail?.deviceName || '无'}</Text></Col>
<Col span={12}><Text type="secondary" style={{ fontSize: 12 }}>关联区域:</Text><Text style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.siteName || '无'}</Text></Col>
<Col span={24}>
<Text type="secondary">当前状态:</Text>
<Tag color="blue" style={{ borderRadius: 10 }}>{orderStatusConfig[currentDetail?.orderStatus]?.label || '--'}</Tag>
<Text type="secondary" style={{ fontSize: 12 }}>当前状态:</Text>
<Tag color="blue" style={{ borderRadius: 4, fontWeight: 600, border: 'none', background: '#E8F3FF', color: '#165DFF' }}>{orderStatusConfig[currentDetail?.orderStatus]?.label || '--'}</Tag>
</Col>
<Col span={24}>
<Text type="secondary">任务描述:</Text>
<Text>{currentDetail?.taskDescription || '暂无描述'}</Text>
<Text type="secondary" style={{ fontSize: 12 }}>任务描述:</Text>
<div style={{ fontSize: 12, color: '#4E5969', marginTop: 4, lineHeight: 1.6 }}>{currentDetail?.taskDescription || '暂无描述'}</div>
</Col>
</Row>
</div>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 10px', marginBottom: 8 }}>
<div style={{ textAlign: 'center' }}>
<CheckCircleFilled style={{ color: '#52c41a', fontSize: 20 }} />
<div style={{ fontSize: 12, marginTop: 4 }}>已创建</div>
</div>
<div style={{ flex: 1, height: 2, background: '#52c41a', marginTop: 10 }}></div>
<div style={{ textAlign: 'center' }}>
<CheckCircleFilled style={{ color: '#52c41a', fontSize: 20 }} />
<div style={{ fontSize: 12, marginTop: 4 }}>已派发</div>
</div>
<div style={{ flex: 1, height: 2, background: '#1890ff', marginTop: 10 }}></div>
<div style={{ textAlign: 'center' }}>
<div style={{ width: 20, height: 20, borderRadius: '50%', background: '#1890ff', color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12 }}>3</div>
<div style={{ fontSize: 12, marginTop: 4 }}>执行中</div>
</div>
<div style={{ flex: 1, height: 2, background: '#f0f0f0', marginTop: 10 }}></div>
<div style={{ textAlign: 'center' }}>
<div style={{ width: 20, height: 20, borderRadius: '50%', border: '1px solid #d9d9d9', color: '#d9d9d9', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12 }}>4</div>
<div style={{ fontSize: 12, marginTop: 4, color: '#d9d9d9' }}>已完成</div>
<div style={{ marginBottom: 32 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 10px', position: 'relative' }}>
{/* 连线 */}
<div style={{ position: 'absolute', top: 11, left: '15%', right: '15%', height: 2, background: '#f0f0f0', zIndex: 1 }}>
<div style={{ width: currentDetail?.orderStatus >= 3 ? '100%' : (currentDetail?.orderStatus === 2 ? '66%' : '33%'), height: '100%', background: '#00B42A' }}></div>
</div>
{[
{ label: '已创建', step: 1, active: currentDetail?.orderStatus >= 1 },
{ label: '已派发', step: 2, active: currentDetail?.orderStatus >= 2 },
{ label: '执行中', step: 3, active: currentDetail?.orderStatus >= 2 },
{ label: '已完成', step: 4, active: currentDetail?.orderStatus >= 4 },
].map(item => (
<div key={item.step} style={{ textAlign: 'center', zIndex: 2, position: 'relative' }}>
<div style={{
width: 24, height: 24, borderRadius: '50%', background: item.active ? '#00B42A' : '#fff',
border: item.active ? 'none' : '2px solid #E5E6EB', color: item.active ? '#fff' : '#86909C',
display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 11, fontWeight: 700, margin: '0 auto'
}}>
{item.active ? <CheckOutlined /> : item.step}
</div>
<div style={{ fontSize: 11, marginTop: 8, color: item.active ? '#1D2129' : '#86909C', fontWeight: item.active ? 600 : 400 }}>{item.label}</div>
</div>
))}
</div>
</div>
<Row gutter={8}>
<Col span={6}><Button type="primary" block onClick={openDispatchModal}>派发工单</Button></Col>
<Col span={6}><Button icon={<ReloadOutlined />} block onClick={openEditModal}>转派</Button></Col>
<Col span={6}><Button icon={<PauseOutlined />} danger ghost block>挂起</Button></Col>
<Col span={6}><Button icon={<CheckOutlined />} style={{ background: '#52c41a', color: '#fff', border: 'none' }} block>完成工单</Button></Col>
<Row gutter={12}>
<Col span={6}><Button type="primary" block onClick={openDispatchModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>派发工单</Button></Col>
<Col span={6}><Button icon={<ReloadOutlined />} block onClick={openEditModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>转派</Button></Col>
<Col span={6}><Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>挂起</Button></Col>
<Col span={6}><Button icon={<CheckCircleOutlined />} style={{ background: '#00B42A', color: '#fff', border: 'none', borderRadius: 8, height: 36, fontWeight: 600 }} block>完成工单</Button></Col>
</Row>
</Card>
<Card
bordered={false}
title={<div style={{ display: 'flex', alignItems: 'center' }}><Text strong>AI 建议与关联信息</Text></div>}
style={{ borderRadius: 8, marginBottom: 16 }}
bodyStyle={{ padding: '12px' }}
title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>AI 建议与关联信息</Text>}
style={{ ...cardStyle, marginTop: 16 }}
bodyStyle={{ padding: '16px' }}
>
<Row gutter={8}>
<Row gutter={12} style={{ marginBottom: 16 }}>
<Col span={8}>
<div style={{ background: '#f9f0ff', padding: '12px 8px', borderRadius: 8, textAlign: 'center' }}>
<RobotOutlined style={{ fontSize: 20, color: '#722ed1', marginBottom: 8 }} />
<div style={{ fontSize: 12 }}>建议携带</div>
<div style={{ fontSize: 12, fontWeight: 'bold' }}>{currentDetail?.requiredEquipment || '无'}</div>
<div style={{ background: '#F9F0FF', padding: '16px 8px', borderRadius: 12, textAlign: 'center', height: '100%', border: '1px solid #F3E8FF' }}>
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(114,46,209,0.1)' }}>
<RobotOutlined style={{ fontSize: 18, color: '#722ED1' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>建议携带</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>红外热像设备</div>
</div>
</Col>
<Col span={8}>
<div style={{ background: '#f6ffed', padding: '12px 8px', borderRadius: 8, textAlign: 'center' }}>
<ThunderboltOutlined style={{ fontSize: 20, color: '#52c41a', marginBottom: 8 }} />
<div style={{ fontSize: 12 }}>AI建议方案</div>
<div style={{ fontSize: 10, fontWeight: 'bold' }}>{currentDetail?.aiSuggestion || '无'}</div>
<div style={{ background: '#E8FFEA', padding: '16px 8px', borderRadius: 12, textAlign: 'center', height: '100%', border: '1px solid #D1FFD6' }}>
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(0,180,42,0.1)' }}>
<ThunderboltOutlined style={{ fontSize: 18, color: '#00B42A' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>优先复检组件</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>B-12-03 / B-12-05</div>
</div>
</Col>
<Col span={8}>
<div style={{ background: '#fff7e6', padding: '12px 8px', borderRadius: 8, textAlign: 'center' }}>
<RiseOutlined style={{ fontSize: 20, color: '#faad14', marginBottom: 8 }} />
<div style={{ fontSize: 12 }}>预计发电影响</div>
<div style={{ fontSize: 12, fontWeight: 'bold' }}>{currentDetail?.estimatedImpact ?? 0}%</div>
<div style={{ background: '#FFF7E8', padding: '16px 8px', borderRadius: 12, textAlign: 'center', height: '100%', border: '1px solid #FFE4BA' }}>
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(247,186,30,0.1)' }}>
<RiseOutlined style={{ fontSize: 18, color: '#F7BA1E' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>预计影响发电</div>
<div style={{ fontSize: 13, fontWeight: 800, color: '#1D2129' }}>2.1%</div>
</div>
</Col>
</Row>
</Card>
<Row gutter={16}>
<Col span={12}>
<Card bordered={false} title="关联告警趋势 (近 7 天)" style={{ borderRadius: 8 }}>
<Row gutter={12}>
<Col span={13}>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129', marginBottom: 12 }}>关联告警趋势 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>(近 7 天)</Text></div>
<Line
data={alarmTrendData}
xField="date"
yField="value"
smooth
point={{ size: 4, shape: 'circle' }}
height={120}
padding="auto"
xAxis={{ label: { style: { fontSize: 10 } } }}
yAxis={{ label: { style: { fontSize: 10 } } }}
point={{ size: 3, shape: 'circle', style: { fill: '#165DFF', stroke: '#fff', lineWidth: 1 } }}
height={130}
color="#165DFF"
padding={[10, 10, 20, 20]}
xAxis={{ label: { style: { fontSize: 9, fill: '#86909C' } } }}
yAxis={{ label: { style: { fontSize: 9, fill: '#86909C' } }, grid: { line: { style: { stroke: '#f0f0f0', lineDash: [3, 3] } } } }}
/>
</Card>
</Col>
<Col span={12}>
<Card bordered={false} title="关联告警列表 (近 3 条)" extra={<Button type="link" size="small" style={{ fontSize: 12 }}>查看全部 <ChevronRight size={12} /></Button>} style={{ borderRadius: 8 }}>
<div style={{ fontSize: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Badge status="error" style={{ marginRight: 8 }} />
<Text ellipsis style={{ flex: 1 }}>INV-05 逆变器告警</Text>
<Text type="secondary" style={{ fontSize: 10 }}>05-24 10:24</Text>
</div>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Badge status="warning" style={{ marginRight: 8 }} />
<Text ellipsis style={{ flex: 1 }}>B-12 区块热斑告警</Text>
<Text type="secondary" style={{ fontSize: 10 }}>05-24 09:56</Text>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Badge status="warning" style={{ marginRight: 8 }} />
<Text ellipsis style={{ flex: 1 }}>B-12 组件温度异常</Text>
<Text type="secondary" style={{ fontSize: 10 }}>05-24 09:32</Text>
</div>
</Col>
<Col span={11}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>关联告警列表 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>(近 3 条)</Text></div>
<Button type="link" size="small" style={{ fontSize: 11, padding: 0 }}>查看全部</Button>
</div>
</Card>
</Col>
</Row>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
{[
{ title: 'INV-05 逆变器告警', time: '05-24 10:24', status: 'error' },
{ title: 'B-12 区块热斑告警', time: '05-24 09:56', status: 'warning' },
{ title: 'B-12 组件温度异常', time: '05-24 09:32', status: 'warning' },
].map((item, idx) => (
<div key={idx} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '6px 8px', background: '#f8fafc', borderRadius: 6 }}>
<div style={{ width: 6, height: 6, borderRadius: '50%', background: item.status === 'error' ? '#F53F3F' : '#F7BA1E' }}></div>
<Text ellipsis style={{ flex: 1, fontSize: 11, fontWeight: 500, color: '#4E5969' }}>{item.title}</Text>
<Text type="secondary" style={{ fontSize: 10, flexShrink: 0 }}>{item.time}</Text>
</div>
))}
</div>
</Col>
</Row>
</Card>
</Col>
</Row>