告警和 工单细节优化

This commit is contained in:
mmc
2026-07-24 19:35:56 +08:00
parent b11f218fb2
commit 7e45c9fd79
7 changed files with 187 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import {
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, Popconfirm
Statistic, Modal, message, Empty, Drawer, Descriptions, Timeline, Divider, Form, Tabs, Progress, Badge, DatePicker, Pagination, Popconfirm, Image
} from 'antd';
import {
CheckOutlined, ClockCircleOutlined, ControlOutlined,
@@ -243,9 +243,9 @@ const WorkOrderPage = () => {
if (item.orderStatus === 2 || item.orderStatus === 5) running++;
// 已完成工单计算处理时长
if (item.orderStatus === 4 && item.actualStartTime && item.actualEndTime) {
if (item.orderStatus === 3 && item.createTime && item.actualEndTime) {
finishCount++;
const costMin = dayjs(item.actualEndTime).diff(dayjs(item.actualStartTime), 'minute');
const costMin = dayjs(item.actualEndTime).diff(dayjs(item.createTime), 'minute');
totalCostHour += costMin / 60;
allFinishOrder.push(item);
}
@@ -437,7 +437,9 @@ const WorkOrderPage = () => {
const queryParams = {
...params,
pageNum: pagination.current,
pageSize: pagination.pageSize
pageSize: pagination.pageSize,
siteId: stationId,
};
const res = await getWorkOrderApi(queryParams);
@@ -494,7 +496,9 @@ const WorkOrderPage = () => {
const values = queryForm.getFieldsValue();
console.log('查询表单值:', values);
const params: any = {};
const params = {
siteId: stationId,
};
if (values.orderType) {
params.orderType = values.orderType;
@@ -1136,24 +1140,84 @@ const WorkOrderPage = () => {
</div>
<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 }}>{sourceTypeMap[currentDetail?.sourceType] || '--'}</span></Col>
<Col span={12}><span style={{ fontSize: 12 }}>工单类型:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{getWorkOrderTypeText(currentDetail?.orderType)}</span></Col>
<Col span={24}><span style={{ fontSize: 12 }}>执行开始时间:</span>
<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 }}>{getWorkOrderTypeText(currentDetail?.orderType)}</span>
</Col>
<Col span={24}>
<span style={{ fontSize: 12 }}>执行开始时间:</span>
<span style={{ fontSize: 12, fontWeight: 500 }}>
{currentDetail?.actualStartTime}
{currentDetail?.actualStartTime || '--'}
</span>
</Col>
<Col span={24}><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}>
<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={12}>
<span style={{ fontSize: 12 }}>当前状态:</span>
<Tag color="blue" style={{ borderRadius: 4, fontWeight: 600, border: 'none', background: '#E8F3FF', color: '#165DFF' }}>{orderStatusConfig[currentDetail?.orderStatus]?.label || '--'}</Tag>
<Tag color="blue" style={{ borderRadius: 4, fontWeight: 600, border: 'none', background: '#E8F3FF', color: '#165DFF' }}>
{orderStatusConfig[currentDetail?.orderStatus]?.label || '--'}
</Tag>
</Col>
<Col span={24}>
<span style={{ fontSize: 12 }}>任务描述:</span>
<div style={{ fontSize: 12, color: '#4E5969', marginTop: 4, lineHeight: 1.6 }}>{currentDetail?.taskDescription || '暂无描述'}</div>
<div style={{ fontSize: 12, color: '#4E5969', marginTop: 4, lineHeight: 1.6 }}>
{currentDetail?.taskDescription || '暂无描述'}
</div>
</Col>
{/* ============ 新增:图片&视频附件预览区域 ============ */}
{(
(currentDetail?.imgUrl && currentDetail.imgUrl.length > 0) ||
(currentDetail?.videoUrl && currentDetail.videoUrl.length > 0)
) && (
<Col span={24}>
<div style={{ fontSize: 12, marginBottom: 8 }}>附件素材:</div>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
{/* 图片预览组,支持点击放大 */}
{currentDetail?.imgUrl?.length > 0 && (
<Image.PreviewGroup>
{currentDetail.imgUrl.map((rawUrl, idx) => {
return (
<Image
key={`img-${idx}`}
src={rawUrl}
width={110}
height={80}
style={{ objectFit: 'cover', borderRadius: 6, border: '1px solid #e5e6eb' }}
preview
/>
);
})}
</Image.PreviewGroup>
)}
{/* 视频预览 */}
{currentDetail?.videoUrl?.length > 0 && currentDetail.videoUrl.map((rawUrl, idx) => {
return (
<video
key={`video-${idx}`}
src={rawUrl}
style={{ width: 110, height: 80, objectFit: 'cover', borderRadius: 6, border: '1px solid #e5e6eb' }}
controls
/>
);
})}
</div>
</Col>
)}
</Row>
</div>
<div style={{ marginBottom: 8 }}>
@@ -1618,11 +1682,10 @@ const WorkOrderPage = () => {
dataIndex: 'handleStatus',
width: 100,
render: (s) => {
const map = { 1: '待处理', 2: '处理中', 3: '已关闭', 4: '已忽略' };
const map = { 1: '待处理', 2: '已关闭', };
let tagColor = 'default';
if (s === 1) tagColor = 'orange';
if (s === 2) tagColor = 'blue';
if (s === 3) tagColor = 'green';
if (s === 2) tagColor = 'green';
return <Tag color={tagColor}>{map[s] || '-'}</Tag>;
}
}