工单告警完善
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
import request from './request';
|
import request from './request';
|
||||||
//获取工单列表
|
//获取工单列表
|
||||||
export function getWorkOrderApi() {
|
export function getWorkOrderApi(params) {
|
||||||
return request({
|
return request({
|
||||||
url: `/iot/ioTworkOrder/list`,
|
url: `/iot/ioTworkOrder/list`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//获取工单详情
|
//获取工单详情
|
||||||
|
|||||||
@@ -364,34 +364,29 @@ export default function AlarmCenterPage() {
|
|||||||
// 规整成图表一维数组
|
// 规整成图表一维数组
|
||||||
return Object.entries(groupMap).map(([date, obj]) => ({
|
return Object.entries(groupMap).map(([date, obj]) => ({
|
||||||
date,
|
date,
|
||||||
severe: obj['1'] || 0, // 严重
|
severe: obj['ERROR'] || 0, // 严重
|
||||||
important: obj['2'] || 0, // 重要
|
important: obj['WARNING'] || 0, // 重要
|
||||||
normal: obj['3'] || 0, // 一般
|
normal: obj['INFO'] || 0, // 一般
|
||||||
tip: obj['4'] || 0 // 提示
|
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const pieData = [
|
const pieData = [
|
||||||
{
|
{
|
||||||
name: '严重',
|
name: '错误',
|
||||||
value: statData.levelStats?.[1] || 0,
|
value: statData.levelStats?.["ERROR"] || 0,
|
||||||
color: '#FF4D4F',
|
color: '#FF4D4F',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '重要',
|
name: '警告',
|
||||||
value: statData.levelStats?.[2] || 0,
|
value: statData.levelStats?.['WARNING'] || 0,
|
||||||
color: '#FA8C16',
|
color: '#FA8C16',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '一般',
|
name: '信息',
|
||||||
value: statData.levelStats?.[3] || 0,
|
value: statData.levelStats?.['INFO'] || 0,
|
||||||
color: '#FADB14',
|
color: '#FADB14',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: '提示',
|
|
||||||
value: statData.levelStats?.[4] || 0,
|
|
||||||
color: '#1890FF',
|
|
||||||
},
|
|
||||||
].filter(i => i.value > 0);
|
].filter(i => i.value > 0);
|
||||||
const fetchTodayAndYesterdayStat = async () => {
|
const fetchTodayAndYesterdayStat = async () => {
|
||||||
const today = dayjs().format('YYYY-MM-DD');
|
const today = dayjs().format('YYYY-MM-DD');
|
||||||
@@ -508,7 +503,7 @@ export default function AlarmCenterPage() {
|
|||||||
title: '严重告警',
|
title: '严重告警',
|
||||||
value: todayData.levelStats?.[1] || 0,
|
value: todayData.levelStats?.[1] || 0,
|
||||||
trend: (() => {
|
trend: (() => {
|
||||||
const now = todayData.levelStats?.[1] ?? 0;
|
const now = todayData.levelStats?.["ERROR"] ?? 0;
|
||||||
const last = yesterdayData.levelStats?.[1] ?? 0;
|
const last = yesterdayData.levelStats?.[1] ?? 0;
|
||||||
if (last === 0) return '较昨日 无变化';
|
if (last === 0) return '较昨日 无变化';
|
||||||
const rateNum = ((now - last) / last) * 100;
|
const rateNum = ((now - last) / last) * 100;
|
||||||
@@ -516,13 +511,13 @@ export default function AlarmCenterPage() {
|
|||||||
return rateNum > 0 ? `较昨日 +${rateStr}% ↑` : rateNum < 0 ? `较昨日 ${rateStr}% ↓` : '较昨日 0%';
|
return rateNum > 0 ? `较昨日 +${rateStr}% ↑` : rateNum < 0 ? `较昨日 ${rateStr}% ↓` : '较昨日 0%';
|
||||||
})(),
|
})(),
|
||||||
trendColor: (() => {
|
trendColor: (() => {
|
||||||
const now = todayData.levelStats?.[1] ?? 0;
|
const now = todayData.levelStats?.["ERROR"] ?? 0;
|
||||||
const last = yesterdayData.levelStats?.[1] ?? 0;
|
const last = yesterdayData.levelStats?.["ERROR"] ?? 0;
|
||||||
if (last === 0) return '#86909C';
|
if (last === 0) return '#86909C';
|
||||||
const rateNum = ((now - last) / last) * 100;
|
const rateNum = ((now - last) / last) * 100;
|
||||||
return rateNum > 0 ? '#FF4D4F' : rateNum < 0 ? '#00B42A' : '#86909C';
|
return rateNum > 0 ? '#FF4D4F' : rateNum < 0 ? '#00B42A' : '#86909C';
|
||||||
})(),
|
})(),
|
||||||
subText: `昨日 ${yesterdayData.levelStats?.[1] || 0}`,
|
subText: `昨日 ${yesterdayData.levelStats?.["ERROR"] || 0}`,
|
||||||
icon: <ExclamationCircleOutlined />,
|
icon: <ExclamationCircleOutlined />,
|
||||||
color: '#FF4D4F',
|
color: '#FF4D4F',
|
||||||
bg: '#FFF1F0'
|
bg: '#FFF1F0'
|
||||||
@@ -617,20 +612,14 @@ export default function AlarmCenterPage() {
|
|||||||
<Row gutter={8} style={{ marginBottom: 8 }}>
|
<Row gutter={8} style={{ marginBottom: 8 }}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
|
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
|
||||||
<Row gutter={[24, 16]} align="middle">
|
<Row gutter={[8, 8]} align="middle">
|
||||||
<Col>
|
<Col>
|
||||||
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>告警级别</div>
|
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>告警级别</div>
|
||||||
<Select
|
<Select
|
||||||
style={{ width: 120 }}
|
style={{ width: 120 }}
|
||||||
value={queryParams.alarmLevel}
|
value={queryParams.alarmLevel}
|
||||||
onChange={v => setQueryParams({ ...queryParams, alarmLevel: v })}
|
allowClear onChange={v => setQueryParams({ ...queryParams, alarmLevel: v })}
|
||||||
options={[
|
options={errorLevelOptions}
|
||||||
{ value: '', label: '全部' },
|
|
||||||
{ value: 1, label: '严重' },
|
|
||||||
{ value: 2, label: '重要' },
|
|
||||||
{ value: 3, label: '一般' },
|
|
||||||
{ value: 4, label: '提示' },
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
@@ -638,13 +627,12 @@ export default function AlarmCenterPage() {
|
|||||||
<Select
|
<Select
|
||||||
style={{ width: 120 }}
|
style={{ width: 120 }}
|
||||||
value={queryParams.handleStatus}
|
value={queryParams.handleStatus}
|
||||||
|
allowClear
|
||||||
onChange={v => setQueryParams({ ...queryParams, handleStatus: v })}
|
onChange={v => setQueryParams({ ...queryParams, handleStatus: v })}
|
||||||
options={[
|
options={[
|
||||||
{ value: '', label: '全部' },
|
|
||||||
{ value: 1, label: '待处理' },
|
{ value: 1, label: '待处理' },
|
||||||
{ value: 2, label: '处理中' },
|
{ value: 2, label: '处理中' },
|
||||||
{ value: 3, label: '已关闭' },
|
{ value: 3, label: '已关闭' },
|
||||||
{ value: 4, label: '已忽略' },
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -654,7 +642,12 @@ export default function AlarmCenterPage() {
|
|||||||
placeholder="设备ID"
|
placeholder="设备ID"
|
||||||
value={queryParams.deviceId}
|
value={queryParams.deviceId}
|
||||||
onChange={e => setQueryParams({ ...queryParams, deviceId: e.target.value })}
|
onChange={e => setQueryParams({ ...queryParams, deviceId: e.target.value })}
|
||||||
style={{ width: 160 }}
|
style={{ width: 280 }}
|
||||||
|
allowClear
|
||||||
|
onBlur={(e) => {
|
||||||
|
const trimVal = e.target.value.trim(); // 只清除首尾空格
|
||||||
|
setQueryParams({ ...queryParams, deviceId: trimVal });
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
@@ -669,6 +662,13 @@ export default function AlarmCenterPage() {
|
|||||||
startTime: arr[0].format('YYYY-MM-DD HH:mm:ss'),
|
startTime: arr[0].format('YYYY-MM-DD HH:mm:ss'),
|
||||||
endTime: arr[1].format('YYYY-MM-DD HH:mm:ss')
|
endTime: arr[1].format('YYYY-MM-DD HH:mm:ss')
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// 点击清空按钮 / 无选择,清空时间参数
|
||||||
|
setQueryParams({
|
||||||
|
...queryParams,
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -736,29 +736,24 @@ export default function AlarmCenterPage() {
|
|||||||
backgroundColor="transparent"
|
backgroundColor="transparent"
|
||||||
series={[
|
series={[
|
||||||
{
|
{
|
||||||
key: 'severe',
|
key: 'ERROR',
|
||||||
name: '严重',
|
name: '错误',
|
||||||
color: '#FF4D4F',
|
color: '#FF4D4F',
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'important',
|
key: 'WARNING',
|
||||||
name: '重要',
|
name: '警告',
|
||||||
color: '#FA8C16',
|
color: '#FA8C16',
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'normal',
|
key: 'INFO',
|
||||||
name: '一般',
|
name: '信息',
|
||||||
color: '#FADB14',
|
color: '#FADB14',
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'tip',
|
|
||||||
name: '提示',
|
|
||||||
color: '#1890FF',
|
|
||||||
strokeWidth: 2,
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -146,6 +146,14 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
|||||||
overflow: auto !important; /* 超出高度时显示滚动条 */
|
overflow: auto !important; /* 超出高度时显示滚动条 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 选中行高亮 */
|
||||||
|
.compact-table .table-active-row {
|
||||||
|
background-color: #e6f7ff !important;
|
||||||
|
}
|
||||||
|
.compact-table tbody tr:hover {
|
||||||
|
background-color: #f0f7ff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import { orderTypeConfig, sourceTypeMap } from '../constants';
|
|||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { RootState } from '../store';
|
import { RootState } from '../store';
|
||||||
import { getUser } from '../api/user';
|
import { getUser } from '../api/user';
|
||||||
import utils, { getWorkOrderTypeText, workOrderTypeOptions } from '../lib/utils';
|
import utils, { errorLevelOptions, getWorkOrderTypeText, workOrderTypeOptions } from '../lib/utils';
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
@@ -64,9 +64,8 @@ const priorityConfig = {
|
|||||||
const orderStatusConfig = {
|
const orderStatusConfig = {
|
||||||
1: { label: '待处理', textColor: '#1890ff' },
|
1: { label: '待处理', textColor: '#1890ff' },
|
||||||
2: { label: '执行中', textColor: '#1890ff' },
|
2: { label: '执行中', textColor: '#1890ff' },
|
||||||
3: { label: '挂起', textColor: '#faad14' },
|
4: { label: '挂起', textColor: '#faad14' },
|
||||||
4: { label: '已完成', textColor: '#52c41a' },
|
3: { label: '已完成', textColor: '#52c41a' },
|
||||||
5: { label: '处理中', textColor: '#722ed1' }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const WorkOrderPage = () => {
|
const WorkOrderPage = () => {
|
||||||
@@ -98,6 +97,30 @@ const WorkOrderPage = () => {
|
|||||||
const { stationId } = useSelector((state: RootState) => state.station);
|
const { stationId } = useSelector((state: RootState) => state.station);
|
||||||
const [deviceAll, setDevicesAll] = useState([]);
|
const [deviceAll, setDevicesAll] = useState([]);
|
||||||
|
|
||||||
|
// 查询表单状态
|
||||||
|
const [queryForm] = Form.useForm();
|
||||||
|
|
||||||
|
// 优先级选项
|
||||||
|
const priorityOptions = [
|
||||||
|
{ value: 1, label: '高' },
|
||||||
|
{ value: 2, label: '中' },
|
||||||
|
{ value: 3, label: '低' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 状态选项
|
||||||
|
const statusOptions = [
|
||||||
|
{ value: 1, label: '待处理' },
|
||||||
|
{ value: 2, label: '执行中' },
|
||||||
|
{ value: 3, label: '已完成' },
|
||||||
|
{ value: 4, label: '已挂起' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 分页状态
|
||||||
|
const [pagination, setPagination] = useState({
|
||||||
|
current: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -264,10 +287,9 @@ const WorkOrderPage = () => {
|
|||||||
const getOrderStatusPieData = () => {
|
const getOrderStatusPieData = () => {
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
1: '待处理',
|
1: '待处理',
|
||||||
2: '已派发',
|
2: '执行中',
|
||||||
3: '执行中',
|
3: '已完成',
|
||||||
4: '已完成',
|
4: '已挂起',
|
||||||
5: '已挂起',
|
|
||||||
};
|
};
|
||||||
const countMap: Record<string, number> = {};
|
const countMap: Record<string, number> = {};
|
||||||
|
|
||||||
@@ -291,10 +313,16 @@ const WorkOrderPage = () => {
|
|||||||
{ date: '05-24', value: 11 },
|
{ date: '05-24', value: 11 },
|
||||||
];
|
];
|
||||||
|
|
||||||
const getWorkOrderList = async () => {
|
const getWorkOrderList = async (params = {}) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await getWorkOrderApi();
|
const queryParams = {
|
||||||
|
...params,
|
||||||
|
pageNum: pagination.current,
|
||||||
|
pageSize: pagination.pageSize
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await getWorkOrderApi(queryParams);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
setWorkOrderList(res.rows || []);
|
setWorkOrderList(res.rows || []);
|
||||||
setWorkOrderTotal(res.total || 0);
|
setWorkOrderTotal(res.total || 0);
|
||||||
@@ -311,6 +339,74 @@ const WorkOrderPage = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 分页变化处理
|
||||||
|
const handlePageChange = (page, pageSize) => {
|
||||||
|
setPagination({ current: page, pageSize: pageSize || pagination.pageSize });
|
||||||
|
// 使用当前查询条件重新请求
|
||||||
|
const values = queryForm.getFieldsValue();
|
||||||
|
const params: any = {};
|
||||||
|
|
||||||
|
if (values.orderType) {
|
||||||
|
params.orderType = values.orderType;
|
||||||
|
}
|
||||||
|
if (values.priorityLevel) {
|
||||||
|
params.priorityLevel = values.priorityLevel;
|
||||||
|
}
|
||||||
|
if (values.timeRange && values.timeRange.length === 2) {
|
||||||
|
// 开始时间正常取
|
||||||
|
params.startTime = values.timeRange[0].format('YYYY-MM-DD 00:00:00');
|
||||||
|
// 结束时间强制补 23:59:59
|
||||||
|
params.endTime = values.timeRange[1].format('YYYY-MM-DD 23:59:59');
|
||||||
|
}
|
||||||
|
if (values.orderStatus && values.orderStatus !== 'all') {
|
||||||
|
params.orderStatus = values.orderStatus;
|
||||||
|
}
|
||||||
|
if (values.keyword) {
|
||||||
|
params.keyword = values.keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
getWorkOrderList(params);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理查询
|
||||||
|
const handleQuery = async () => {
|
||||||
|
// 查询时重置到第一页
|
||||||
|
setPagination({ ...pagination, current: 1 });
|
||||||
|
|
||||||
|
const values = queryForm.getFieldsValue();
|
||||||
|
console.log('查询表单值:', values);
|
||||||
|
const params: any = {};
|
||||||
|
|
||||||
|
if (values.orderType) {
|
||||||
|
params.orderType = values.orderType;
|
||||||
|
}
|
||||||
|
if (values.priorityLevel) {
|
||||||
|
params.priorityLevel = values.priorityLevel;
|
||||||
|
}
|
||||||
|
if (values.timeRange && values.timeRange.length === 2) {
|
||||||
|
// 开始时间正常取
|
||||||
|
params.startTime = values.timeRange[0].format('YYYY-MM-DD 00:00:00');
|
||||||
|
// 结束时间强制补 23:59:59
|
||||||
|
params.endTime = values.timeRange[1].format('YYYY-MM-DD 23:59:59');
|
||||||
|
}
|
||||||
|
if (values.orderStatus && values.orderStatus !== 'all') {
|
||||||
|
params.orderStatus = values.orderStatus;
|
||||||
|
}
|
||||||
|
if (values.keyword) {
|
||||||
|
params.keyword = values.keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
await getWorkOrderList(params);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理重置
|
||||||
|
const handleReset = () => {
|
||||||
|
queryForm.resetFields();
|
||||||
|
// 重置时也重置到第一页
|
||||||
|
setPagination({ ...pagination, current: 1 });
|
||||||
|
getWorkOrderList();
|
||||||
|
};
|
||||||
// 打开完成工单弹窗
|
// 打开完成工单弹窗
|
||||||
const openCompleteModal = () => {
|
const openCompleteModal = () => {
|
||||||
if (!selectedRowKey) return messageApi.warning('请先选择工单');
|
if (!selectedRowKey) return messageApi.warning('请先选择工单');
|
||||||
@@ -331,7 +427,7 @@ const WorkOrderPage = () => {
|
|||||||
...currentDetail,
|
...currentDetail,
|
||||||
id: values.id,
|
id: values.id,
|
||||||
orderNo: currentDetail?.orderNo,
|
orderNo: currentDetail?.orderNo,
|
||||||
orderStatus: 4, // 已完成
|
orderStatus: 3, // 已完成
|
||||||
actualStartTime: currentDetail?.actualStartTime || now,
|
actualStartTime: currentDetail?.actualStartTime || now,
|
||||||
actualEndTime: now,
|
actualEndTime: now,
|
||||||
handleResult: values.handleResult,
|
handleResult: values.handleResult,
|
||||||
@@ -530,7 +626,7 @@ const WorkOrderPage = () => {
|
|||||||
width: 80,
|
width: 80,
|
||||||
render: (p) => (
|
render: (p) => (
|
||||||
<Tag style={{ color: priorityConfig[p]?.color, background: priorityConfig[p]?.bg, border: `1px solid ${priorityConfig[p]?.color}`, borderRadius: 4 }}>
|
<Tag style={{ color: priorityConfig[p]?.color, background: priorityConfig[p]?.bg, border: `1px solid ${priorityConfig[p]?.color}`, borderRadius: 4 }}>
|
||||||
{priorityConfig[p]?.label}
|
{p}
|
||||||
</Tag>
|
</Tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -574,7 +670,15 @@ const WorkOrderPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: '0px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
|
<>
|
||||||
|
<style>{`
|
||||||
|
.ant-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
|
||||||
|
<div div style={{ padding: '0px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }
|
||||||
|
}>
|
||||||
<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 { background: #f8fafc; padding: 2px 4px !important; font-size: 12px; color: #4E5969; }
|
||||||
.compact-table .ant-table-tbody > tr > td { padding: 2px 4px !important; font-size: 12px; }
|
.compact-table .ant-table-tbody > tr > td { padding: 2px 4px !important; font-size: 12px; }
|
||||||
@@ -621,36 +725,34 @@ const WorkOrderPage = () => {
|
|||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
{/* 筛选栏 */}
|
{/* 筛选栏 */}
|
||||||
<Card bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ ...cardStyle, marginBottom: 8 }}>
|
<Card bordered={false} bodyStyle={{ padding: '8px 16px 0px 16px' }} style={{ ...cardStyle, marginBottom: 8 }}>
|
||||||
<Row gutter={[16, 12]} align="middle">
|
<Form form={queryForm} layout="inline">
|
||||||
<Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
|
<Form.Item name="orderType" label="工单类型">
|
||||||
<span className="filter-label">工单类型</span>
|
<Select style={{ width: 120 }} size="small" options={workOrderTypeOptions} allowClear showSearch optionFilterProp="label" filterOption={(input, option) => option.label.toLowerCase().includes(input.toLowerCase())} />
|
||||||
<Select style={{ width: 120 }} size="small" options={workOrderTypeOptions} allowClear showSearch optionFilterProp="label" filterOption={(input, option) => option.label.toLowerCase().includes(input.toLowerCase())}></Select>
|
</Form.Item>
|
||||||
</div></Col>
|
|
||||||
<Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
|
|
||||||
<span className="filter-label">优先级</span>
|
|
||||||
{/*<Select style={{ width: '100%' }} size="small" options={priorityOptions}></Select>*/}
|
|
||||||
</div></Col>
|
|
||||||
|
|
||||||
<Col xs={24} sm={16} md={8} xl={5}><div style={{ display: 'flex', alignItems: 'center' }}>
|
<Form.Item name="priorityLevel" label="优先级">
|
||||||
<span className="filter-label">时间范围</span>
|
<Select style={{ width: 120 }} size="small" options={errorLevelOptions} allowClear />
|
||||||
<RangePicker style={{ width: '100%' }} size="small" />
|
</Form.Item>
|
||||||
</div></Col>
|
|
||||||
<Col xs={12} sm={8} md={4} xl={3}><div style={{ display: 'flex', alignItems: 'center' }}>
|
<Form.Item name="timeRange" label="时间范围">
|
||||||
<span className="filter-label">状态</span>
|
<RangePicker style={{ width: 320 }} size="small" />
|
||||||
<Select defaultValue="all" style={{ width: '100%' }} size="small"><Option value="all">全部</Option></Select>
|
</Form.Item>
|
||||||
</div></Col>
|
|
||||||
<Col xs={24} sm={16} md={10} xl={4}><div style={{ display: 'flex', alignItems: 'center' }}>
|
<Form.Item name="orderStatus" label="状态" >
|
||||||
<span className="filter-label">关键词</span>
|
<Select style={{ width: 120 }} size="small" options={statusOptions} allowClear />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="keyword" label="关键词">
|
||||||
<Input placeholder="请输入工单编号/标题" prefix={<SearchOutlined />} size="small" />
|
<Input placeholder="请输入工单编号/标题" prefix={<SearchOutlined />} size="small" />
|
||||||
</div></Col>
|
</Form.Item>
|
||||||
<Col xs={24} sm={8} md={4} xl={3} style={{ textAlign: 'right' }}>
|
<Form.Item>
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small">重置</Button>
|
<Button size="small" onClick={handleReset}>重置</Button>
|
||||||
<Button type="primary" size="small" icon={<SearchOutlined />}>查询</Button>
|
<Button type="primary" size="small" icon={<SearchOutlined />} onClick={handleQuery}>查询</Button>
|
||||||
</Space>
|
</Space>
|
||||||
</Col>
|
</Form.Item>
|
||||||
</Row>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Row gutter={[8, 8]}>
|
<Row gutter={[8, 8]}>
|
||||||
@@ -699,12 +801,22 @@ const WorkOrderPage = () => {
|
|||||||
className="compact-table"
|
className="compact-table"
|
||||||
scroll={{ x: 'max-content' }}
|
scroll={{ x: 'max-content' }}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
// 给当前选中行添加高亮类名
|
||||||
|
rowClassName={(record) => record.id === selectedRowKey ? 'table-active-row' : ''}
|
||||||
onRow={(record) => ({
|
onRow={(record) => ({
|
||||||
onClick: () => handleRowSelect(record)
|
onClick: () => handleRowSelect(record)
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<div style={{ padding: '12px 16px', textAlign: 'right' }}>
|
<div style={{ padding: '12px 16px', textAlign: 'right' }}>
|
||||||
<Pagination size="small" total={workOrderTotal} showSizeChanger showQuickJumper />
|
<Pagination
|
||||||
|
size="small"
|
||||||
|
current={pagination.current}
|
||||||
|
pageSize={pagination.pageSize}
|
||||||
|
total={workOrderTotal}
|
||||||
|
showSizeChanger
|
||||||
|
showQuickJumper
|
||||||
|
onChange={handlePageChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
@@ -810,25 +922,115 @@ const WorkOrderPage = () => {
|
|||||||
<div style={{ marginBottom: 8 }}>
|
<div style={{ marginBottom: 8 }}>
|
||||||
<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 ? '80%' : (currentDetail?.orderStatus === 2 ? '66%' : '33%'), height: '100%', background: '#00B42A' }}></div>
|
||||||
</div>
|
</div>
|
||||||
{[
|
{(() => {
|
||||||
{ label: '已创建', step: 1, active: currentDetail?.orderStatus >= 1 },
|
const status = currentDetail?.orderStatus;
|
||||||
{ label: '已派发', step: 2, active: currentDetail?.orderStatus >= 2 },
|
// 流程节点
|
||||||
{ label: '执行中', step: 3, active: currentDetail?.orderStatus >= 2 },
|
const steps = [
|
||||||
{ label: '已完成', step: 4, active: currentDetail?.orderStatus >= 4 },
|
{ label: '已创建', step: 1 },
|
||||||
].map(item => (
|
{ label: '执行中', step: 2 },
|
||||||
<div key={item.step} style={{ textAlign: 'center', zIndex: 2, position: 'relative' }}>
|
{ label: '已挂起', step: 3 },
|
||||||
|
{ label: '已完成', step: 4 },
|
||||||
|
];
|
||||||
|
|
||||||
|
// 判断节点是否激活
|
||||||
|
const getStepActive = (item) => {
|
||||||
|
// 已完成:全部节点激活
|
||||||
|
if (status === 3) return true;
|
||||||
|
// 已挂起:点亮 已创建、执行中、已挂起
|
||||||
|
if (status === 4) return item.step <= 3;
|
||||||
|
// 执行中:点亮前2个
|
||||||
|
if (status === 2) return item.step <= 2;
|
||||||
|
// 待处理:只点亮第一个
|
||||||
|
if (status === 1) return item.step === 1;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 是否挂起状态(进度条灰色)
|
||||||
|
const isSuspend = status === 4;
|
||||||
|
|
||||||
|
// 进度条宽度 4个节点3段,每段33.33%
|
||||||
|
let progressWidth = '0%';
|
||||||
|
if (status === 1) progressWidth = '0%';
|
||||||
|
if (status === 2) progressWidth = '33.33%';
|
||||||
|
if (status === 3) progressWidth = '80%';
|
||||||
|
if (status === 4) progressWidth = '33.33%';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ marginBottom: 16, width: '100%' }}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 4px', position: 'relative' }}>
|
||||||
|
{/* 底层灰色轨道 */}
|
||||||
<div style={{
|
<div style={{
|
||||||
width: 24, height: 24, borderRadius: '50%', background: item.active ? '#00B42A' : '#fff',
|
position: 'absolute',
|
||||||
border: item.active ? 'none' : '2px solid #E5E6EB', color: item.active ? '#fff' : '#86909C',
|
top: 11,
|
||||||
display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 11, fontWeight: 700, margin: '0 auto'
|
left: '10%',
|
||||||
|
right: '10%',
|
||||||
|
height: 2,
|
||||||
|
background: '#E5E6EB',
|
||||||
|
zIndex: 1
|
||||||
|
}} />
|
||||||
|
{/* 进度填充 */}
|
||||||
|
<div style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 11,
|
||||||
|
left: '10%',
|
||||||
|
height: 2,
|
||||||
|
width: progressWidth,
|
||||||
|
background: isSuspend ? '#86909C' : '#00B42A',
|
||||||
|
zIndex: 1,
|
||||||
|
transition: 'width 0.3s ease'
|
||||||
|
}} />
|
||||||
|
|
||||||
|
{steps.map(item => {
|
||||||
|
const active = getStepActive(item);
|
||||||
|
// 已完成状态全部显示对勾
|
||||||
|
const isAllFinish = status === 3;
|
||||||
|
// 仅挂起状态下第三个节点显示暂停图标
|
||||||
|
const isSuspendDot = status === 4 && item.step === 3;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={item.step} style={{ textAlign: 'center', zIndex: 2, position: 'relative', width: '22%' }}>
|
||||||
|
<div style={{
|
||||||
|
width: 26,
|
||||||
|
height: 26,
|
||||||
|
borderRadius: '50%',
|
||||||
|
margin: '0 auto',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: 700,
|
||||||
|
// 仅中途挂起时 已挂起节点黄色,其余激活绿色
|
||||||
|
background: isSuspendDot ? '#F7BA1E' : (active ? '#00B42A' : '#fff'),
|
||||||
|
border: active ? 'none' : '2px solid #E5E6EB',
|
||||||
|
color: active ? '#fff' : '#86909C',
|
||||||
|
boxShadow: active ? '0 0 0 2px rgba(0,180,42,0.15)' : 'none'
|
||||||
}}>
|
}}>
|
||||||
{item.active ? <CheckOutlined /> : item.step}
|
{isAllFinish ? (
|
||||||
|
<CheckOutlined size={14} />
|
||||||
|
) : isSuspendDot ? (
|
||||||
|
<PauseOutlined size={14} />
|
||||||
|
) : (
|
||||||
|
item.step
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 11, marginTop: 8, color: item.active ? '#1D2129' : '#86909C', fontWeight: item.active ? 600 : 400 }}>{item?.label}</div>
|
<div style={{
|
||||||
|
fontSize: 11,
|
||||||
|
marginTop: 6,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
color: active ? '#1D2129' : '#86909C',
|
||||||
|
fontWeight: active ? 500 : 400
|
||||||
|
}}>
|
||||||
|
{item.label}
|
||||||
</div>
|
</div>
|
||||||
))}
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1076,6 +1278,9 @@ const WorkOrderPage = () => {
|
|||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div >
|
</div >
|
||||||
|
</>
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user