工单告警完善
This commit is contained in:
@@ -129,6 +129,7 @@ export default function AlarmCenterPage() {
|
||||
const [queryParams, setQueryParams] = useState({
|
||||
deviceId: '',
|
||||
alarmLevel: '',
|
||||
alarmType: '',
|
||||
handleStatus: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
@@ -198,7 +199,7 @@ export default function AlarmCenterPage() {
|
||||
const doHandle = async (values) => {
|
||||
try {
|
||||
await handleAlarm({
|
||||
id: currentAlarm.id,
|
||||
alarmId: currentAlarm.id,
|
||||
handleStatus: values.handleStatus,
|
||||
handleRemark: values.handleRemark || '已处理'
|
||||
});
|
||||
@@ -357,19 +358,20 @@ export default function AlarmCenterPage() {
|
||||
const day = dayjs(item.alarmTime).format('MM-DD');
|
||||
const level = String(item.alarmLevel);
|
||||
|
||||
if (!groupMap[day]) groupMap[day] = {};
|
||||
if (!groupMap[day]) groupMap[day] = { ERROR: 0, WARNING: 0, INFO: 0 };
|
||||
groupMap[day][level] = (groupMap[day][level] || 0) + 1;
|
||||
});
|
||||
|
||||
// 规整成图表一维数组
|
||||
// 直接返回 ERROR/WARNING/INFO 字段,匹配图表series key
|
||||
return Object.entries(groupMap).map(([date, obj]) => ({
|
||||
date,
|
||||
severe: obj['ERROR'] || 0, // 严重
|
||||
important: obj['WARNING'] || 0, // 重要
|
||||
normal: obj['INFO'] || 0, // 一般
|
||||
ERROR: obj.ERROR || 0,
|
||||
WARNING: obj.WARNING || 0,
|
||||
INFO: obj.INFO || 0,
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
const pieData = [
|
||||
{
|
||||
name: '错误',
|
||||
@@ -417,6 +419,19 @@ export default function AlarmCenterPage() {
|
||||
}
|
||||
};
|
||||
|
||||
// 联系负责人
|
||||
const handleContactUser = () => {
|
||||
// 自行实现:弹窗联系人列表、拨打电话、跳转聊天、弹窗信息等
|
||||
console.log('联系负责人', currentAlarm);
|
||||
};
|
||||
|
||||
// 派发工单
|
||||
const handleDispatchOrder = () => {
|
||||
// 自行实现:选择处理人、分配工单接口、弹窗派发表单
|
||||
console.log('派发工单', currentAlarm);
|
||||
};
|
||||
|
||||
|
||||
// 生成工单
|
||||
const handleaddOrder = async () => {
|
||||
if (!currentAlarm) {
|
||||
@@ -805,12 +820,15 @@ export default function AlarmCenterPage() {
|
||||
{/* 告警详情抽屉 */}
|
||||
<Drawer
|
||||
title="告警详情"
|
||||
//open={true}
|
||||
open={drawerVisible}
|
||||
onClose={() => setDrawerVisible(false)}
|
||||
width={480}
|
||||
destroyOnClose
|
||||
>
|
||||
|
||||
<Spin spinning={detailLoading}>
|
||||
|
||||
{currentAlarm && (
|
||||
<Form form={form} onFinish={doHandle} layout="vertical">
|
||||
<>
|
||||
@@ -867,11 +885,35 @@ export default function AlarmCenterPage() {
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<Button type="primary" onClick={handleaddOrder}>生成工单</Button>
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 12 }}>
|
||||
<Button type="default" onClick={handleContactUser}>联系负责人</Button>
|
||||
<Button type="primary" onClick={handleaddOrder}>
|
||||
生成工单
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 处理操作 */}
|
||||
<Card size="small" title="处理操作" style={{ marginBottom: 16 }}>
|
||||
<Form.Item label="处理状态" name="handleStatus" rules={[{ required: true, message: '请选择处理状态' }]}>
|
||||
<Select>
|
||||
<Option value={1}>待处理</Option>
|
||||
<Option value={2}>处理中</Option>
|
||||
<Option value={3}>已关闭</Option>
|
||||
<Option value={4}>已忽略</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label="处理备注" name="handleRemark">
|
||||
<Input.TextArea rows={2} placeholder="请输入处理备注" />
|
||||
</Form.Item>
|
||||
</Card>
|
||||
|
||||
|
||||
{/* 底部按钮 */}
|
||||
<Button type="primary" block htmlType="submit">确认处理</Button>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -922,12 +964,11 @@ export default function AlarmCenterPage() {
|
||||
rules={[{ required: true, message: '请选择告警类型' }]}
|
||||
>
|
||||
<Select>
|
||||
<Option value={1}>设备故障</Option>
|
||||
<Option value={2}>数据异常</Option>
|
||||
<Option value={3}>通信中断</Option>
|
||||
<Option value={4}>性能告警</Option>
|
||||
<Option value={5}>安全告警</Option>
|
||||
<Option value={6}>环境告警</Option>
|
||||
<Option value="UAV_FAULT">无人机故障</Option>
|
||||
<Option value="MOWER_FAULT">割草机故障</Option>
|
||||
<Option value="OTHER_DEVICE_FAULT">其他设备故障</Option>
|
||||
<Option value="SERVER_FAILURE">服务器故障</Option>
|
||||
<Option value="SYSTEM_ERROR">系统错误</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user