告警和 工单细节优化
This commit is contained in:
@@ -227,7 +227,7 @@ export default function DeviceManagementPage() {
|
|||||||
siteId: stationId,
|
siteId: stationId,
|
||||||
orgId: userInfo.orgId,
|
orgId: userInfo.orgId,
|
||||||
runSpeed: values.runSpeed,
|
runSpeed: values.runSpeed,
|
||||||
id: paramData.id,
|
id: paramData?.id,
|
||||||
};
|
};
|
||||||
const res = await deviceRunParamSave(payload);
|
const res = await deviceRunParamSave(payload);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
|||||||
@@ -213,9 +213,7 @@ const AlarmHistory = () => {
|
|||||||
<Form.Item name="handleStatus" label="处理状态">
|
<Form.Item name="handleStatus" label="处理状态">
|
||||||
<Select placeholder="全部" style={{ width: 130 }} allowClear>
|
<Select placeholder="全部" style={{ width: 130 }} allowClear>
|
||||||
<Option value={1}>待处理</Option>
|
<Option value={1}>待处理</Option>
|
||||||
<Option value={2}>处理中</Option>
|
<Option value={2}>已关闭</Option>
|
||||||
<Option value={3}>已关闭</Option>
|
|
||||||
<Option value={4}>已忽略</Option>
|
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
ExclamationOutlined
|
ExclamationOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { errorLevelOptions, exportTable, levelColorMap } from "../../lib/utils.js"
|
import { alarmHandleResultOptions, errorLevelOptions, exportTable, levelColorMap } from "../../lib/utils.js"
|
||||||
|
|
||||||
// 接口引入
|
// 接口引入
|
||||||
import {
|
import {
|
||||||
@@ -111,13 +111,17 @@ export default function AlarmCenterPage() {
|
|||||||
// ========== 新增:工单弹窗状态 & 表单 ==========
|
// ========== 新增:工单弹窗状态 & 表单 ==========
|
||||||
const [createOrderModalVisible, setCreateOrderModalVisible] = useState(false);
|
const [createOrderModalVisible, setCreateOrderModalVisible] = useState(false);
|
||||||
const [orderForm] = Form.useForm();
|
const [orderForm] = Form.useForm();
|
||||||
|
// 图表使用:满足筛选条件的【全部告警明细】,不受分页限制
|
||||||
|
const [allAlarmForChart, setAllAlarmForChart] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const [queryParams, setQueryParams] = useState({
|
const [queryParams, setQueryParams] = useState({
|
||||||
|
siteId: stationId,
|
||||||
deviceId: '',
|
deviceId: '',
|
||||||
alarmLevel: '',
|
alarmLevel: '',
|
||||||
alarmType: '',
|
alarmType: '',
|
||||||
handleStatus: '',
|
handleStatus: 1,
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
});
|
});
|
||||||
@@ -153,12 +157,30 @@ export default function AlarmCenterPage() {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 获取【全部满足筛选条件告警明细】,专门给趋势图使用,不分页
|
||||||
|
const fetchChartAllAlarm = async () => {
|
||||||
|
try {
|
||||||
|
// pageSize 给超大值,拉取当前筛选条件下所有告警
|
||||||
|
const res = await getAlarmList({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 99999,
|
||||||
|
...queryParams,
|
||||||
|
siteId: stationId,
|
||||||
|
handleStatus: queryParams.handleStatus
|
||||||
|
});
|
||||||
|
if (res.code === 200) {
|
||||||
|
setAllAlarmForChart(res.rows || []);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('加载图表告警数据失败', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ====================== 获取统计(带上查询条件) ======================
|
// ====================== 获取统计(带上查询条件) ======================
|
||||||
const fetchStat = async () => {
|
const fetchStat = async () => {
|
||||||
try {
|
try {
|
||||||
// 把查询条件一起传给统计接口
|
// 把查询条件一起传给统计接口
|
||||||
const res = await getAlarmStatistics(queryParams);
|
const res = await getAlarmStatistics({ ...queryParams, handleStatus: "", siteId: stationId });
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
setStatData(res.data || {});
|
setStatData(res.data || {});
|
||||||
}
|
}
|
||||||
@@ -191,6 +213,7 @@ export default function AlarmCenterPage() {
|
|||||||
await handleAlarm({
|
await handleAlarm({
|
||||||
alarmId: currentAlarm.id,
|
alarmId: currentAlarm.id,
|
||||||
handleStatus: values.handleStatus,
|
handleStatus: values.handleStatus,
|
||||||
|
handleResult: values.handleResult,
|
||||||
handleRemark: values.handleRemark || '已处理',
|
handleRemark: values.handleRemark || '已处理',
|
||||||
rootCause: values.rootCause || '无'
|
rootCause: values.rootCause || '无'
|
||||||
});
|
});
|
||||||
@@ -249,8 +272,9 @@ export default function AlarmCenterPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchTodayAndYesterdayStat();
|
fetchTodayAndYesterdayStat();
|
||||||
fetchStat();
|
fetchStat();
|
||||||
|
fetchChartAllAlarm();
|
||||||
|
|
||||||
}, []);
|
}, [stationId]);
|
||||||
|
|
||||||
// ====================== 表格列 ======================
|
// ====================== 表格列 ======================
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -301,12 +325,9 @@ export default function AlarmCenterPage() {
|
|||||||
render: (s) => {
|
render: (s) => {
|
||||||
let color = 'default';
|
let color = 'default';
|
||||||
const text = handleStatusMap[s] || '-';
|
const text = handleStatusMap[s] || '-';
|
||||||
// 1:待处理 2:处理中 3:已关闭 4:已忽略
|
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case 1: color = 'orange'; break; // 待处理
|
case 1: color = 'orange'; break; // 待处理
|
||||||
case 2: color = 'blue'; break; // 处理中
|
case 2: color = 'green'; break; // 已关闭
|
||||||
case 3: color = 'green'; break; // 已关闭
|
|
||||||
case 4: color = 'default'; break; // 已忽略
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return <Tag color={color}>{text}</Tag>;
|
return <Tag color={color}>{text}</Tag>;
|
||||||
@@ -339,11 +360,12 @@ export default function AlarmCenterPage() {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
// 按日期+告警级别分组统计趋势数据
|
// 按日期+告警级别分组统计趋势数据
|
||||||
|
// 按日期+告警级别分组统计趋势数据(使用全量告警,不受分页影响)
|
||||||
const getAlarmTrendData = () => {
|
const getAlarmTrendData = () => {
|
||||||
if (!alarmList.length) return [];
|
if (!allAlarmForChart.length) return [];
|
||||||
const groupMap = {};
|
const groupMap = {};
|
||||||
|
|
||||||
alarmList.forEach(item => {
|
allAlarmForChart.forEach(item => {
|
||||||
if (!item.alarmTime || !item.alarmLevel) return;
|
if (!item.alarmTime || !item.alarmLevel) return;
|
||||||
const day = dayjs(item.alarmTime).format('MM-DD');
|
const day = dayjs(item.alarmTime).format('MM-DD');
|
||||||
const level = String(item.alarmLevel);
|
const level = String(item.alarmLevel);
|
||||||
@@ -352,7 +374,6 @@ export default function AlarmCenterPage() {
|
|||||||
groupMap[day][level] = (groupMap[day][level] || 0) + 1;
|
groupMap[day][level] = (groupMap[day][level] || 0) + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 直接返回 ERROR/WARNING/INFO 字段,匹配图表series key
|
|
||||||
return Object.entries(groupMap).map(([date, obj]) => ({
|
return Object.entries(groupMap).map(([date, obj]) => ({
|
||||||
date,
|
date,
|
||||||
ERROR: obj.ERROR || 0,
|
ERROR: obj.ERROR || 0,
|
||||||
@@ -361,6 +382,7 @@ export default function AlarmCenterPage() {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const pieData = [
|
const pieData = [
|
||||||
{
|
{
|
||||||
name: '错误',
|
name: '错误',
|
||||||
@@ -387,6 +409,7 @@ export default function AlarmCenterPage() {
|
|||||||
const todayRes = await getAlarmStatistics({
|
const todayRes = await getAlarmStatistics({
|
||||||
startTime: `${today} 00:00:00`,
|
startTime: `${today} 00:00:00`,
|
||||||
endTime: `${today} 23:59:59`,
|
endTime: `${today} 23:59:59`,
|
||||||
|
siteId: stationId,
|
||||||
});
|
});
|
||||||
if (todayRes.code === 200) {
|
if (todayRes.code === 200) {
|
||||||
setTodayData(todayRes.data || {});
|
setTodayData(todayRes.data || {});
|
||||||
@@ -396,6 +419,8 @@ export default function AlarmCenterPage() {
|
|||||||
const yesterdayRes = await getAlarmStatistics({
|
const yesterdayRes = await getAlarmStatistics({
|
||||||
startTime: `${yesterday} 00:00:00`,
|
startTime: `${yesterday} 00:00:00`,
|
||||||
endTime: `${yesterday} 23:59:59`,
|
endTime: `${yesterday} 23:59:59`,
|
||||||
|
siteId: stationId,
|
||||||
|
|
||||||
});
|
});
|
||||||
if (yesterdayRes.code === 200) {
|
if (yesterdayRes.code === 200) {
|
||||||
const yData = yesterdayRes.data || {};
|
const yData = yesterdayRes.data || {};
|
||||||
@@ -513,7 +538,7 @@ export default function AlarmCenterPage() {
|
|||||||
bg: '#FFF1F0'
|
bg: '#FFF1F0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '严重告警',
|
title: '今日严重告警',
|
||||||
value: todayData.levelStats?.["ERROR"] || 0,
|
value: todayData.levelStats?.["ERROR"] || 0,
|
||||||
trend: (() => {
|
trend: (() => {
|
||||||
const now = todayData.levelStats?.["ERROR"] ?? 0;
|
const now = todayData.levelStats?.["ERROR"] ?? 0;
|
||||||
@@ -536,30 +561,30 @@ export default function AlarmCenterPage() {
|
|||||||
bg: '#FFF1F0'
|
bg: '#FFF1F0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '处理中',
|
title: '今日待处理',
|
||||||
value: todayData.processing || 0,
|
value: todayData.pending || 0,
|
||||||
trend: (() => {
|
trend: (() => {
|
||||||
const now = todayData.processing ?? 0;
|
const now = todayData.pending ?? 0;
|
||||||
const last = yesterdayData.processing ?? 0;
|
const last = yesterdayData.pending ?? 0;
|
||||||
if (last === 0) return '较昨日 无变化';
|
if (last === 0) return '较昨日 无变化';
|
||||||
const rateNum = ((now - last) / last) * 100;
|
const rateNum = ((now - last) / last) * 100;
|
||||||
const rateStr = rateNum.toFixed(1);
|
const rateStr = rateNum.toFixed(1);
|
||||||
return rateNum > 0 ? `较昨日 +${rateStr}% ↑` : rateNum < 0 ? `较昨日 ${rateStr}% ↓` : '较昨日 0%';
|
return rateNum > 0 ? `较昨日 +${rateStr}% ↑` : rateNum < 0 ? `较昨日 ${rateStr}% ↓` : '较昨日 0%';
|
||||||
})(),
|
})(),
|
||||||
trendColor: (() => {
|
trendColor: (() => {
|
||||||
const now = todayData.processing ?? 0;
|
const now = todayData.pending ?? 0;
|
||||||
const last = yesterdayData.processing ?? 0;
|
const last = yesterdayData.pending ?? 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.processing || 0}`,
|
subText: `昨日 ${yesterdayData.pending || 0}`,
|
||||||
icon: <ClockCircleOutlined />,
|
icon: <ClockCircleOutlined />,
|
||||||
color: '#FA8C16',
|
color: '#FA8C16',
|
||||||
bg: '#FFF7E8'
|
bg: '#FFF7E8'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '已关闭',
|
title: '今日已关闭',
|
||||||
value: todayData.closed || 0,
|
value: todayData.closed || 0,
|
||||||
trend: (() => {
|
trend: (() => {
|
||||||
const now = todayData.closed ?? 0;
|
const now = todayData.closed ?? 0;
|
||||||
@@ -644,8 +669,7 @@ export default function AlarmCenterPage() {
|
|||||||
onChange={v => setQueryParams({ ...queryParams, handleStatus: v })}
|
onChange={v => setQueryParams({ ...queryParams, handleStatus: v })}
|
||||||
options={[
|
options={[
|
||||||
{ value: 1, label: '待处理' },
|
{ value: 1, label: '待处理' },
|
||||||
{ value: 2, label: '处理中' },
|
{ value: 2, label: '已关闭' },
|
||||||
{ value: 3, label: '已关闭' },
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -689,13 +713,15 @@ export default function AlarmCenterPage() {
|
|||||||
<Col style={{ alignSelf: 'flex-end' }}>
|
<Col style={{ alignSelf: 'flex-end' }}>
|
||||||
<Space>
|
<Space>
|
||||||
<Button style={{ borderRadius: 8 }} onClick={() => {
|
<Button style={{ borderRadius: 8 }} onClick={() => {
|
||||||
setQueryParams({ deviceId: '', alarmLevel: '', handleStatus: '', startTime: '', endTime: '' });
|
setQueryParams({ ...queryParams, deviceId: '', alarmLevel: '', handleStatus: 1, startTime: '', endTime: '' });
|
||||||
fetchList();
|
fetchList();
|
||||||
fetchStat();
|
fetchStat();
|
||||||
|
fetchChartAllAlarm(); // 新增:刷新图表全量告警
|
||||||
}}>重置</Button>
|
}}>重置</Button>
|
||||||
<Button type="primary" style={{ borderRadius: 8, background: '#165DFF' }} onClick={() => {
|
<Button type="primary" style={{ borderRadius: 8, background: '#165DFF' }} onClick={() => {
|
||||||
fetchList(); // 刷新列表
|
fetchList(); // 刷新列表
|
||||||
fetchStat(); // 刷新统计
|
fetchStat(); // 刷新统计
|
||||||
|
fetchChartAllAlarm(); // 新增:刷新图表全量告警
|
||||||
}}>
|
}}>
|
||||||
<SearchOutlined />查询
|
<SearchOutlined />查询
|
||||||
</Button>
|
</Button>
|
||||||
@@ -790,10 +816,7 @@ export default function AlarmCenterPage() {
|
|||||||
name: '待处理',
|
name: '待处理',
|
||||||
pending: statData.pending || 0,
|
pending: statData.pending || 0,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: '处理中',
|
|
||||||
pending: statData.processing || 0,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: '已关闭',
|
name: '已关闭',
|
||||||
pending: statData.closed || 0,
|
pending: statData.closed || 0,
|
||||||
@@ -895,11 +918,16 @@ export default function AlarmCenterPage() {
|
|||||||
<Form.Item label="处理状态" name="handleStatus" rules={[{ required: true, message: '请选择处理状态' }]}>
|
<Form.Item label="处理状态" name="handleStatus" rules={[{ required: true, message: '请选择处理状态' }]}>
|
||||||
<Select>
|
<Select>
|
||||||
<Option value={1}>待处理</Option>
|
<Option value={1}>待处理</Option>
|
||||||
<Option value={2}>处理中</Option>
|
|
||||||
<Option value={3}>已关闭</Option>
|
<Option value={2}>已关闭</Option>
|
||||||
<Option value={4}>已忽略</Option>
|
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label="处理结果" name="handleResult" rules={[{ required: true, message: '请选择确认处理结果' }]}>
|
||||||
|
<Select
|
||||||
|
placeholder="请选择确认处理结果"
|
||||||
|
options={alarmHandleResultOptions}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item label="根因分析" name="rootCause">
|
<Form.Item label="根因分析" name="rootCause">
|
||||||
<Input.TextArea rows={2} placeholder="请输入处理备注" />
|
<Input.TextArea rows={2} placeholder="请输入处理备注" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ export const alarmLevelConfig = {
|
|||||||
|
|
||||||
export const handleStatusMap = {
|
export const handleStatusMap = {
|
||||||
1: '待处理',
|
1: '待处理',
|
||||||
2: '处理中',
|
2: '已关闭',
|
||||||
3: '已关闭',
|
|
||||||
4: '已忽略'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -337,3 +337,12 @@ export const levelColorMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 告警处理结果枚举(和后端AlarmHandleResult保持一致)
|
||||||
|
export const alarmHandleResultOptions = [
|
||||||
|
{ value: "Handled", label: "已处理" },
|
||||||
|
{ value: "Restored", label: "已恢复" },
|
||||||
|
{ value: "Ignored", label: "已忽略" },
|
||||||
|
{ value: "UnableToHandle", label: "无法处理" },
|
||||||
|
{ value: "ManufacturerHandling", label: "厂家处理中" },
|
||||||
|
{ value: "FalseAlarm", label: "误报" },
|
||||||
|
];
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
BranchesOutlined,
|
BranchesOutlined,
|
||||||
RobotOutlined
|
RobotOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Line, Bar, Pie } from '@ant-design/charts';
|
import { Line, Bar, Pie } from '@ant-design/charts';
|
||||||
import CesiumMap from '../components/Map';
|
import CesiumMap from '../components/Map';
|
||||||
import { getWeatherData, getWeatherType } from '../lib/utils';
|
import { getWeatherData, getWeatherType } from '../lib/utils';
|
||||||
@@ -24,6 +25,8 @@ import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../com
|
|||||||
// 👇 在这里引入你的工单接口(改成你真实的接口地址)
|
// 👇 在这里引入你的工单接口(改成你真实的接口地址)
|
||||||
import { addWorkOrder } from '../api/workOrder';
|
import { addWorkOrder } from '../api/workOrder';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
import { getAlarmList } from '../api/alarmApi';
|
||||||
|
import { RootState } from '../store';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
@@ -34,6 +37,9 @@ export default function StationDashboard() {
|
|||||||
// 👇 获取当前选中的电站(从redux拿,修复缺失)
|
// 👇 获取当前选中的电站(从redux拿,修复缺失)
|
||||||
const { currentStation } = useSelector((state) => state.station);
|
const { currentStation } = useSelector((state) => state.station);
|
||||||
const { userInfo } = useSelector((state) => state.user);
|
const { userInfo } = useSelector((state) => state.user);
|
||||||
|
const { stationId } = useSelector((state: RootState) => state.station);
|
||||||
|
const [alarmList, setAlarmList] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
// 天气数据
|
// 天气数据
|
||||||
const [weatherdata, setWeatherData] = useState({
|
const [weatherdata, setWeatherData] = useState({
|
||||||
@@ -75,11 +81,9 @@ export default function StationDashboard() {
|
|||||||
alarmCount: 8,
|
alarmCount: 8,
|
||||||
costSaved: 36540
|
costSaved: 36540
|
||||||
};
|
};
|
||||||
|
// 组件内部
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const realtimeAlerts = [
|
|
||||||
{ level: "INFO", type: "设备离线", time: "04-28 18:44" },
|
|
||||||
{ level: "严重", type: "逆变器温度过高", time: "04-28 18:44" }
|
|
||||||
];
|
|
||||||
|
|
||||||
const deviceStatus = [
|
const deviceStatus = [
|
||||||
{ name: "汇流箱", count: "2/2", status: "异常 1" },
|
{ name: "汇流箱", count: "2/2", status: "异常 1" },
|
||||||
@@ -203,6 +207,27 @@ export default function StationDashboard() {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const fetchList = async () => {
|
||||||
|
try {
|
||||||
|
const data = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 999999,
|
||||||
|
siteId: stationId
|
||||||
|
}
|
||||||
|
const res = await getAlarmList(data);
|
||||||
|
if (res.code === 200) {
|
||||||
|
setAlarmList(res?.rows || []);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
messageApi.error('加载失败');
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
fetchList()
|
||||||
|
}, [stationId])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -218,7 +243,7 @@ export default function StationDashboard() {
|
|||||||
{ title: '当前功率', value: '812.6', unit: 'kW', sub: '装机容量 1,000 kWp', color: '#165DFF', bg: '#E8F3FF', icon: <DashboardOutlined /> },
|
{ title: '当前功率', value: '812.6', unit: 'kW', sub: '装机容量 1,000 kWp', color: '#165DFF', bg: '#E8F3FF', icon: <DashboardOutlined /> },
|
||||||
{ title: 'Performance Ratio', value: '82.6%', unit: '', sub: '昨日 81.3% ↑1.3%', color: '#00B42A', bg: '#E8FFEA', icon: <BarChartOutlined /> },
|
{ title: 'Performance Ratio', value: '82.6%', unit: '', sub: '昨日 81.3% ↑1.3%', color: '#00B42A', bg: '#E8FFEA', icon: <BarChartOutlined /> },
|
||||||
{ title: '系统可用率', value: '99.35%', unit: '', sub: '昨日 99.12% ↑0.23%', color: '#165DFF', bg: '#E8F3FF', icon: <RiseOutlined /> },
|
{ title: '系统可用率', value: '99.35%', unit: '', sub: '昨日 99.12% ↑0.23%', color: '#165DFF', bg: '#E8F3FF', icon: <RiseOutlined /> },
|
||||||
{ title: '告警数量', value: '8', unit: '', sub: '未处理 5 / 已处理 3', color: '#F53F3F', bg: '#FFF1F0', icon: <BellOutlined /> },
|
{ title: '告警数量', value: alarmList.length, unit: '', sub: `未处理 ${alarmList.filter(item => item.handleStatus == 1).length} / 已关闭 ${alarmList.filter(item => item.handleStatus == 2).length}`, color: '#F53F3F', bg: '#FFF1F0', icon: <BellOutlined /> },
|
||||||
{ title: '节省运维成本', value: '¥ 36,540', unit: '', sub: '本月累计节省', color: '#FF7D00', bg: '#FFF7E8', icon: <MoneyCollectOutlined /> },
|
{ title: '节省运维成本', value: '¥ 36,540', unit: '', sub: '本月累计节省', color: '#FF7D00', bg: '#FFF7E8', icon: <MoneyCollectOutlined /> },
|
||||||
].map((item, idx) => (
|
].map((item, idx) => (
|
||||||
<Col key={idx} style={{
|
<Col key={idx} style={{
|
||||||
@@ -414,25 +439,25 @@ export default function StationDashboard() {
|
|||||||
{/* 右侧 */}
|
{/* 右侧 */}
|
||||||
<Col xs={24} xl={6}>
|
<Col xs={24} xl={6}>
|
||||||
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
||||||
<Card title={<span style={{ fontWeight: 800 }}>实时告警</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
<Card title={<span style={{ fontWeight: 800 }}>实时告警</span>} extra={<Button type="link" size="small" onClick={() => navigate('/alerts')}>更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12, padding: '0 4px 8px', borderBottom: '1px solid #f0f0f0', fontSize: 13, color: '#666' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12, padding: '0 4px 8px', borderBottom: '1px solid #f0f0f0', fontSize: 13, color: '#666' }}>
|
||||||
<span style={{ flex: 3 }}>告警内容</span>
|
<span style={{ flex: 3 }}>告警内容</span>
|
||||||
<span style={{ flex: 1, textAlign: 'center' }}>级别</span>
|
<span style={{ flex: 1, textAlign: 'center' }}>级别</span>
|
||||||
<span style={{ flex: 1.5, textAlign: 'right' }}>发生时间</span>
|
<span style={{ flex: 1.5, textAlign: 'right' }}>发生时间</span>
|
||||||
</div>
|
</div>
|
||||||
{realtimeAlerts.map((alert, idx) => {
|
{alarmList.slice(0, 2).map((alert, idx) => {
|
||||||
let dotColor = alert.level === '严重' ? '#ff4d4f' : alert.level === '重要' ? '#fa8c16' : '#1677ff';
|
let dotColor = alert.alarmLevel === 'ERROR' ? '#ff4d4f' : alert.alarmLevel === 'WARNING' ? '#fa8c16' : '#1677ff';
|
||||||
let tagColor = alert.level === '严重' ? 'error' : alert.level === '重要' ? 'warning' : 'processing';
|
let tagColor = alert.alarmLevel === 'ERROR' ? 'error' : alert.alarmLevel === 'WARNING' ? 'warning' : 'processing';
|
||||||
return (
|
return (
|
||||||
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12, padding: '0 4px', borderBottom: idx < realtimeAlerts.length - 1 ? '1px solid #f5f5f5' : 'none', paddingBottom: 8 }}>
|
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12, padding: '0 4px', borderBottom: idx < 1 ? '1px solid #f5f5f5' : 'none', paddingBottom: 8 }}>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', flex: 3, minWidth: 0 }}>
|
<div style={{ display: 'flex', alignItems: 'center', flex: 3, minWidth: 0 }}>
|
||||||
<div style={{ width: 12, height: 12, borderRadius: '50%', backgroundColor: dotColor, marginRight: 8, flexShrink: 0 }} />
|
<div style={{ width: 12, height: 12, borderRadius: '50%', backgroundColor: dotColor, marginRight: 8, flexShrink: 0 }} />
|
||||||
<span style={{ fontSize: 13, fontWeight: 500 }}>{alert.type}</span>
|
<span style={{ fontSize: 13, fontWeight: 500 }}>{alert.alarmTitle}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ flex: 1, textAlign: 'center' }}>
|
<div style={{ flex: 1, textAlign: 'center' }}>
|
||||||
<Tag color={tagColor} style={{ fontSize: 12 }}>{alert.level}</Tag>
|
<Tag color={tagColor} style={{ fontSize: 12 }}>{alert.alarmLevel}</Tag>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ flex: 1.5, textAlign: 'right', fontSize: 13 }}>{alert.time}</div>
|
<div style={{ flex: 1.5, textAlign: 'right', fontSize: 13 }}>{alert.createTime}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -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, Popconfirm
|
Statistic, Modal, message, Empty, Drawer, Descriptions, Timeline, Divider, Form, Tabs, Progress, Badge, DatePicker, Pagination, Popconfirm, Image
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import {
|
import {
|
||||||
CheckOutlined, ClockCircleOutlined, ControlOutlined,
|
CheckOutlined, ClockCircleOutlined, ControlOutlined,
|
||||||
@@ -243,9 +243,9 @@ const WorkOrderPage = () => {
|
|||||||
if (item.orderStatus === 2 || item.orderStatus === 5) running++;
|
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++;
|
finishCount++;
|
||||||
const costMin = dayjs(item.actualEndTime).diff(dayjs(item.actualStartTime), 'minute');
|
const costMin = dayjs(item.actualEndTime).diff(dayjs(item.createTime), 'minute');
|
||||||
totalCostHour += costMin / 60;
|
totalCostHour += costMin / 60;
|
||||||
allFinishOrder.push(item);
|
allFinishOrder.push(item);
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,9 @@ const WorkOrderPage = () => {
|
|||||||
const queryParams = {
|
const queryParams = {
|
||||||
...params,
|
...params,
|
||||||
pageNum: pagination.current,
|
pageNum: pagination.current,
|
||||||
pageSize: pagination.pageSize
|
pageSize: pagination.pageSize,
|
||||||
|
siteId: stationId,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const res = await getWorkOrderApi(queryParams);
|
const res = await getWorkOrderApi(queryParams);
|
||||||
@@ -494,7 +496,9 @@ const WorkOrderPage = () => {
|
|||||||
|
|
||||||
const values = queryForm.getFieldsValue();
|
const values = queryForm.getFieldsValue();
|
||||||
console.log('查询表单值:', values);
|
console.log('查询表单值:', values);
|
||||||
const params: any = {};
|
const params = {
|
||||||
|
siteId: stationId,
|
||||||
|
};
|
||||||
|
|
||||||
if (values.orderType) {
|
if (values.orderType) {
|
||||||
params.orderType = values.orderType;
|
params.orderType = values.orderType;
|
||||||
@@ -1136,24 +1140,84 @@ const WorkOrderPage = () => {
|
|||||||
</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 }}>{sourceTypeMap[currentDetail?.sourceType] || '--'}</span></Col>
|
<Col span={12}>
|
||||||
<Col span={12}><span style={{ fontSize: 12 }}>工单类型:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{getWorkOrderTypeText(currentDetail?.orderType)}</span></Col>
|
<span style={{ fontSize: 12 }}>来源:</span>
|
||||||
<Col span={24}><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 }}>
|
<span style={{ fontSize: 12, fontWeight: 500 }}>
|
||||||
{currentDetail?.actualStartTime}
|
{currentDetail?.actualStartTime || '--'}
|
||||||
</span>
|
</span>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}><span style={{ fontSize: 12 }}>关联设备:</span><span style={{ fontSize: 12, color: '#165DFF', fontWeight: 600 }}>{currentDetail?.deviceName || '无'}</span></Col>
|
<Col span={24}>
|
||||||
<Col span={12}><span style={{ fontSize: 12 }}>关联区域:</span><span style={{ fontSize: 12, fontWeight: 500 }}>{currentDetail?.siteName || '无'}</span></Col>
|
<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}>
|
<Col span={12}>
|
||||||
<span style={{ fontSize: 12 }}>当前状态:</span>
|
<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>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<span style={{ fontSize: 12 }}>任务描述:</span>
|
<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>
|
</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>
|
</Row>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ marginBottom: 8 }}>
|
<div style={{ marginBottom: 8 }}>
|
||||||
@@ -1618,11 +1682,10 @@ const WorkOrderPage = () => {
|
|||||||
dataIndex: 'handleStatus',
|
dataIndex: 'handleStatus',
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (s) => {
|
render: (s) => {
|
||||||
const map = { 1: '待处理', 2: '处理中', 3: '已关闭', 4: '已忽略' };
|
const map = { 1: '待处理', 2: '已关闭', };
|
||||||
let tagColor = 'default';
|
let tagColor = 'default';
|
||||||
if (s === 1) tagColor = 'orange';
|
if (s === 1) tagColor = 'orange';
|
||||||
if (s === 2) tagColor = 'blue';
|
if (s === 2) tagColor = 'green';
|
||||||
if (s === 3) tagColor = 'green';
|
|
||||||
return <Tag color={tagColor}>{map[s] || '-'}</Tag>;
|
return <Tag color={tagColor}>{map[s] || '-'}</Tag>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user