| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- class MessageModel {
- final String id;
- final String title;
- final String content;
- final String msgType;
- final String? bizType;
- final String? bizId;
- final bool isRead;
- final DateTime createTime;
- const MessageModel({
- required this.id,
- required this.title,
- this.content = '',
- this.msgType = 'system',
- this.bizType,
- this.bizId,
- this.isRead = false,
- required this.createTime,
- });
- factory MessageModel.fromJson(Map<String, dynamic> json) => MessageModel(
- id: json['id'] as String,
- title: json['title'] as String,
- content: json['content'] as String? ?? '',
- msgType: json['msgType'] as String? ?? 'system',
- bizType: json['bizType'] as String?,
- bizId: json['bizId'] as String?,
- isRead: json['isRead'] as bool? ?? false,
- createTime: DateTime.parse(json['createTime'] as String),
- );
- static final mockMessages = [
- // 审批待办
- MessageModel(
- id: '1',
- title: '张三提交了差旅报销,待审批',
- content: '报销金额 ¥2,380.00',
- msgType: 'approval_notice',
- bizType: 'expense',
- bizId: 'exp-001',
- isRead: false,
- createTime: DateTime(2026, 6, 4, 9, 30),
- ),
- // 审批待办
- MessageModel(
- id: '2',
- title: '李四的加班申请待审批',
- content: '加班时长 4小时',
- msgType: 'approval_notice',
- bizType: 'overtime',
- bizId: 'ot-001',
- isRead: false,
- createTime: DateTime(2026, 6, 3, 14, 0),
- ),
- // 审批结果 — 通过
- MessageModel(
- id: '3',
- title: '您的差旅报销已通过',
- content: 'BX-20260602-001 已通过审批',
- msgType: 'approval_result',
- bizType: 'expense',
- bizId: 'exp-002',
- isRead: true,
- createTime: DateTime(2026, 6, 2, 10, 0),
- ),
- // 审批结果 — 拒绝
- MessageModel(
- id: '4',
- title: '您的加班申请已被拒绝',
- content: '原因:与部门预算冲突',
- msgType: 'approval_result',
- bizType: 'overtime',
- bizId: 'ot-002',
- isRead: false,
- createTime: DateTime(2026, 6, 2, 11, 30),
- ),
- // 撤回通知
- MessageModel(
- id: '5',
- title: '王五撤回了用车申请',
- content: 'YC-20260601-003 已撤回',
- msgType: 'withdraw_notice',
- bizType: 'vehicle',
- bizId: 'vcl-003',
- isRead: false,
- createTime: DateTime(2026, 6, 1, 16, 45),
- ),
- // 系统公告
- MessageModel(
- id: '6',
- title: '【通知公告】2026年端午放假安排',
- content: '6月8日至6月10日放假,共3天',
- msgType: 'announcement',
- bizType: 'announcement',
- bizId: 'an-001',
- isRead: false,
- createTime: DateTime(2026, 6, 1, 14, 0),
- ),
- // 系统公告(已读)
- MessageModel(
- id: '7',
- title: '关于启用新版报销流程的通知',
- content: '自2026年7月1日起全面启用新版报销系统',
- msgType: 'announcement',
- bizType: 'announcement',
- bizId: 'an-002',
- isRead: true,
- createTime: DateTime(2026, 5, 28, 9, 0),
- ),
- // 过期提醒
- MessageModel(
- id: '8',
- title: '您的差旅申请已过期,预算已释放',
- content: '申请单 BXSQ-20260501-002 有效期已截止',
- msgType: 'expiry_reminder',
- bizType: 'expense_application',
- bizId: 'ea-002',
- isRead: false,
- createTime: DateTime(2026, 6, 1, 8, 0),
- ),
- ];
- }
|