告警中心的二级详情页面+信息中心的页面+对接机器人接口
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/domain/entities/message_category_entity.dart';
|
||||
|
||||
/// 消息分类数据模型
|
||||
class MessageCategoryModel {
|
||||
MessageCategoryModel({
|
||||
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 String type;
|
||||
final String icon;
|
||||
final String iconColor;
|
||||
final String title;
|
||||
final String content;
|
||||
final String time;
|
||||
final int unreadCount;
|
||||
final String? targetId;
|
||||
final String? targetRoute;
|
||||
|
||||
factory MessageCategoryModel.fromJson(Map<String, dynamic> json) {
|
||||
return MessageCategoryModel(
|
||||
type: json['type'] as String,
|
||||
icon: json['icon'] as String,
|
||||
iconColor: json['iconColor'] as String,
|
||||
title: json['title'] as String,
|
||||
content: json['content'] as String,
|
||||
time: json['time'] as String,
|
||||
unreadCount: json['unreadCount'] as int? ?? 0,
|
||||
targetId: json['targetId'] as String?,
|
||||
targetRoute: json['targetRoute'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
MessageCategoryEntity toEntity() {
|
||||
return MessageCategoryEntity(
|
||||
type: _parseMessageType(type),
|
||||
icon: icon,
|
||||
iconColor: iconColor,
|
||||
title: title,
|
||||
content: content,
|
||||
time: time,
|
||||
unreadCount: unreadCount,
|
||||
targetId: targetId,
|
||||
targetRoute: targetRoute,
|
||||
);
|
||||
}
|
||||
|
||||
MessageType _parseMessageType(String type) {
|
||||
switch (type) {
|
||||
case 'alarm':
|
||||
return MessageType.alarm;
|
||||
case 'workorder':
|
||||
return MessageType.workorder;
|
||||
case 'system':
|
||||
return MessageType.system;
|
||||
case 'manager':
|
||||
return MessageType.manager;
|
||||
case 'daily':
|
||||
return MessageType.daily;
|
||||
case 'safety':
|
||||
return MessageType.safety;
|
||||
default:
|
||||
return MessageType.all;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user