告警中心的二级详情页面+信息中心的页面+对接机器人接口
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/data/datasources/message_center_remote_datasource.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/data/models/message_category_model.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/domain/entities/message_category_entity.dart';
|
||||
|
||||
/// 消息中心远程数据源实现(模拟数据)
|
||||
class MessageCenterRemoteDataSourceImpl implements MessageCenterRemoteDataSource {
|
||||
@override
|
||||
Future<List<MessageCategoryModel>> getMessageList({MessageType? type}) async {
|
||||
// 模拟网络延迟
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
final allMessages = [
|
||||
MessageCategoryModel(
|
||||
type: 'alarm',
|
||||
icon: 'notifications',
|
||||
iconColor: '#FF3B30',
|
||||
title: '告警通知',
|
||||
content: '逆变器 INV-001 离网告警',
|
||||
time: '09:24',
|
||||
unreadCount: 12,
|
||||
targetId: 'ALM-001',
|
||||
targetRoute: '/alarm-detail',
|
||||
),
|
||||
MessageCategoryModel(
|
||||
type: 'workorder',
|
||||
icon: 'assignment',
|
||||
iconColor: '#FF9500',
|
||||
title: '工单提醒',
|
||||
content: '工单 #WO-2025051908 已派发',
|
||||
time: '09:18',
|
||||
unreadCount: 3,
|
||||
targetId: 'WO-2025051908',
|
||||
targetRoute: '/workorder-detail',
|
||||
),
|
||||
MessageCategoryModel(
|
||||
type: 'system',
|
||||
icon: 'campaign',
|
||||
iconColor: '#165DFF',
|
||||
title: '系统消息',
|
||||
content: '系统升级维护通知',
|
||||
time: '08:30',
|
||||
unreadCount: 0,
|
||||
targetId: null,
|
||||
targetRoute: null,
|
||||
),
|
||||
MessageCategoryModel(
|
||||
type: 'manager',
|
||||
icon: 'chat',
|
||||
iconColor: '#00B42A',
|
||||
title: '负责人消息',
|
||||
content: '张工:请尽快处理该告警',
|
||||
time: '08:15',
|
||||
unreadCount: 2,
|
||||
targetId: null,
|
||||
targetRoute: null,
|
||||
),
|
||||
MessageCategoryModel(
|
||||
type: 'daily',
|
||||
icon: 'description',
|
||||
iconColor: '#722ED1',
|
||||
title: '日报推送',
|
||||
content: '5月18日光伏电站运行日报',
|
||||
time: '07:30',
|
||||
unreadCount: 0,
|
||||
targetId: null,
|
||||
targetRoute: null,
|
||||
),
|
||||
MessageCategoryModel(
|
||||
type: 'safety',
|
||||
icon: 'security',
|
||||
iconColor: '#165DFF',
|
||||
title: '安全通知',
|
||||
content: '安全策略更新通知',
|
||||
time: '昨日',
|
||||
unreadCount: 0,
|
||||
targetId: null,
|
||||
targetRoute: null,
|
||||
),
|
||||
];
|
||||
|
||||
// 根据类型筛选
|
||||
if (type != null && type != MessageType.all) {
|
||||
return allMessages
|
||||
.where((msg) => msg.type == type.name)
|
||||
.toList();
|
||||
}
|
||||
|
||||
return allMessages;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> markAllAsRead() async {
|
||||
// 模拟网络延迟
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user