xx
This commit is contained in:
@@ -53,10 +53,11 @@ export function deleteAlarm(ids) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 7. 告警统计
|
// 7. 告警统计
|
||||||
export function getAlarmStatistics() {
|
export function getAlarmStatistics(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/iot/alarm/statistics',
|
url: '/iot/alarm/statistics',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,16 +95,16 @@ export default function AlarmCenterPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ====================== 获取统计 ======================
|
// ====================== 获取统计(带上查询条件) ======================
|
||||||
const fetchStat = async () => {
|
const fetchStat = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getAlarmStatistics();
|
// 把查询条件一起传给统计接口
|
||||||
|
const res = await getAlarmStatistics(queryParams);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
setStatData(res.data || {});
|
setStatData(res.data || {});
|
||||||
}
|
}
|
||||||
} catch (err) { }
|
} catch (err) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
// ====================== 查看详情 ======================
|
// ====================== 查看详情 ======================
|
||||||
const showDetail = async (id) => {
|
const showDetail = async (id) => {
|
||||||
setDetailLoading(true);
|
setDetailLoading(true);
|
||||||
@@ -184,7 +184,6 @@ export default function AlarmCenterPage() {
|
|||||||
// 加载
|
// 加载
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchList();
|
fetchList();
|
||||||
fetchStat();
|
|
||||||
}, [pageNum]);
|
}, [pageNum]);
|
||||||
|
|
||||||
// ====================== 表格列 ======================
|
// ====================== 表格列 ======================
|
||||||
@@ -524,8 +523,12 @@ export default function AlarmCenterPage() {
|
|||||||
<Button style={{ borderRadius: 8 }} onClick={() => {
|
<Button style={{ borderRadius: 8 }} onClick={() => {
|
||||||
setQueryParams({ deviceId: '', alarmLevel: '', handleStatus: '', startTime: '', endTime: '' });
|
setQueryParams({ deviceId: '', alarmLevel: '', handleStatus: '', startTime: '', endTime: '' });
|
||||||
fetchList();
|
fetchList();
|
||||||
|
fetchStat();
|
||||||
}}>重置</Button>
|
}}>重置</Button>
|
||||||
<Button type="primary" style={{ borderRadius: 8, background: '#165DFF' }} onClick={fetchList}>
|
<Button type="primary" style={{ borderRadius: 8, background: '#165DFF' }} onClick={() => {
|
||||||
|
fetchList(); // 刷新列表
|
||||||
|
fetchStat(); // 刷新统计
|
||||||
|
}}>
|
||||||
<SearchOutlined />查询
|
<SearchOutlined />查询
|
||||||
</Button>
|
</Button>
|
||||||
<Button style={{ borderRadius: 8 }} onClick={doExport}>
|
<Button style={{ borderRadius: 8 }} onClick={doExport}>
|
||||||
|
|||||||
Reference in New Issue
Block a user