+
+ 告警详情
+ }
+ onClick={() => setShowDetail(false)}
+ style={{ fontSize: 16 }}
+ />
+
-
-
-
- {selectedAlert.content}
- {selectedAlert.level}
-
-
告警编号 AL20250525001
+
+
+ {selectedAlert.content}
+ {selectedAlert.level}
-
-
来源设备:{selectedAlert.device}(设备类型:逆变器)
-
发生时间:{selectedAlert.time} | 持续时长:{selectedAlert.duration}
-
处理状态:{selectedAlert.status} | 负责人:{selectedAlert.handler}
-
当前处理人:{selectedAlert.handler}({selectedAlert.time.split(' ')[0]} 接收)
-
告警描述:逆变器因内部故障自动停机,当前无功率输出。
+
+
告警编号:{selectedAlert.id}
+
来源设备:{selectedAlert.device}
+
发生时间:{selectedAlert.time}
+
持续时长:{selectedAlert.duration}
+
处理状态:{selectedAlert.status}
+
负责人:{selectedAlert.handler}
根因分析建议
- {item}} />
-
-
-
-
-
相关趋势
-
- 趋势图占位
-
+
{item}}
+ />
推荐处理措施
- {item}} />
-
+ {item}}
+ />
-
-
通知与订阅
-
-
- 短信
- 已开启
-
-
- Telegram
- 已开启
-
-
- 邮件
- 未开启
-
-
-
-
-
+
- ) : (
-
请选择一条告警查看详情
)}
-
-
-
+
+ )}
+
);
}
diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx
index 400aefe..94d31eb 100644
--- a/src/pages/Login.tsx
+++ b/src/pages/Login.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import {
Form,
@@ -6,7 +6,6 @@ import {
Button,
Typography,
Card,
- message,
Checkbox,
App,
} from 'antd';
@@ -22,50 +21,46 @@ import { useAppDispatch } from '../store';
import Cookies from 'js-cookie';
const { Text, Title } = Typography;
+const AntdCard = Card as any;
export default function Login() {
const navigate = useNavigate();
const dispatch = useAppDispatch();
- const { message, } = App.useApp();
+ const { message } = App.useApp();
+ // 登录 loading 状态
+ const [loading, setLoading] = useState(false);
// 账号密码登录
const onFinish = async (values: any) => {
try {
+ // 开启 loading
+ setLoading(true);
+
// 👇 调用 dispatch,并用 unwrap() 拿到 return 的数据
const loginResult = await dispatch(userLogin(values)).unwrap();
// loginResult 就是你 userLogin 里 return 的 res
- console.log("登录成功返回的数据:", loginResult);
if (loginResult.code == 200) {
- //dispatch(setUserInfo(loginResult))
+ message.success('登录成功');
const searchParams = new URLSearchParams(window.location.search);
const goRemote = searchParams.get('goRemote');
if (Number(goRemote) == 1) {
- const rawUserId = Cookies.get("userId"); // 比如 "32434"
-
+ const rawUserId = Cookies.get('userId');
const encodedUserId = btoa(unescape(encodeURIComponent(rawUserId)));
window.location.href = `https://ai.satabot.com/?userId=${encodedUserId}`;
return;
}
-
-
- message.success(`登录成功`);
navigate('/', { replace: true });
} else {
-
- message.error("登录失败:" + loginResult.msg);
-
-
+ message.error('登录失败:' + loginResult.msg);
}
-
- // 登录成功后跳转
-
} catch (err) {
- message.error("登录失败:" + err.toString());
-
+ message.error('登录失败:' + err.toString());
+ } finally {
+ // 无论成功失败,关闭 loading
+ setLoading(false);
}
-
};
return (
@@ -82,7 +77,7 @@ export default function Login() {
transition={{ duration: 0.4 }}
className="w-full max-w-5xl"
>
-
- {/* 记住密码 */}
- {/*
+ {/* 用户协议 */}
+ value ? Promise.resolve() : Promise.reject(new Error('请阅读并同意用户协议')) }]}
+ >
- 记住密码
+
+ 我已阅读并同意 用户协议 和 隐私政策
+
- */}
-
-
+
- {/* 用户协议 */}
-
value ? Promise.resolve() : Promise.reject(new Error('请阅读并同意用户协议')) }]}
- >
-
-
- 我已阅读并同意 用户协议 和 隐私政策
-
-
-
@@ -159,7 +148,6 @@ export default function Login() {