样式和工单列表接口
This commit is contained in:
@@ -61,3 +61,22 @@ export function completeWorkOrder(data) {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
//挂起
|
||||
|
||||
|
||||
export function suspendWorkOrder(id) {
|
||||
return request({
|
||||
url: `/iot/ioTworkOrder/suspend/${id}`,
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
//删除工单
|
||||
|
||||
export function deleteWorkOrder(ids) {
|
||||
return request({
|
||||
url: `/iot/ioTworkOrder/${ids}`,
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ const BasicSettings = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="normal-spacing" style={{ padding: '8px', background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
<div className="normal-spacing" style={{ padding: '8px 0px', background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
|
||||
|
||||
{/* 顶部统计卡片 */}
|
||||
|
||||
@@ -501,7 +501,7 @@ export default function DeviceAccessPage() {
|
||||
}];
|
||||
|
||||
return (
|
||||
<div className="p-5 bg-[#f5f7fa] min-h-screen">
|
||||
<div className="p-0 pt-[8px] bg-[#f5f7fa] min-h-screen">
|
||||
{contextHolder}
|
||||
<Card className="mb-4">
|
||||
<Tabs activeKey={activeTab} onChange={setActiveTab}>
|
||||
|
||||
@@ -140,11 +140,11 @@ export default function DeviceManagementPage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: 24, paddingTop: 0 }}>
|
||||
<div style={{ padding: "8px 0px", paddingTop: 0 }}>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
style={{ marginBottom: 16 }}
|
||||
style={{ marginBottom: 0 }}
|
||||
>
|
||||
<Tabs.TabPane key="all" tab="设备管理" />
|
||||
<Tabs.TabPane key="camera" tab="摄像头管理" />
|
||||
|
||||
@@ -185,7 +185,7 @@ export default function MenuList() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
<div style={{ padding: '8px 0px' }}>
|
||||
{contextHolder}
|
||||
<Card title="菜单管理" style={{ borderRadius: 8 }}>
|
||||
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
|
||||
|
||||
@@ -86,12 +86,12 @@ const OnlineUserPage = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ padding: 20, background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
<div style={{ padding: "8px 0px", background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
{/* ====================== 顶部 Tabs ====================== */}
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
style={{ marginBottom: 20 }}
|
||||
style={{ marginBottom: 0 }}
|
||||
>
|
||||
<TabPane tab="在线用户" key="onlineUser" />
|
||||
<TabPane tab="其他监控" key="other" />
|
||||
|
||||
@@ -148,7 +148,7 @@ export default function Organization() {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
<div style={{ padding: '8px 0px' }}>
|
||||
{contextHolder}
|
||||
|
||||
<AntdCard title="组织管理" style={{ borderRadius: 8 }}>
|
||||
|
||||
@@ -252,7 +252,7 @@ export default function StationManage() {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
<div style={{ padding: '8px 0px' }}>
|
||||
{contextHolder}
|
||||
|
||||
<Card title="场站管理" style={{ borderRadius: 8 }}>
|
||||
|
||||
@@ -389,7 +389,7 @@ export default function UserRolePage() {
|
||||
overflowY: 'auto',
|
||||
scrollbarWidth: 'none',
|
||||
msOverflowStyle: 'none',
|
||||
padding: '20px',
|
||||
padding: '8px 0px',
|
||||
background: '#f5f7fa'
|
||||
}}>
|
||||
{contextHolder}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
exportAlarm
|
||||
} from '../../api/alarmApi.js';
|
||||
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../recharts.jsx';
|
||||
import { addWorkOrder } from '@/api/workOrder.js';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
const { Text } = Typography;
|
||||
@@ -70,6 +71,8 @@ export default function AlarmCenterPage() {
|
||||
const [total, setTotal] = useState(0);
|
||||
const [pageNum, setPageNum] = useState(1);
|
||||
const [pageSize] = useState(10);
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
|
||||
// 查询条件
|
||||
const [queryParams, setQueryParams] = useState({
|
||||
@@ -103,7 +106,7 @@ export default function AlarmCenterPage() {
|
||||
setTotal(res.total || 0);
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('加载失败');
|
||||
messageApi.error('加载失败');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -134,7 +137,7 @@ export default function AlarmCenterPage() {
|
||||
setDrawerVisible(true);
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('加载详情失败');
|
||||
messageApi.error('加载详情失败');
|
||||
} finally {
|
||||
setDetailLoading(false);
|
||||
}
|
||||
@@ -148,12 +151,12 @@ export default function AlarmCenterPage() {
|
||||
handleStatus: values.handleStatus,
|
||||
handleRemark: values.handleRemark || '已处理'
|
||||
});
|
||||
message.success('处理成功');
|
||||
messageApi.success('处理成功');
|
||||
setDrawerVisible(false);
|
||||
fetchList();
|
||||
fetchStat();
|
||||
} catch (err) {
|
||||
message.error('处理失败');
|
||||
messageApi.error('处理失败');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -273,9 +276,63 @@ export default function AlarmCenterPage() {
|
||||
color: '#1890FF',
|
||||
},
|
||||
].filter(i => i.value > 0);
|
||||
// 生成工单
|
||||
const handleaddOrder = async () => {
|
||||
if (!currentAlarm) {
|
||||
messageApi.warning('无告警信息,无法生成工单');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 组装接口需要的所有参数(你给的格式)
|
||||
const params = {
|
||||
id: '',
|
||||
orderNo: '',
|
||||
orderTitle: currentAlarm.alarmTitle || '告警生成工单',
|
||||
sourceType: 7, // 来源 7=告警
|
||||
orderType: 5, // 类型 5=运维
|
||||
priorityLevel: currentAlarm.alarmLevel === 1 ? 1 : 2, // 严重=高,其他=中
|
||||
deviceId: currentAlarm.deviceId || '',
|
||||
deviceName: currentAlarm.deviceName || '',
|
||||
deviceType: '', // 没有就传空
|
||||
siteId: '',
|
||||
siteName: '',
|
||||
orgId: '',
|
||||
assigneeId: '',
|
||||
assigneeName: '',
|
||||
collaboratorIds: '',
|
||||
collaboratorNames: '',
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
deadlineTime: '',
|
||||
actualStartTime: '',
|
||||
actualEndTime: '',
|
||||
orderStatus: 1, // 1-待处理
|
||||
alarmId: currentAlarm.id || '', // 关联告警ID
|
||||
alarmNo: currentAlarm.alarmNo || '', // 关联告警编号
|
||||
taskDescription: currentAlarm.alarmContent || '', // 任务描述=告警内容
|
||||
aiSuggestion: currentAlarm.rootCause || '', // AI建议
|
||||
requiredEquipment: '',
|
||||
estimatedImpact: '',
|
||||
handleResult: '',
|
||||
handleRemark: ''
|
||||
};
|
||||
|
||||
// 调用新增接口
|
||||
const res = await addWorkOrder(params);
|
||||
if (res.code === 0 || res.code === 200) {
|
||||
messageApi.success('工单生成成功');
|
||||
} else {
|
||||
messageApi.error(res.msg || '工单生成失败');
|
||||
}
|
||||
} catch (error) {
|
||||
messageApi.error('接口调用失败');
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px' }}>
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '0' }}>
|
||||
{contextHolder}
|
||||
|
||||
{/* 查询栏 */}
|
||||
<Row gutter={8} style={{ marginBottom: 8 }}>
|
||||
@@ -639,6 +696,13 @@ export default function AlarmCenterPage() {
|
||||
{/* 推荐处理措施 */}
|
||||
<Card size="small" title="推荐处理措施" style={{ marginBottom: 16 }}>
|
||||
<div style={{ color: '#333' }}>{currentAlarm.handleSuggestion || '-'}</div>
|
||||
<div className="flex justify-between">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<Button type="primary" onClick={handleaddOrder}>生成工单</Button>
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 处理操作 */}
|
||||
|
||||
@@ -80,8 +80,10 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
||||
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
|
||||
|
||||
.ant-card-head-title {
|
||||
.ant-typography{
|
||||
color: #0837A8 !important;
|
||||
}
|
||||
.ant-card-head-title{
|
||||
color: #0837A8;
|
||||
font-weight: 700 !important;
|
||||
font-size: clamp(14px, 0.85vw, 16px) !important;
|
||||
@@ -91,7 +93,7 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
||||
}
|
||||
|
||||
.ant-card-head-title>span {
|
||||
color: #0837A8;
|
||||
color: #0837A8 !important;
|
||||
font-weight: 700 !important;
|
||||
font-size: clamp(14px, 0.85vw, 16px) !important;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ export default function AIDiagnosisPage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px', boxSizing: 'border-box', overflowX: 'hidden' }}>
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '8px 0px', boxSizing: 'border-box', overflowX: 'hidden' }}>
|
||||
|
||||
<style>
|
||||
{`
|
||||
@@ -197,7 +197,7 @@ export default function AIDiagnosisPage() {
|
||||
</style>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', paddingBottom: "16px" }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', fontWeight: 800, color: '#1D2129' }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', color: '#1D2129' }}>
|
||||
AI 智能诊断与分析中心
|
||||
</Typography.Title>
|
||||
<Space>
|
||||
|
||||
@@ -126,7 +126,7 @@ export default function CleanOptimizationPage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px', boxSizing: 'border-box' }}>
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '12px 0px', boxSizing: 'border-box' }}>
|
||||
<style>
|
||||
{`
|
||||
.compact-table .ant-table-thead > tr > th {
|
||||
@@ -152,6 +152,7 @@ export default function CleanOptimizationPage() {
|
||||
`}
|
||||
</style>
|
||||
|
||||
|
||||
<Row
|
||||
gutter={[8, 8]}
|
||||
style={{
|
||||
@@ -275,7 +276,7 @@ export default function CleanOptimizationPage() {
|
||||
{/* 标题与操作栏 */}
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
|
||||
<Space size={8}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', fontWeight: 800 }}>清洗优化管理</Typography.Title>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', }}>清洗优化管理</Typography.Title>
|
||||
<InfoCircleOutlined style={{ color: '#86909C' }} />
|
||||
</Space>
|
||||
<Space>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Layout, Typography, Menu } from 'antd';
|
||||
import { Layout, Typography, Menu, Tabs } from 'antd';
|
||||
import { AimOutlined, AppstoreOutlined, SettingOutlined } from '@ant-design/icons';
|
||||
import DeviceOverviewPage from '../components/devices/DeviceOverviewPage';
|
||||
import DeviceStatusPage from '../components/devices/DeviceStatusPage';
|
||||
@@ -96,21 +96,30 @@ export default function DeviceIndexPage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden', scrollbarWidth: "thin", scrollbarColor: '#ccc transparent' }}>
|
||||
<Layout style={{ minHeight: '100vh', overflow: 'hidden', scrollbarWidth: "thin", scrollbarColor: '#ccc transparent' }}>
|
||||
<div style={{ display: 'flex', paddingBottom: "4px" }}>
|
||||
<div style={{ padding: '8px 12px 0', flexShrink: 0 }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>装备控制</Typography.Title>
|
||||
<Text type="secondary" style={{ fontSize: '12px' }}>装备总览、状态监控与参数配置</Text>
|
||||
{/*<Text type="secondary" style={{ fontSize: '12px' }}>装备总览、状态监控与参数配置</Text>*/}
|
||||
</div>
|
||||
|
||||
<Header style={{ flex: 1, background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', height: 40, lineHeight: '40px' }}>
|
||||
<Header style={{
|
||||
flex: 1, padding: 0, background: 'transparent',
|
||||
backgroundColor: 'transparent', borderBottom: '1px solid #f0f0f0', height: 40, lineHeight: '40px'
|
||||
}}>
|
||||
|
||||
<Menu
|
||||
mode="horizontal"
|
||||
selectedKeys={[activeTab]}
|
||||
onClick={({ key }) => setActiveTab(key)}
|
||||
items={tabs}
|
||||
style={{ border: 0, height: 40, lineHeight: '40px' }}
|
||||
/>
|
||||
style={{
|
||||
border: '0',
|
||||
height: 40,
|
||||
lineHeight: '40px',
|
||||
background: 'transparent', // 这里直接写,不需要 !important
|
||||
backgroundColor: 'transparent' // 兼容更好
|
||||
}} />
|
||||
</Header>
|
||||
</div>
|
||||
|
||||
@@ -118,7 +127,7 @@ export default function DeviceIndexPage() {
|
||||
maxHeight: 'calc(100vh - 40px)',
|
||||
overflowY: 'auto',
|
||||
background: '#f5f7fa',
|
||||
padding: '8px',
|
||||
padding: '8px 0px',
|
||||
scrollbarWidth: "thin"
|
||||
}}>
|
||||
{renderContent()}
|
||||
|
||||
@@ -153,7 +153,7 @@ export default function StationDashboard() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f8fafc', padding: '8px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
|
||||
<div style={{ background: '#f8fafc', padding: '0px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
|
||||
<Row gutter={[8, 8]} style={{ margin: '0 4px 0px 4px' }}>
|
||||
{[
|
||||
{ title: '今日发电量', value: '4,752', unit: 'kWh', sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
|
||||
|
||||
@@ -97,7 +97,7 @@ const RealTimeMonitorPage = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f8fafc', padding: '8px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
|
||||
<div style={{ background: '#f8fafc', padding: '8px 0px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
<Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>实时监控中心</Title>
|
||||
<Text type="secondary" style={{ fontSize: '12px' }}>全方位实时掌握电站设备运行状态与发电表现</Text>
|
||||
|
||||
@@ -116,7 +116,7 @@ export default function ReportCenterPage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '16px 24px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
|
||||
<div style={{ padding: '4px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
|
||||
<style>
|
||||
{`
|
||||
.compact-table .ant-table-thead > tr > th {
|
||||
@@ -153,17 +153,20 @@ export default function ReportCenterPage() {
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16 }}>
|
||||
<Typography.Title level={4} style={{ margin: '0 32px 0 0', }}>报表中心</Typography.Title>
|
||||
|
||||
{/* 页面头部标签 */}
|
||||
<Tabs activeKey={activeTab} onChange={setActiveTab} className="report-tabs">
|
||||
<TabPane tab="报表总览" key="overview" />
|
||||
<TabPane tab="发电报表" key="power" />
|
||||
<TabPane tab="运维报表" key="operation" />
|
||||
<TabPane tab="告警报表" key="alarm" />
|
||||
<TabPane tab="AI分析报告" key="ai" />
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
<Typography.Title level={4} style={{ margin: 0 }}>报表中心</Typography.Title>
|
||||
|
||||
{/* 页面头部标签 */}
|
||||
<Tabs activeKey={activeTab} onChange={setActiveTab} className="report-tabs">
|
||||
<TabPane tab="报表总览" key="overview" />
|
||||
<TabPane tab="发电报表" key="power" />
|
||||
<TabPane tab="运维报表" key="operation" />
|
||||
<TabPane tab="告警报表" key="alarm" />
|
||||
<TabPane tab="AI分析报告" key="ai" />
|
||||
</Tabs>
|
||||
|
||||
<Row
|
||||
gutter={[8, 8]}
|
||||
|
||||
@@ -161,13 +161,13 @@ export default function SystemSettings() {
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden' }}>
|
||||
<Layout style={{ minHeight: '100vh', overflow: 'hidden' }}>
|
||||
|
||||
<div style={{ padding: '8px 12px 0' }}>
|
||||
<div style={{ padding: '4px 0px 0' }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>系统设置</Typography.Title>
|
||||
<Text type="secondary" style={{ fontSize: '12px' }}>告警规则配置、用户角色、通知管理与系统参数设置</Text>
|
||||
</div>
|
||||
<Header style={{ background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10, height: 40, lineHeight: '40px' }}>
|
||||
<Header style={{ padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10, height: 40, lineHeight: '40px' }}>
|
||||
<Menu
|
||||
mode="horizontal"
|
||||
selectedKeys={[activeTab]}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function VideoMonitorPage() {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px', boxSizing: 'border-box' }}>
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '8px 0px', boxSizing: 'border-box' }}>
|
||||
<style>
|
||||
{`
|
||||
.compact-table .ant-table-thead > tr > th {
|
||||
|
||||
@@ -78,6 +78,8 @@ const WorkOrderPage = () => {
|
||||
|
||||
const [completeModalVisible, setCompleteModalVisible] = useState(false);
|
||||
const [completeForm] = Form.useForm(); // 完成工单表单
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
|
||||
// 统计数据(保留原模拟不变)
|
||||
const stats = [
|
||||
@@ -122,7 +124,7 @@ const WorkOrderPage = () => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('获取工单列表失败');
|
||||
messageApi.error('获取工单列表失败');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -130,7 +132,7 @@ const WorkOrderPage = () => {
|
||||
|
||||
// 打开完成工单弹窗
|
||||
const openCompleteModal = () => {
|
||||
if (!selectedRowKey) return message.warning('请先选择工单');
|
||||
if (!selectedRowKey) return messageApi.warning('请先选择工单');
|
||||
completeForm.setFieldsValue({
|
||||
id: currentDetail?.id,
|
||||
orderNo: currentDetail?.orderNo,
|
||||
@@ -151,13 +153,13 @@ const WorkOrderPage = () => {
|
||||
};
|
||||
|
||||
await completeWorkOrder(params);
|
||||
message.success('工单已完成');
|
||||
messageApi.success('工单已完成');
|
||||
setCompleteModalVisible(false);
|
||||
// 刷新列表 + 详情
|
||||
getWorkOrderList();
|
||||
getWorkOrderDetail(selectedRowKey);
|
||||
} catch (err) {
|
||||
message.error('工单完成失败');
|
||||
messageApi.error('工单完成失败');
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
@@ -170,7 +172,7 @@ const WorkOrderPage = () => {
|
||||
setCurrentDetail(res.data);
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('获取工单详情失败');
|
||||
messageApi.error('获取工单详情失败');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -184,13 +186,12 @@ const WorkOrderPage = () => {
|
||||
|
||||
// 打开修改工单弹窗
|
||||
const openEditModal = () => {
|
||||
if (!selectedRowKey) return message.warning('请先选择一条工单');
|
||||
if (!selectedRowKey) return messageApi.warning('请先选择一条工单');
|
||||
form.setFieldsValue({
|
||||
title: currentDetail?.orderTitle,
|
||||
content: currentDetail?.taskDescription,
|
||||
priority: currentDetail?.priorityLevel,
|
||||
type: currentDetail?.orderType,
|
||||
remark: currentDetail?.remark
|
||||
orderTitle: currentDetail?.orderTitle,
|
||||
orderType: currentDetail?.orderType,
|
||||
priorityLevel: currentDetail?.priorityLevel,
|
||||
taskDescription: currentDetail?.taskDescription,
|
||||
});
|
||||
setEditModalVisible(true);
|
||||
};
|
||||
@@ -198,7 +199,7 @@ const WorkOrderPage = () => {
|
||||
// 打开派发工单弹窗
|
||||
// 打开派发工单弹窗
|
||||
const openDispatchModal = () => {
|
||||
if (!selectedRowKey) return message.warning('请先选择一条工单');
|
||||
if (!selectedRowKey) return messageApi.warning('请先选择一条工单');
|
||||
form.setFieldsValue({
|
||||
orderId: selectedRowKey, // 自动回填工单ID
|
||||
assigneeName: currentDetail?.assigneeName || '',
|
||||
@@ -210,22 +211,54 @@ const WorkOrderPage = () => {
|
||||
};
|
||||
|
||||
// 提交修改工单
|
||||
// 提交修改工单(完整匹配后端参数)
|
||||
const submitEdit = async (values) => {
|
||||
try {
|
||||
// 适配后端传参:id、title、content、priority、type、remark
|
||||
await updateWorkOrder({
|
||||
id: selectedRowKey,
|
||||
orderTitle: values.title,
|
||||
taskDescription: values.content,
|
||||
priorityLevel: values.priority,
|
||||
orderType: values.type,
|
||||
remark: values.remark
|
||||
});
|
||||
message.success('修改工单成功');
|
||||
// 拼接你给的所有工单参数(1:1 匹配)
|
||||
const params = {
|
||||
id: selectedRowKey, // 主键ID
|
||||
orderNo: currentDetail?.orderNo, // 工单编号
|
||||
orderTitle: values.orderTitle, // 工单标题
|
||||
sourceType: currentDetail?.sourceType, // 来源(保持不变)
|
||||
orderType: values.orderType, // 类型
|
||||
priorityLevel: values.priorityLevel, // 优先级
|
||||
deviceId: currentDetail?.deviceId, // 设备ID
|
||||
deviceName: currentDetail?.deviceName, // 设备名称
|
||||
deviceType: currentDetail?.deviceType,
|
||||
siteId: currentDetail?.siteId,
|
||||
siteName: currentDetail?.siteName,
|
||||
orgId: currentDetail?.orgId,
|
||||
assigneeId: currentDetail?.assigneeId,
|
||||
assigneeName: currentDetail?.assigneeName,
|
||||
collaboratorIds: currentDetail?.collaboratorIds,
|
||||
collaboratorNames: currentDetail?.collaboratorNames,
|
||||
planStartTime: currentDetail?.planStartTime,
|
||||
planEndTime: currentDetail?.planEndTime,
|
||||
deadlineTime: currentDetail?.deadlineTime,
|
||||
actualStartTime: currentDetail?.actualStartTime,
|
||||
actualEndTime: currentDetail?.actualEndTime,
|
||||
orderStatus: currentDetail?.orderStatus,
|
||||
alarmId: currentDetail?.alarmId,
|
||||
alarmNo: currentDetail?.alarmNo,
|
||||
taskDescription: values.taskDescription, // 任务描述
|
||||
aiSuggestion: currentDetail?.aiSuggestion,
|
||||
requiredEquipment: currentDetail?.requiredEquipment,
|
||||
estimatedImpact: currentDetail?.estimatedImpact,
|
||||
handleResult: currentDetail?.handleResult,
|
||||
handleRemark: currentDetail?.handleRemark,
|
||||
};
|
||||
|
||||
// 调用你提供的接口
|
||||
await updateWorkOrder(params);
|
||||
|
||||
messageApi.success('修改工单成功');
|
||||
setEditModalVisible(false);
|
||||
// 刷新列表和详情
|
||||
getWorkOrderList();
|
||||
getWorkOrderDetail(selectedRowKey);
|
||||
} catch (error) {
|
||||
message.error('修改工单失败');
|
||||
messageApi.error('修改工单失败');
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -247,11 +280,11 @@ const WorkOrderPage = () => {
|
||||
|
||||
await dispatchWorkOrder(params);
|
||||
|
||||
message.success('工单派发成功');
|
||||
messageApi.success('工单派发成功');
|
||||
setDispatchModalVisible(false);
|
||||
getWorkOrderList(); // 刷新列表
|
||||
} catch (error) {
|
||||
message.error('工单派发失败');
|
||||
messageApi.error('工单派发失败');
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
@@ -333,7 +366,8 @@ const WorkOrderPage = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ padding: '16px 24px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
|
||||
<div style={{ padding: '0px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
|
||||
{contextHolder}
|
||||
<style>
|
||||
{`
|
||||
.compact-table .ant-table-thead > tr > th {
|
||||
@@ -364,8 +398,8 @@ const WorkOrderPage = () => {
|
||||
</style>
|
||||
|
||||
{/* 顶部标题和页签 */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16 }}>
|
||||
<Title level={4} style={{ margin: '0 32px 0 0', fontWeight: 800 }}>工单任务管理</Title>
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
|
||||
<Title level={4} style={{ margin: '0 32px 0 0', }}>工单任务管理</Title>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
@@ -589,7 +623,7 @@ const WorkOrderPage = () => {
|
||||
|
||||
<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>
|
||||
<span level={4} style={{ margin: 0, fontSize: 18, fontWeight: 800 }}>{currentDetail?.orderTitle || '暂无标题'}</span>
|
||||
{currentDetail?.priorityLevel && (
|
||||
<Tag
|
||||
style={{
|
||||
@@ -607,19 +641,19 @@ const WorkOrderPage = () => {
|
||||
</div>
|
||||
|
||||
<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={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 }}>{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?.collaboratorNames || '无'}</span></Col>
|
||||
<Col span={24}><span style={{ fontSize: 12 }}>计划时间:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.planStartTime ? `${currentDetail.planStartTime} ~ ${currentDetail.planEndTime}` : '--'}</span></Col>
|
||||
<Col span={12}><span style={{ fontSize: 12 }}>关联设备:</span><span style={{ fontSize: 12, color: '#165DFF', fontWeight: 600 }}>{currentDetail?.deviceName || '无'}</span></Col>
|
||||
<Col span={12}><span style={{ fontSize: 12 }}>关联区域:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.siteName || '无'}</span></Col>
|
||||
<Col span={24}>
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>当前状态:</Text>
|
||||
<span style={{ fontSize: 12 }}>当前状态:</span>
|
||||
<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" style={{ fontSize: 12 }}>任务描述:</Text>
|
||||
<span style={{ fontSize: 12 }}>任务描述:</span>
|
||||
<div style={{ fontSize: 12, color: '#4E5969', marginTop: 4, lineHeight: 1.6 }}>{currentDetail?.taskDescription || '暂无描述'}</div>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -750,31 +784,57 @@ const WorkOrderPage = () => {
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
{/* 修改工单弹窗 */}
|
||||
{/* 修改工单弹窗 */}
|
||||
<Modal title="修改工单" open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
|
||||
<Form form={form} layout="vertical" onFinish={submitEdit}>
|
||||
<FormItem name="title" label="工单标题">
|
||||
<FormItem
|
||||
name="orderTitle"
|
||||
label="工单标题"
|
||||
rules={[{ required: true, message: '请输入工单标题' }]}
|
||||
>
|
||||
<Input placeholder="请输入工单标题" />
|
||||
</FormItem>
|
||||
<FormItem name="content" label="工单内容">
|
||||
<Input.TextArea rows={4} placeholder="请输入工单内容" />
|
||||
|
||||
<FormItem
|
||||
name="orderType"
|
||||
label="工单类型"
|
||||
rules={[{ required: true, message: '请选择工单类型' }]}
|
||||
>
|
||||
<Select placeholder="请选择工单类型">
|
||||
<Option value={1}>巡检</Option>
|
||||
<Option value={2}>检修</Option>
|
||||
<Option value={3}>清洗</Option>
|
||||
<Option value={4}>维修</Option>
|
||||
<Option value={5}>运维</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem name="priority" label="优先级">
|
||||
|
||||
<FormItem
|
||||
name="priorityLevel"
|
||||
label="优先级"
|
||||
rules={[{ required: true, message: '请选择优先级' }]}
|
||||
>
|
||||
<Select placeholder="请选择优先级">
|
||||
<Option value={1}>高</Option>
|
||||
<Option value={2}>中</Option>
|
||||
<Option value={3}>低</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem name="type" label="工单类型">
|
||||
<Input placeholder="请输入工单类型" />
|
||||
</FormItem>
|
||||
<FormItem name="remark" label="备注">
|
||||
<Input.TextArea rows={2} placeholder="请输入备注" />
|
||||
|
||||
<FormItem
|
||||
name="taskDescription"
|
||||
label="任务描述"
|
||||
rules={[{ required: true, message: '请输入任务描述' }]}
|
||||
>
|
||||
<Input.TextArea rows={4} placeholder="请输入任务描述" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setEditModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认修改</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>
|
||||
确认修改
|
||||
</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user