diff --git a/lib/models/manager/clock_in_out/clock_record_list_model.dart b/lib/models/manager/clock_in_out/clock_record_list_model.dart index a5cd6e4..7a3a7da 100644 --- a/lib/models/manager/clock_in_out/clock_record_list_model.dart +++ b/lib/models/manager/clock_in_out/clock_record_list_model.dart @@ -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 json) { @@ -30,6 +34,7 @@ class ClockRecordListModel { clockName = json['clockName']; clockTel = json['clockTel']; createDate = json['createDate']; + status = json['status']; } Map 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; + } + } } diff --git a/lib/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart b/lib/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart index d509ad2..ff20f61 100644 --- a/lib/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart +++ b/lib/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart @@ -32,6 +32,12 @@ class _ClockInOutRecordCardState extends State { .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 { ), ], ), + ..._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(), + ], + ) + ]; + } }