告警中心的二级详情页面+信息中心的页面+对接机器人接口

This commit is contained in:
2026-06-02 08:40:50 +08:00
parent 9eab402551
commit d8879dad62
48 changed files with 4376 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
import 'package:equatable/equatable.dart';
/// 消息类型枚举
enum MessageType {
all('全部'),
alarm('告警'),
workorder('工单'),
system('系统'),
manager('负责人'),
daily('日报'),
safety('安全');
const MessageType(this.label);
final String label;
}
/// 消息分类实体
class MessageCategoryEntity extends Equatable {
const MessageCategoryEntity({
required this.type,
required this.icon,
required this.iconColor,
required this.title,
required this.content,
required this.time,
this.unreadCount = 0,
this.targetId,
this.targetRoute,
});
/// 消息类型
final MessageType type;
/// 图标名称
final String icon;
/// 图标颜色
final String iconColor;
/// 标题
final String title;
/// 内容摘要
final String content;
/// 时间
final String time;
/// 未读数量
final int unreadCount;
/// 目标ID(用于跳转)
final String? targetId;
/// 目标路由(用于跳转)
final String? targetRoute;
@override
List<Object?> get props => [
type,
icon,
iconColor,
title,
content,
time,
unreadCount,
targetId,
targetRoute,
];
MessageCategoryEntity copyWith({
MessageType? type,
String? icon,
String? iconColor,
String? title,
String? content,
String? time,
int? unreadCount,
String? targetId,
String? targetRoute,
}) {
return MessageCategoryEntity(
type: type ?? this.type,
icon: icon ?? this.icon,
iconColor: iconColor ?? this.iconColor,
title: title ?? this.title,
content: content ?? this.content,
time: time ?? this.time,
unreadCount: unreadCount ?? this.unreadCount,
targetId: targetId ?? this.targetId,
targetRoute: targetRoute ?? this.targetRoute,
);
}
}

View File

@@ -0,0 +1,14 @@
import 'package:fpdart/fpdart.dart';
import 'package:maibu_satabot_v2/core/error/failure.dart';
import 'package:maibu_satabot_v2/features/v2/message_center/domain/entities/message_category_entity.dart';
/// 消息中心仓储抽象
abstract class MessageCenterRepository {
/// 获取消息列表
Future<Either<Failure, List<MessageCategoryEntity>>> getMessageList({
MessageType? type,
});
/// 一键已读
Future<Either<Failure, bool>> markAllAsRead();
}

View File

@@ -0,0 +1,28 @@
import 'package:fpdart/fpdart.dart';
import 'package:maibu_satabot_v2/core/error/failure.dart';
import 'package:maibu_satabot_v2/features/v2/message_center/domain/entities/message_category_entity.dart';
import 'package:maibu_satabot_v2/features/v2/message_center/domain/repositories/message_center_repository.dart';
/// 获取消息列表用例
class GetMessageListUseCase {
GetMessageListUseCase(this._repository);
final MessageCenterRepository _repository;
Future<Either<Failure, List<MessageCategoryEntity>>> call({
MessageType? type,
}) async {
return await _repository.getMessageList(type: type);
}
}
/// 一键已读用例
class MarkAllAsReadUseCase {
MarkAllAsReadUseCase(this._repository);
final MessageCenterRepository _repository;
Future<Either<Failure, bool>> call() async {
return await _repository.markAllAsRead();
}
}