ot_report_model.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /// 加班报表汇总
  2. class OTReportSummary {
  3. final double totalHours;
  4. final int totalCount;
  5. final double compensatoryHours;
  6. final double overtimePayHours;
  7. const OTReportSummary({
  8. this.totalHours = 0,
  9. this.totalCount = 0,
  10. this.compensatoryHours = 0,
  11. this.overtimePayHours = 0,
  12. });
  13. factory OTReportSummary.fromJson(Map<String, dynamic> json) {
  14. return OTReportSummary(
  15. totalHours: (json['totalHours'] as num?)?.toDouble() ?? 0,
  16. totalCount: json['totalCount'] as int? ?? 0,
  17. compensatoryHours: (json['compensatoryHours'] as num?)?.toDouble() ?? 0,
  18. overtimePayHours: (json['overtimePayHours'] as num?)?.toDouble() ?? 0,
  19. );
  20. }
  21. }
  22. /// 月度报表数据
  23. class OTMonthlyItem {
  24. final int month;
  25. final double hours;
  26. final double compensatoryHours;
  27. final double overtimePayHours;
  28. final int count;
  29. const OTMonthlyItem({
  30. this.month = 0,
  31. this.hours = 0,
  32. this.compensatoryHours = 0,
  33. this.overtimePayHours = 0,
  34. this.count = 0,
  35. });
  36. factory OTMonthlyItem.fromJson(Map<String, dynamic> json) {
  37. return OTMonthlyItem(
  38. month: json['month'] as int? ?? 0,
  39. hours: (json['hours'] as num?)?.toDouble() ?? 0,
  40. compensatoryHours: (json['compensatoryHours'] as num?)?.toDouble() ?? 0,
  41. overtimePayHours: (json['overtimePayHours'] as num?)?.toDouble() ?? 0,
  42. count: json['count'] as int? ?? 0,
  43. );
  44. }
  45. }
  46. /// 加班报表汇总+月度数据
  47. class OTReportData {
  48. final OTReportSummary summary;
  49. final List<OTMonthlyItem> monthly;
  50. const OTReportData({
  51. this.summary = const OTReportSummary(),
  52. this.monthly = const [],
  53. });
  54. factory OTReportData.fromJson(Map<String, dynamic> json) {
  55. return OTReportData(
  56. summary: json['summary'] != null
  57. ? OTReportSummary.fromJson(json['summary'] as Map<String, dynamic>)
  58. : const OTReportSummary(),
  59. monthly:
  60. (json['monthly'] as List<dynamic>?)
  61. ?.map((e) => OTMonthlyItem.fromJson(e as Map<String, dynamic>))
  62. .toList() ??
  63. [],
  64. );
  65. }
  66. }
  67. /// 加班报表下属对比
  68. class OTSubordinateItem {
  69. final String usr;
  70. final String usrName;
  71. final double hours;
  72. final int cnt;
  73. const OTSubordinateItem({
  74. this.usr = '',
  75. this.usrName = '',
  76. this.hours = 0,
  77. this.cnt = 0,
  78. });
  79. factory OTSubordinateItem.fromJson(Map<String, dynamic> json) {
  80. return OTSubordinateItem(
  81. usr: json['usr'] as String? ?? '',
  82. usrName: json['usrName'] as String? ?? '',
  83. hours: (json['hours'] as num?)?.toDouble() ?? 0,
  84. cnt: json['cnt'] as int? ?? 0,
  85. );
  86. }
  87. }
  88. /// 加班报表明细项
  89. class OTReportDetailItem {
  90. final String billNo;
  91. final String? billDate;
  92. final String employeeName;
  93. final double hours;
  94. final String jbType;
  95. final String compensationType;
  96. final String reason;
  97. const OTReportDetailItem({
  98. this.billNo = '',
  99. this.billDate,
  100. this.employeeName = '',
  101. this.hours = 0,
  102. this.jbType = '',
  103. this.compensationType = '',
  104. this.reason = '',
  105. });
  106. factory OTReportDetailItem.fromJson(Map<String, dynamic> json) {
  107. return OTReportDetailItem(
  108. billNo: json['billNo'] as String? ?? '',
  109. billDate: json['billDate'] as String?,
  110. employeeName: json['employeeName'] as String? ?? '',
  111. hours: (json['hours'] as num?)?.toDouble() ?? 0,
  112. jbType: json['jbType'] as String? ?? '',
  113. compensationType: json['compensationType'] as String? ?? '',
  114. reason: json['reason'] as String? ?? '',
  115. );
  116. }
  117. }