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

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:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
class ClockRecordListModel {
int? id;
@ -10,6 +12,7 @@ class ClockRecordListModel {
String? clockName;
String? clockTel;
String? createDate;
int? status;
ClockRecordListModel(
{required this.id,
@ -19,6 +22,7 @@ class ClockRecordListModel {
this.operatorName,
this.clockName,
this.clockTel,
this.status,
this.createDate});
ClockRecordListModel.fromJson(Map<String, dynamic> json) {
@ -30,6 +34,7 @@ class ClockRecordListModel {
clockName = json['clockName'];
clockTel = json['clockTel'];
createDate = json['createDate'];
status = json['status'];
}
Map<String, dynamic> toJson() {
@ -42,17 +47,43 @@ class ClockRecordListModel {
data['clockName'] = this.clockName;
data['clockTel'] = this.clockTel;
data['createDate'] = this.createDate;
data['status'] = this.status;
return data;
}
String get startClockString =>
DateUtil.formatDateStr(this.startClockDate??'', format: 'HH:mm:ss');
DateUtil.formatDateStr(this.startClockDate ?? '', format: 'HH:mm:ss');
String get endClockString =>
DateUtil.formatDateStr(this.endClockDate??'', format: 'HH:mm:ss');
DateUtil.formatDateStr(this.endClockDate ?? '', format: 'HH:mm:ss');
String get clockDateString =>
DateUtil.formatDateStr(this.createDate??'', format: 'yyyy.MM.dd');
DateUtil.formatDateStr(this.createDate ?? '', format: 'yyyy.MM.dd');
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)
.bold
.make(),
10.w.widthBox,
widget.model.statusString.text
.size(28.sp)
.bold
.color(widget.model.statusColor)
.make(),
Spacer(),
widget.model.weekDay.text
.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