添加补卡消息 添加日期状态(工作日休息日节假日等

hmxc
张萌 3 years ago
parent 58c6279b09
commit 2fd9a2348d

@ -1,5 +1,7 @@
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/utils/weekdays_to_chinese.dart'; import 'package:aku_community_manager/utils/weekdays_to_chinese.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
class ClockRecordListModel { class ClockRecordListModel {
int? id; int? id;
@ -10,6 +12,7 @@ class ClockRecordListModel {
String? clockName; String? clockName;
String? clockTel; String? clockTel;
String? createDate; String? createDate;
int? status;
ClockRecordListModel( ClockRecordListModel(
{required this.id, {required this.id,
@ -19,6 +22,7 @@ class ClockRecordListModel {
this.operatorName, this.operatorName,
this.clockName, this.clockName,
this.clockTel, this.clockTel,
this.status,
this.createDate}); this.createDate});
ClockRecordListModel.fromJson(Map<String, dynamic> json) { ClockRecordListModel.fromJson(Map<String, dynamic> json) {
@ -30,6 +34,7 @@ class ClockRecordListModel {
clockName = json['clockName']; clockName = json['clockName'];
clockTel = json['clockTel']; clockTel = json['clockTel'];
createDate = json['createDate']; createDate = json['createDate'];
status = json['status'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -42,17 +47,43 @@ class ClockRecordListModel {
data['clockName'] = this.clockName; data['clockName'] = this.clockName;
data['clockTel'] = this.clockTel; data['clockTel'] = this.clockTel;
data['createDate'] = this.createDate; data['createDate'] = this.createDate;
data['status'] = this.status;
return data; return data;
} }
String get startClockString => String get startClockString =>
DateUtil.formatDateStr(this.startClockDate??'', format: 'HH:mm:ss'); DateUtil.formatDateStr(this.startClockDate ?? '', format: 'HH:mm:ss');
String get endClockString => String get endClockString =>
DateUtil.formatDateStr(this.endClockDate??'', format: 'HH:mm:ss'); DateUtil.formatDateStr(this.endClockDate ?? '', format: 'HH:mm:ss');
String get clockDateString => String get clockDateString =>
DateUtil.formatDateStr(this.createDate??'', format: 'yyyy.MM.dd'); DateUtil.formatDateStr(this.createDate ?? '', format: 'yyyy.MM.dd');
String get weekDay => WeekDaysToChinese.fromInt( String get weekDay => WeekDaysToChinese.fromInt(
DateUtil.getDateTime(this.createDate??'')?.weekday??0); DateUtil.getDateTime(this.createDate ?? '')?.weekday ?? 0);
String get statusString {
switch (this.status) {
case 1:
return '节假日';
case 2:
return '工作日';
case 3:
return '休息日';
default:
return '未知';
}
}
Color get statusColor {
switch (this.status) {
case 1:
return Colors.red;
case 2:
return kTextSubColor;
case 3:
return kPrimaryColor;
default:
return Colors.redAccent;
}
}
} }

@ -32,6 +32,12 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
.bold .bold
.make(), .make(),
10.w.widthBox,
widget.model.statusString.text
.size(28.sp)
.bold
.color(widget.model.statusColor)
.make(),
Spacer(), Spacer(),
widget.model.weekDay.text widget.model.weekDay.text
.size(32.sp) .size(32.sp)
@ -132,8 +138,40 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
), ),
], ],
), ),
..._cardReplacement(),
], ],
), ),
); );
} }
_cardReplacement() {
return widget.model.cardReplacementDate == null
? []
: [
12.w.heightBox,
AkuDivider.horizontal(),
12.w.heightBox,
Row(
children: [
Container(
width: 16.w,
height: 16.w,
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.circular(8.w),
),
),
20.w.widthBox,
('已补卡').text.size(28.sp).color(kTextPrimaryColor).bold.make(),
Spacer(),
('补卡人:${widget.model.operatorName}')
.text
.size(28.sp)
.color(kTextPrimaryColor)
.bold
.make(),
],
)
];
}
} }

Loading…
Cancel
Save