This commit is contained in:
mmc
2026-05-15 15:56:00 +08:00
parent bc48abc038
commit 864368edfd
3 changed files with 169 additions and 365 deletions

View File

@@ -77,6 +77,6 @@ export function suspendWorkOrder(id) {
export function deleteWorkOrder(ids) { export function deleteWorkOrder(ids) {
return request({ return request({
url: `/iot/ioTworkOrder/${ids}`, url: `/iot/ioTworkOrder/${ids}`,
method: 'post', method: 'delete',
}); });
} }

View File

@@ -1,27 +1,18 @@
import { Device, Alert, VideoRecord, User } from './types';
export const DEVICES: Device[] = [ export const orderTypeConfig = {
{ id: 'R001', name: '巡检机器人 A1', type: '巡检型', status: 'online', battery: 85, cpu: 12, temp: 32.08, lastUpdate: '2024-03-20 10:00:00' }, 1: '巡检',
{ id: 'R002', name: '安防辅助 B2', type: '安防型', status: 'alert', battery: 45, cpu: 45, temp: 42.5, lastUpdate: '2024-03-20 09:55:00' }, 2: '检修',
{ id: 'R003', name: '清洁终端 C1', type: '清洁型', status: 'offline', battery: 0, cpu: 0, temp: 20.0, lastUpdate: '2024-03-19 18:00:00' }, 3: '清洗',
{ id: 'R004', name: '运输搬运 D5', type: '运输型', status: 'online', battery: 92, cpu: 8, temp: 28.5, lastUpdate: '2024-03-20 10:05:00' }, 4: '维修',
]; 5: '运维'
};
export const ALERTS: Alert[] = [ export const sourceTypeMap = {
{ id: 'A001', deviceId: 'R002', deviceName: '安防辅助 B2', type: 'critical', message: '芯片温度过高', time: '2024-03-20 10:02:15', handled: false }, 1: 'AI',
{ id: 'A002', deviceId: 'R001', deviceName: '巡检机器人 A1', type: 'warning', message: '电池电量低于20%', time: '2024-03-20 09:30:00', handled: true }, 2: '无人机',
{ id: 'A003', deviceId: 'R004', deviceName: '运输搬运 D5', type: 'info', message: '任务顺利完成', time: '2024-03-20 08:00:00', handled: true }, 3: '清洗',
]; 4: '视频',
5: '装备',
export const VIDEOS: VideoRecord[] = [ 6: '人工',
{ id: 'V001', deviceId: 'R001', deviceName: '巡检机器人 A1', startTime: '2024-03-20 08:00', endTime: '2024-03-20 09:00', size: '450MB', url: '#' }, 7: '告警'
{ id: 'V002', deviceId: 'R001', deviceName: '巡检机器人 A1', startTime: '2024-03-20 09:00', endTime: '2024-03-20 10:00', size: '520MB', url: '#' }, };
{ id: 'V003', deviceId: 'R002', deviceName: '安防辅助 B2', startTime: '2024-03-20 07:30', endTime: '2024-03-20 08:30', size: '380MB', url: '#' },
];
export const MANAGED_USERS: User[] = [
{ id: 'user-1', name: 'James Wilson', role: 'admin', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=James' },
{ id: 'user-2', name: 'Sarah Chen', role: 'operator', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Sarah' },
{ id: 'user-3', name: 'Mike Ross', role: 'viewer', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Mike' },
{ id: 'user-4', name: 'Anna Lee', role: 'operator', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Anna' },
];

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
Layout, Card, Row, Col, Button, Table, Tag, Select, Input, Typography, Space, Layout, Card, Row, Col, Button, Table, Tag, Select, Input, Typography, Space,
Statistic, Modal, message, Empty, Drawer, Descriptions, Timeline, Divider, Form, Tabs, Progress, Badge, DatePicker, Pagination Statistic, Modal, message, Empty, Drawer, Descriptions, Timeline, Divider, Form, Tabs, Progress, Badge, DatePicker, Pagination, Popconfirm
} from 'antd'; } from 'antd';
import { import {
CheckOutlined, ClockCircleOutlined, ControlOutlined, CheckOutlined, ClockCircleOutlined, ControlOutlined,
@@ -28,9 +28,18 @@ import {
History, History,
ExternalLink ExternalLink
} from 'lucide-react'; } from 'lucide-react';
// 导入工单接口
import { getWorkOrderApi, getWorkOrderDetailApi, updateWorkOrder, dispatchWorkOrder, completeWorkOrder } from '../api/workOrder'; import {
getWorkOrderApi,
getWorkOrderDetailApi,
updateWorkOrder,
dispatchWorkOrder,
completeWorkOrder,
suspendWorkOrder,
deleteWorkOrder
} from '../api/workOrder';
import { UniversalLineChart } from '../components/recharts'; import { UniversalLineChart } from '../components/recharts';
import { orderTypeConfig, sourceTypeMap } from '../constants';
const { Option } = Select; const { Option } = Select;
const { Search } = Input; const { Search } = Input;
@@ -54,14 +63,7 @@ const orderStatusConfig = {
5: { label: '处理中', textColor: '#722ed1' } 5: { label: '处理中', textColor: '#722ed1' }
}; };
// 工单类型映射
const orderTypeConfig = {
1: '巡检',
2: '检修',
3: '清洗',
4: '维修',
5: '运维'
};
const WorkOrderPage = () => { const WorkOrderPage = () => {
const [activeTab, setActiveTab] = useState('1'); const [activeTab, setActiveTab] = useState('1');
@@ -80,8 +82,7 @@ const WorkOrderPage = () => {
const [completeForm] = Form.useForm(); // 完成工单表单 const [completeForm] = Form.useForm(); // 完成工单表单
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
// 统计数据
// 统计数据(保留原模拟不变)
const stats = [ const stats = [
{ title: '今日新增工单', value: 18, subValue: '+3', subText: '较昨日', icon: <ClipboardList size={24} color="#1890ff" />, bg: '#e6f7ff' }, { title: '今日新增工单', value: 18, subValue: '+3', subText: '较昨日', icon: <ClipboardList size={24} color="#1890ff" />, bg: '#e6f7ff' },
{ title: '待处理工单', value: 12, subValue: '5', subText: '高优先级', icon: <Clock size={24} color="#ff4d4f" />, bg: '#fff1f0' }, { title: '待处理工单', value: 12, subValue: '5', subText: '高优先级', icon: <Clock size={24} color="#ff4d4f" />, bg: '#fff1f0' },
@@ -91,7 +92,7 @@ const WorkOrderPage = () => {
{ title: 'AI建议生成', value: 7, unit: '单', subValue: '', subText: '今日自动生成', icon: <Cpu size={24} color="#722ed1" />, bg: '#f9f0ff' }, { title: 'AI建议生成', value: 7, unit: '单', subValue: '', subText: '今日自动生成', icon: <Cpu size={24} color="#722ed1" />, bg: '#f9f0ff' },
]; ];
// 图表模拟数据保留不变 // 图表模拟数据
const pieData = [ const pieData = [
{ type: '待处理', value: 12 }, { type: '待处理', value: 12 },
{ type: '执行中', value: 9 }, { type: '执行中', value: 9 },
@@ -145,17 +146,14 @@ const WorkOrderPage = () => {
// 提交完成工单 // 提交完成工单
const submitComplete = async (values) => { const submitComplete = async (values) => {
try { try {
// 构造后端需要的参数(只需要传 id + 处理信息)
const params = { const params = {
id: values.id, id: values.id,
handleResult: values.handleResult, handleResult: values.handleResult,
handleRemark: values.handleRemark, handleRemark: values.handleRemark,
}; };
await completeWorkOrder(params); await completeWorkOrder(params);
messageApi.success('工单已完成'); messageApi.success('工单已完成');
setCompleteModalVisible(false); setCompleteModalVisible(false);
// 刷新列表 + 详情
getWorkOrderList(); getWorkOrderList();
getWorkOrderDetail(selectedRowKey); getWorkOrderDetail(selectedRowKey);
} catch (err) { } catch (err) {
@@ -196,12 +194,11 @@ const WorkOrderPage = () => {
setEditModalVisible(true); setEditModalVisible(true);
}; };
// 打开派发工单弹窗
// 打开派发工单弹窗 // 打开派发工单弹窗
const openDispatchModal = () => { const openDispatchModal = () => {
if (!selectedRowKey) return messageApi.warning('请先选择一条工单'); if (!selectedRowKey) return messageApi.warning('请先选择一条工单');
form.setFieldsValue({ form.setFieldsValue({
orderId: selectedRowKey, // 自动回填工单ID orderId: selectedRowKey,
assigneeName: currentDetail?.assigneeName || '', assigneeName: currentDetail?.assigneeName || '',
planStartTime: currentDetail?.planStartTime ? dayjs(currentDetail.planStartTime) : null, planStartTime: currentDetail?.planStartTime ? dayjs(currentDetail.planStartTime) : null,
planEndTime: currentDetail?.planEndTime ? dayjs(currentDetail.planEndTime) : null, planEndTime: currentDetail?.planEndTime ? dayjs(currentDetail.planEndTime) : null,
@@ -211,19 +208,17 @@ const WorkOrderPage = () => {
}; };
// 提交修改工单 // 提交修改工单
// 提交修改工单(完整匹配后端参数)
const submitEdit = async (values) => { const submitEdit = async (values) => {
try { try {
// 拼接你给的所有工单参数(1:1 匹配)
const params = { const params = {
id: selectedRowKey, // 主键ID id: selectedRowKey,
orderNo: currentDetail?.orderNo, // 工单编号 orderNo: currentDetail?.orderNo,
orderTitle: values.orderTitle, // 工单标题 orderTitle: values.orderTitle,
sourceType: currentDetail?.sourceType, // 来源(保持不变) sourceType: currentDetail?.sourceType,
orderType: values.orderType, // 类型 orderType: values.orderType,
priorityLevel: values.priorityLevel, // 优先级 priorityLevel: values.priorityLevel,
deviceId: currentDetail?.deviceId, // 设备ID deviceId: currentDetail?.deviceId,
deviceName: currentDetail?.deviceName, // 设备名称 deviceName: currentDetail?.deviceName,
deviceType: currentDetail?.deviceType, deviceType: currentDetail?.deviceType,
siteId: currentDetail?.siteId, siteId: currentDetail?.siteId,
siteName: currentDetail?.siteName, siteName: currentDetail?.siteName,
@@ -240,20 +235,16 @@ const WorkOrderPage = () => {
orderStatus: currentDetail?.orderStatus, orderStatus: currentDetail?.orderStatus,
alarmId: currentDetail?.alarmId, alarmId: currentDetail?.alarmId,
alarmNo: currentDetail?.alarmNo, alarmNo: currentDetail?.alarmNo,
taskDescription: values.taskDescription, // 任务描述 taskDescription: values.taskDescription,
aiSuggestion: currentDetail?.aiSuggestion, aiSuggestion: currentDetail?.aiSuggestion,
requiredEquipment: currentDetail?.requiredEquipment, requiredEquipment: currentDetail?.requiredEquipment,
estimatedImpact: currentDetail?.estimatedImpact, estimatedImpact: currentDetail?.estimatedImpact,
handleResult: currentDetail?.handleResult, handleResult: currentDetail?.handleResult,
handleRemark: currentDetail?.handleRemark, handleRemark: currentDetail?.handleRemark,
}; };
// 调用你提供的接口
await updateWorkOrder(params); await updateWorkOrder(params);
messageApi.success('修改工单成功'); messageApi.success('修改工单成功');
setEditModalVisible(false); setEditModalVisible(false);
// 刷新列表和详情
getWorkOrderList(); getWorkOrderList();
getWorkOrderDetail(selectedRowKey); getWorkOrderDetail(selectedRowKey);
} catch (error) { } catch (error) {
@@ -262,14 +253,12 @@ const WorkOrderPage = () => {
} }
}; };
// 提交派发工单
// 提交派发工单 // 提交派发工单
const submitDispatch = async (values) => { const submitDispatch = async (values) => {
try { try {
// 拼接接口需要的参数(完全按你给的格式)
const params = { const params = {
orderId: values.orderId, orderId: values.orderId,
assigneeId: values.assigneeName === '王工' ? 1003 : '', // 你可以自己映射ID assigneeId: values.assigneeId ?? '',
assigneeName: values.assigneeName, assigneeName: values.assigneeName,
collaboratorIds: '', collaboratorIds: '',
collaboratorNames: values.collaboratorNames?.join(',') || '', collaboratorNames: values.collaboratorNames?.join(',') || '',
@@ -277,18 +266,40 @@ const WorkOrderPage = () => {
planEndTime: values.planEndTime ? values.planEndTime.format('YYYY-MM-DDTHH:mm:ss') : '', planEndTime: values.planEndTime ? values.planEndTime.format('YYYY-MM-DDTHH:mm:ss') : '',
deadlineTime: values.deadlineTime ? values.deadlineTime.format('YYYY-MM-DDTHH:mm:ss') : '', deadlineTime: values.deadlineTime ? values.deadlineTime.format('YYYY-MM-DDTHH:mm:ss') : '',
}; };
await dispatchWorkOrder(params); await dispatchWorkOrder(params);
messageApi.success('工单派发成功'); messageApi.success('工单派发成功');
setDispatchModalVisible(false); setDispatchModalVisible(false);
getWorkOrderList(); // 刷新列表 getWorkOrderList();
} catch (error) { } catch (error) {
messageApi.error('工单派发失败'); messageApi.error('工单派发失败');
console.error(error); console.error(error);
} }
}; };
// 挂起工单
const handleSuspend = async () => {
if (!selectedRowKey) return messageApi.warning('请选择工单');
try {
await suspendWorkOrder(selectedRowKey);
messageApi.success('工单已挂起');
getWorkOrderList();
} catch (e) {
messageApi.error('挂起失败');
}
};
// 删除工单
const handleDelete = async () => {
if (!selectedRowKey) return messageApi.warning('请选择工单');
try {
await deleteWorkOrder(selectedRowKey);
messageApi.success('删除成功');
getWorkOrderList();
} catch (e) {
messageApi.error('删除失败');
}
};
useEffect(() => { useEffect(() => {
getWorkOrderList(); getWorkOrderList();
}, []); }, []);
@@ -300,11 +311,20 @@ const WorkOrderPage = () => {
overflow: 'hidden' overflow: 'hidden'
}; };
// 表格列【已适配后端真实字段】 // 表格列【已完善】
const columns = [ const columns = [
{ title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 130 }, { title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 150 },
{ title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 180, ellipsis: true }, { title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 200, ellipsis: true },
{ title: '来源', dataIndex: 'sourceType', key: 'sourceType', width: 100 }, {
title: '来源',
dataIndex: 'sourceType',
key: 'sourceType',
width: 90,
render: (t) => {
const map = { 1: 'AI', 2: '无人机', 3: '清洗', 4: '视频', 5: '装备', 6: '人工', 7: '告警' };
return map[t] || t;
}
},
{ {
title: '类型', title: '类型',
dataIndex: 'orderType', dataIndex: 'orderType',
@@ -318,26 +338,20 @@ const WorkOrderPage = () => {
key: 'priorityLevel', key: 'priorityLevel',
width: 80, width: 80,
render: (p) => ( render: (p) => (
<Tag <Tag style={{ color: priorityConfig[p]?.color, background: priorityConfig[p]?.bg, border: `1px solid ${priorityConfig[p]?.color}`, borderRadius: 4 }}>
style={{
color: priorityConfig[p]?.color,
background: priorityConfig[p]?.bg,
border: `1px solid ${priorityConfig[p]?.color}`,
borderRadius: 4,
margin: 0
}}
>
{priorityConfig[p]?.label} {priorityConfig[p]?.label}
</Tag> </Tag>
) )
}, },
{ title: '负责人', dataIndex: 'assigneeName', key: 'assigneeName', width: 80 }, { title: '负责人', dataIndex: 'assigneeName', key: 'assigneeName', width: 90 },
{ title: '截止时间', dataIndex: 'deadlineTime', key: 'deadlineTime', width: 150 }, { title: '设备名称', dataIndex: 'deviceName', key: 'deviceName', width: 160, ellipsis: true },
{ title: '站点', dataIndex: 'siteName', key: 'siteName', width: 130 },
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 160 },
{ {
title: '状态', title: '状态',
dataIndex: 'orderStatus', dataIndex: 'orderStatus',
key: 'orderStatus', key: 'orderStatus',
width: 90, width: 100,
render: (s) => ( render: (s) => (
<Space size={6}> <Space size={6}>
<div style={{ width: 6, height: 6, borderRadius: '50%', background: orderStatusConfig[s]?.textColor }}></div> <div style={{ width: 6, height: 6, borderRadius: '50%', background: orderStatusConfig[s]?.textColor }}></div>
@@ -348,19 +362,14 @@ const WorkOrderPage = () => {
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 60, width: 180,
fixed: "right", fixed: "right",
render: (_, record) => ( render: (_, record) => (
<Button <Space size={4}>
type="link" <Button type="link" size="small" onClick={() => { setSelectedRowKey(record.id); getWorkOrderDetail(record.id); }}>查看</Button>
size="small" <Button type="link" size="small" onClick={() => { setSelectedRowKey(record.id); getWorkOrderDetail(record.id); openEditModal(); }}>修改</Button>
onClick={() => { <Popconfirm title="确定删除?" onConfirm={handleDelete}><Button type="link" size="small" danger>删除</Button></Popconfirm>
setSelectedRowKey(record.id); </Space>
getWorkOrderDetail(record.id);
}}
>
查看
</Button>
) )
}, },
]; ];
@@ -368,50 +377,21 @@ const WorkOrderPage = () => {
return ( return (
<div style={{ padding: '0px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}> <div style={{ padding: '0px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
{contextHolder} {contextHolder}
<style> <style>{`
{` .compact-table .ant-table-thead > tr > th { background: #f8fafc; padding: 2px 4px !important; font-size: 12px; color: #4E5969; }
.compact-table .ant-table-thead > tr > th { .compact-table .ant-table-tbody > tr > td { padding: 2px 4px !important; font-size: 12px; }
background: #f8fafc; .filter-label { font-size: 12px; color: #4E5969; white-space: nowrap; margin-right: 8px; }
padding: 2px 4px !important; .schedule-item { transition: all 0.3s; cursor: pointer; }
font-size: 12px; .schedule-item:hover { filter: brightness(0.95); transform: translateY(-1px); }
color: #4E5969; `}</style>
}
.compact-table .ant-table-tbody > tr > td {
padding: 2px 4px !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: 8 }}> <div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Title level={4} style={{ margin: '0 32px 0 0', }}>工单任务管理</Title> <Title level={4} style={{ margin: '0 32px 0 0' }}>工单任务管理</Title>
<Tabs <Tabs activeKey={activeTab} onChange={setActiveTab} items={[
activeKey={activeTab} { key: '1', label: '工单总览' }, { key: '2', label: '待处理工单' }, { key: '3', label: '执行中' },
onChange={setActiveTab} { key: '4', label: '已完成' }, { key: '5', label: '工单模板' },
items={[ ]} tabBarStyle={{ marginBottom: 0 }} />
{ key: '1', label: '工单总览' },
{ key: '2', label: '待处理工单' },
{ key: '3', label: '执行中' },
{ key: '4', label: '已完成' },
{ key: '5', label: '工单模板' },
]}
tabBarStyle={{ marginBottom: 0 }}
/>
</div> </div>
{/* 统计卡片 */} {/* 统计卡片 */}
@@ -428,20 +408,12 @@ const WorkOrderPage = () => {
</div> </div>
<div style={{ fontSize: 11, color: '#86909C' }}> <div style={{ fontSize: 11, color: '#86909C' }}>
{item.subText} {item.subText}
<span style={{ <span style={{ marginLeft: 4, fontWeight: 700, color: item.subValue.includes('+') ? '#00B42A' : (item.subValue.includes('-') ? '#F53F3F' : '#165DFF') }}>
marginLeft: 4,
fontWeight: 700,
color: item.subValue.includes('+') ? '#00B42A' : (item.subValue.includes('-') ? '#F53F3F' : '#165DFF')
}}>
{item.subValue} {item.subValue}
</span> </span>
</div> </div>
</div> </div>
<div style={{ <div style={{ width: 52, height: 52, borderRadius: 14, background: item.bg, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: `0 4px 10px ${item.bg}80` }}>
width: 52, height: 52, borderRadius: 14, background: item.bg,
display: 'flex', alignItems: 'center', justifyContent: 'center',
boxShadow: `0 4px 10px ${item.bg}80`
}}>
{item.icon} {item.icon}
</div> </div>
</div> </div>
@@ -453,55 +425,32 @@ const WorkOrderPage = () => {
{/* 筛选栏 */} {/* 筛选栏 */}
<Card bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ ...cardStyle, marginBottom: 8 }}> <Card bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ ...cardStyle, marginBottom: 8 }}>
<Row gutter={[16, 12]} align="middle"> <Row gutter={[16, 12]} align="middle">
<Col xs={12} sm={8} md={4} xl={3}> <Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <span className="filter-label">工单类型</span>
<span className="filter-label">工单类型</span> <Select defaultValue="all" style={{ width: '100%' }} size="small"><Option value="all">全部</Option></Select>
<Select defaultValue="all" style={{ width: '100%' }} size="small"> </div></Col>
<Option value="all">全部</Option> <Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
</Select> <span className="filter-label">优先级</span>
</div> <Select defaultValue="all" style={{ width: '100%' }} size="small"><Option value="all">全部</Option></Select>
</Col> </div></Col>
<Col xs={12} sm={8} md={4} xl={3}> <Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <span className="filter-label">负责人</span>
<span className="filter-label">优先级</span> <Select defaultValue="all" style={{ width: '100%' }} size="small"><Option value="all">全部</Option></Select>
<Select defaultValue="all" style={{ width: '100%' }} size="small"> </div></Col>
<Option value="all">全部</Option> <Col xs={24} sm={16} md={8} xl={5}><div style={{ display: 'flex', alignItems: 'center' }}>
</Select> <span className="filter-label">时间范围</span>
</div> <RangePicker style={{ width: '100%' }} size="small" />
</Col> </div></Col>
<Col xs={12} sm={8} md={4} xl={3}> <Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <span className="filter-label">状态</span>
<span className="filter-label">负责人</span> <Select defaultValue="all" style={{ width: '100%' }} size="small"><Option value="all">全部</Option></Select>
<Select defaultValue="all" style={{ width: '100%' }} size="small"> </div></Col>
<Option value="all">全部</Option> <Col xs={24} sm={16} md={10} xl={4}><div style={{ display: 'flex', alignItems: 'center' }}>
</Select> <span className="filter-label">关键词</span>
</div> <Input placeholder="请输入工单编号/标题" prefix={<SearchOutlined />} size="small" />
</Col> </div></Col>
<Col xs={24} sm={16} md={8} xl={5}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">时间范围</span>
<RangePicker style={{ width: '100%' }} size="small" />
</div>
</Col>
<Col xs={12} sm={8} md={4} xl={3}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">状态</span>
<Select defaultValue="all" style={{ width: '100%' }} size="small">
<Option value="all">全部</Option>
</Select>
</div>
</Col>
<Col xs={24} sm={16} md={10} xl={4}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">关键词</span>
<Input placeholder="请输入工单编号/标题" prefix={<SearchOutlined />} size="small" />
</div>
</Col>
<Col xs={24} sm={8} md={4} xl={3} style={{ textAlign: 'right' }}> <Col xs={24} sm={8} md={4} xl={3} style={{ textAlign: 'right' }}>
<Space> <Space><Button size="small">重置</Button><Button type="primary" size="small" icon={<SearchOutlined />}>查询</Button></Space>
<Button size="small">重置</Button>
<Button type="primary" size="small" icon={<SearchOutlined />}>查询</Button>
</Space>
</Col> </Col>
</Row> </Row>
</Card> </Card>
@@ -509,12 +458,8 @@ const WorkOrderPage = () => {
<Row gutter={[8, 8]}> <Row gutter={[8, 8]}>
{/* 左侧:列表 + 底部图表 */} {/* 左侧:列表 + 底部图表 */}
<Col xs={24} xl={15}> <Col xs={24} xl={15}>
<Card <Card bordered={false} title={<Space size={8}><Text strong style={{ fontSize: 15, color: '#1D2129' }}>工单列表</Text><Text type="secondary" style={{ fontSize: 12 }}>(共 {workOrderTotal} 条)</Text></Space>}
bordered={false} bodyStyle={{ padding: 0 }} style={{ ...cardStyle, marginBottom: 8 }}>
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={{ ...cardStyle, marginBottom: 8 }}
>
<Table <Table
dataSource={workOrderList} dataSource={workOrderList}
columns={columns} columns={columns}
@@ -524,11 +469,7 @@ const WorkOrderPage = () => {
rowKey="id" rowKey="id"
className="compact-table" className="compact-table"
scroll={{ x: 'max-content' }} scroll={{ x: 'max-content' }}
rowSelection={{ rowSelection={{ type: 'radio', selectedRowKeys: [selectedRowKey], onChange: handleRowSelect }}
type: 'radio',
selectedRowKeys: [selectedRowKey],
onChange: handleRowSelect
}}
/> />
<div style={{ padding: '12px 16px', textAlign: 'right' }}> <div style={{ padding: '12px 16px', textAlign: 'right' }}>
<Pagination size="small" total={workOrderTotal} showSizeChanger showQuickJumper /> <Pagination size="small" total={workOrderTotal} showSizeChanger showQuickJumper />
@@ -539,27 +480,9 @@ const WorkOrderPage = () => {
<Col xs={24} md={9}> <Col xs={24} md={9}>
<Card bordered={false} title={<Text strong style={{ fontSize: 14 }}>工单状态分布</Text>} style={{ ...cardStyle, height: 380 }}> <Card bordered={false} title={<Text strong style={{ fontSize: 14 }}>工单状态分布</Text>} style={{ ...cardStyle, height: 380 }}>
<div style={{ height: 300, position: 'relative' }}> <div style={{ height: 300, position: 'relative' }}>
<Pie <Pie data={pieData} angleField="value" colorField="type" radius={1} innerRadius={0.65} label={false}
data={pieData}
angleField="value"
colorField="type"
radius={1}
innerRadius={0.65}
label={false}
color={['#1890ff', '#165DFF', '#00B42A', '#F53F3F']} color={['#1890ff', '#165DFF', '#00B42A', '#F53F3F']}
legend={{ legend={{ position: 'right', layout: 'vertical' }} height={260} />
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(1);
return `${item.value} (${percent}%)`;
}
}
}}
height={260}
/>
<div style={{ position: 'absolute', top: '42%', left: '30%', textAlign: 'center', transform: 'translate(-50%, -50%)' }}> <div style={{ position: 'absolute', top: '42%', left: '30%', textAlign: 'center', transform: 'translate(-50%, -50%)' }}>
<div style={{ fontSize: 12, color: '#86909C' }}>总数</div> <div style={{ fontSize: 12, color: '#86909C' }}>总数</div>
<div style={{ fontSize: 28, fontWeight: 800, color: '#1D2129' }}>{workOrderTotal}</div> <div style={{ fontSize: 28, fontWeight: 800, color: '#1D2129' }}>{workOrderTotal}</div>
@@ -568,13 +491,9 @@ const WorkOrderPage = () => {
</Card> </Card>
</Col> </Col>
<Col xs={24} md={15}> <Col xs={24} md={15}>
<Card <Card bordered={false} title={<Text strong style={{ fontSize: 14 }}>任务排班 / 日历视图</Text>}
bordered={false}
title={<Text strong style={{ fontSize: 14 }}>任务排班 / 日历视图</Text>}
extra={<Button type="link" size="small">更多 <ChevronRight size={14} /></Button>} extra={<Button type="link" size="small">更多 <ChevronRight size={14} /></Button>}
style={{ ...cardStyle, height: 380 }} style={{ ...cardStyle, height: 380 }} bodyStyle={{ padding: '16px' }}>
bodyStyle={{ padding: '16px' }}
>
<div style={{ marginBottom: 16 }}> <div style={{ marginBottom: 16 }}>
<Space> <Space>
<Button size="small" icon={<ChevronRight style={{ transform: 'rotate(180deg)' }} size={14} />} /> <Button size="small" icon={<ChevronRight style={{ transform: 'rotate(180deg)' }} size={14} />} />
@@ -611,11 +530,7 @@ const WorkOrderPage = () => {
{/* 右侧:详情 + AI + 告警 */} {/* 右侧:详情 + AI + 告警 */}
<Col xs={24} xl={9}> <Col xs={24} xl={9}>
<Card <Card bordered={false} style={cardStyle} bodyStyle={{ padding: '20px' }}>
bordered={false}
style={cardStyle}
bodyStyle={{ padding: '20px' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 }}> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 }}>
<Text strong style={{ fontSize: 16, color: '#1D2129' }}>工单详情</Text> <Text strong style={{ fontSize: 16, color: '#1D2129' }}>工单详情</Text>
<Text type="secondary" style={{ fontSize: 12 }}>工单编号: <span style={{ color: '#4E5969', fontWeight: 600 }}>{currentDetail?.orderNo || '--'}</span></Text> <Text type="secondary" style={{ fontSize: 12 }}>工单编号: <span style={{ color: '#4E5969', fontWeight: 600 }}>{currentDetail?.orderNo || '--'}</span></Text>
@@ -625,23 +540,14 @@ const WorkOrderPage = () => {
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}>
<span level={4} style={{ margin: 0, fontSize: 18, fontWeight: 800 }}>{currentDetail?.orderTitle || '暂无标题'}</span> <span level={4} style={{ margin: 0, fontSize: 18, fontWeight: 800 }}>{currentDetail?.orderTitle || '暂无标题'}</span>
{currentDetail?.priorityLevel && ( {currentDetail?.priorityLevel && (
<Tag <Tag style={{ color: priorityConfig[currentDetail.priorityLevel]?.color, background: priorityConfig[currentDetail.priorityLevel]?.bg, border: `1px solid ${priorityConfig[currentDetail.priorityLevel]?.color}`, borderRadius: 4, fontWeight: 600 }}>
style={{
color: priorityConfig[currentDetail.priorityLevel]?.color,
background: priorityConfig[currentDetail.priorityLevel]?.bg,
border: `1px solid ${priorityConfig[currentDetail.priorityLevel]?.color}`,
borderRadius: 4,
fontWeight: 600,
margin: 0
}}
>
{priorityConfig[currentDetail.priorityLevel].label}优先级 {priorityConfig[currentDetail.priorityLevel].label}优先级
</Tag> </Tag>
)} )}
</div> </div>
<Row gutter={[16, 16]} style={{ background: '#f8fafc', padding: 16, borderRadius: 12, marginBottom: 20 }}> <Row gutter={[16, 16]} style={{ background: '#f8fafc', padding: 16, borderRadius: 12, marginBottom: 20 }}>
<Col span={12}><span style={{ fontSize: 12 }}>来源:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.sourceType || '--'}</span></Col> <Col span={12}><span style={{ fontSize: 12 }}>来源:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{sourceTypeMap[currentDetail?.sourceType] || '--'}</span></Col>
<Col span={12}><span style={{ fontSize: 12 }}>工单类型:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{orderTypeConfig[currentDetail?.orderType] || '--'}</span></Col> <Col span={12}><span style={{ fontSize: 12 }}>工单类型:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{orderTypeConfig[currentDetail?.orderType] || '--'}</span></Col>
<Col span={12}><span style={{ fontSize: 12 }}>负责人:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.assigneeName || '--'}</span></Col> <Col span={12}><span style={{ fontSize: 12 }}>负责人:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.assigneeName || '--'}</span></Col>
<Col span={12}><span style={{ fontSize: 12 }}>协同人员:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.collaboratorNames || '无'}</span></Col> <Col span={12}><span style={{ fontSize: 12 }}>协同人员:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.collaboratorNames || '无'}</span></Col>
@@ -661,11 +567,9 @@ const WorkOrderPage = () => {
<div style={{ marginBottom: 32 }}> <div style={{ marginBottom: 32 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 10px', position: 'relative' }}> <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={{ 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 style={{ width: currentDetail?.orderStatus >= 3 ? '100%' : (currentDetail?.orderStatus === 2 ? '66%' : '33%'), height: '100%', background: '#00B42A' }}></div>
</div> </div>
{[ {[
{ label: '已创建', step: 1, active: currentDetail?.orderStatus >= 1 }, { label: '已创建', step: 1, active: currentDetail?.orderStatus >= 1 },
{ label: '已派发', step: 2, active: currentDetail?.orderStatus >= 2 }, { label: '已派发', step: 2, active: currentDetail?.orderStatus >= 2 },
@@ -688,25 +592,19 @@ const WorkOrderPage = () => {
<Row gutter={12}> <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 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={<EditOutlined />} 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}><Popconfirm title="确定挂起?" onConfirm={handleSuspend}><Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>挂起</Button></Popconfirm></Col>
<Col span={6}><Button <Col span={6}><Button
icon={<CheckCircleOutlined />} icon={<CheckCircleOutlined />}
style={{ background: '#00B42A', color: '#fff', border: 'none', borderRadius: 8, height: 36, fontWeight: 600 }} style={{ background: '#00B42A', color: '#fff', border: 'none', borderRadius: 8, height: 36, fontWeight: 600 }}
block block
onClick={openCompleteModal} onClick={openCompleteModal}
> >完成</Button></Col>
完成工单
</Button></Col>
</Row> </Row>
</Card> </Card>
<Card <Card bordered={false} title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>AI 建议与关联信息</Text>}
bordered={false} style={{ ...cardStyle, marginTop: 16 }} bodyStyle={{ padding: '16px' }}>
title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>AI 建议与关联信息</Text>}
style={{ ...cardStyle, marginTop: 16 }}
bodyStyle={{ padding: '16px' }}
>
<Row gutter={12} style={{ marginBottom: 16 }}> <Row gutter={12} style={{ marginBottom: 16 }}>
<Col span={8}> <Col span={8}>
<div style={{ background: '#F9F0FF', padding: '16px 8px', borderRadius: 12, textAlign: 'center', height: '100%', border: '1px solid #F3E8FF' }}> <div style={{ background: '#F9F0FF', padding: '16px 8px', borderRadius: 12, textAlign: 'center', height: '100%', border: '1px solid #F3E8FF' }}>
@@ -750,14 +648,7 @@ const WorkOrderPage = () => {
showGrid={true} showGrid={true}
smooth smooth
dot dot
series={[ series={[{ key: 'value', name: '告警数量', color: '#165DFF', strokeWidth: 2 }]}
{
key: 'value',
name: '告警数量',
color: '#165DFF',
strokeWidth: 2,
},
]}
/> />
</Col> </Col>
<Col span={11}> <Col span={11}>
@@ -784,98 +675,45 @@ const WorkOrderPage = () => {
</Col> </Col>
</Row> </Row>
{/* 修改工单弹窗 */}
{/* 修改工单弹窗 */} {/* 修改工单弹窗 */}
<Modal title="修改工单" open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}> <Modal title="修改工单" open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
<Form form={form} layout="vertical" onFinish={submitEdit}> <Form form={form} layout="vertical" onFinish={submitEdit}>
<FormItem <FormItem name="orderTitle" label="工单标题" rules={[{ required: true, message: '请输入工单标题' }]}>
name="orderTitle"
label="工单标题"
rules={[{ required: true, message: '请输入工单标题' }]}
>
<Input placeholder="请输入工单标题" /> <Input placeholder="请输入工单标题" />
</FormItem> </FormItem>
<FormItem name="orderType" label="工单类型" rules={[{ required: true, message: '请选择工单类型' }]}>
<FormItem
name="orderType"
label="工单类型"
rules={[{ required: true, message: '请选择工单类型' }]}
>
<Select placeholder="请选择工单类型"> <Select placeholder="请选择工单类型">
<Option value={1}>巡检</Option> <Option value={1}>巡检</Option><Option value={2}>检修</Option><Option value={3}>清洗</Option><Option value={4}>维修</Option><Option value={5}>运维</Option>
<Option value={2}>检修</Option>
<Option value={3}>清洗</Option>
<Option value={4}>维修</Option>
<Option value={5}>运维</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem name="priorityLevel" label="优先级" rules={[{ required: true, message: '请选择优先级' }]}>
<FormItem
name="priorityLevel"
label="优先级"
rules={[{ required: true, message: '请选择优先级' }]}
>
<Select placeholder="请选择优先级"> <Select placeholder="请选择优先级">
<Option value={1}>高</Option> <Option value={1}>高</Option><Option value={2}>中</Option><Option value={3}>低</Option>
<Option value={2}>中</Option>
<Option value={3}>低</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem name="taskDescription" label="任务描述" rules={[{ required: true, message: '请输入任务描述' }]}>
<FormItem
name="taskDescription"
label="任务描述"
rules={[{ required: true, message: '请输入任务描述' }]}
>
<Input.TextArea rows={4} placeholder="请输入任务描述" /> <Input.TextArea rows={4} placeholder="请输入任务描述" />
</FormItem> </FormItem>
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}> <FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setEditModalVisible(false)}>取消</Button> <Button onClick={() => setEditModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}> <Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认修改</Button>
确认修改
</Button>
</FormItem> </FormItem>
</Form> </Form>
</Modal> </Modal>
{/* 派发工单弹窗 */} {/* 派发工单弹窗 */}
<Modal title="派发工单" open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}> <Modal title="派发工单" open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
<Form form={form} layout="vertical" onFinish={submitDispatch}> <Form form={form} layout="vertical" onFinish={submitDispatch}>
<FormItem name="orderId" label="工单ID" hidden> <FormItem name="orderId" label="工单ID" hidden><Input /></FormItem>
<Input /> <FormItem name="assigneeName" label="负责人" rules={[{ required: true, message: '请选择负责人' }]}>
</FormItem>
<FormItem
name="assigneeName"
label="负责人"
rules={[{ required: true, message: '请选择负责人' }]}
>
<Select placeholder="请选择负责人"> <Select placeholder="请选择负责人">
<Option value="王工">王工</Option> <Option value="王工">王工</Option><Option value="李工">李工</Option><Option value="张工">张工</Option><Option value="陈工">陈工</Option>
<Option value="李工">李工</Option>
<Option value="张工">张工</Option>
<Option value="陈工">陈工</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem name="collaboratorNames" label="协同人员"><Select mode="tags" placeholder="可输入多个,回车确认" /></FormItem>
<FormItem name="collaboratorNames" label="协同人员"> <FormItem name="planStartTime" label="计划开始时间"><DatePicker showTime style={{ width: '100%' }} /></FormItem>
<Select mode="tags" placeholder="可输入多个,回车确认" /> <FormItem name="planEndTime" label="计划结束时间"><DatePicker showTime style={{ width: '100%' }} /></FormItem>
</FormItem> <FormItem name="deadlineTime" label="截止时间"><DatePicker showTime style={{ width: '100%' }} /></FormItem>
<FormItem name="planStartTime" label="计划开始时间">
<DatePicker showTime style={{ width: '100%' }} />
</FormItem>
<FormItem name="planEndTime" label="计划结束时间">
<DatePicker showTime style={{ width: '100%' }} />
</FormItem>
<FormItem name="deadlineTime" label="截止时间">
<DatePicker showTime style={{ width: '100%' }} />
</FormItem>
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}> <FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setDispatchModalVisible(false)}>取消</Button> <Button onClick={() => setDispatchModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认派发</Button> <Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认派发</Button>
@@ -884,44 +722,19 @@ const WorkOrderPage = () => {
</Modal> </Modal>
{/* 完成工单弹窗 */} {/* 完成工单弹窗 */}
<Modal <Modal title="完成工单" open={completeModalVisible} onCancel={() => setCompleteModalVisible(false)} footer={null} width={500}>
title="完成工单"
open={completeModalVisible}
onCancel={() => setCompleteModalVisible(false)}
footer={null}
width={500}
>
<Form form={completeForm} layout="vertical" onFinish={submitComplete}> <Form form={completeForm} layout="vertical" onFinish={submitComplete}>
<Form.Item name="id" hidden> <Form.Item name="id" hidden><Input /></Form.Item>
<Input /> <Form.Item name="orderNo" label="工单编号"><Input disabled /></Form.Item>
</Form.Item> <Form.Item name="handleResult" label="处理结果" rules={[{ required: true, message: '请输入处理结果' }]}>
<Form.Item name="orderNo" label="工单编号">
<Input disabled />
</Form.Item>
<Form.Item
name="handleResult"
label="处理结果"
rules={[{ required: true, message: '请输入处理结果' }]}
>
<Select placeholder="请选择处理结果"> <Select placeholder="请选择处理结果">
<Option value="已处理完成">已处理完成</Option> <Option value="已处理完成">已处理完成</Option><Option value="已修复">已修复</Option><Option value="无需处理">无需处理</Option><Option value="问题已闭环">问题已闭环</Option>
<Option value="已修复">已修复</Option>
<Option value="无需处理">无需处理</Option>
<Option value="问题已闭环">问题已闭环</Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item name="handleRemark" label="处理备注"><Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" /></Form.Item>
<Form.Item name="handleRemark" label="处理备注">
<Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" />
</Form.Item>
<Form.Item style={{ textAlign: 'right', marginBottom: 0 }}> <Form.Item style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setCompleteModalVisible(false)}>取消</Button> <Button onClick={() => setCompleteModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}> <Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认完成</Button>
确认完成
</Button>
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>