add chart code

This commit is contained in:
2026-01-13 23:11:25 +08:00
parent 0a9f0b8583
commit 6b4d98f5ce
14 changed files with 938 additions and 41 deletions
+31
View File
@@ -1,12 +1,39 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
// 假別模型 260110
class LeaveType {
final String id;
final String name;
LeaveType({required this.id, required this.name});
factory LeaveType.fromJson(Map<String, dynamic> json) {
return LeaveType(
id: json['leavetype_id'] as String,
name: json['leavetype_name'] as String,
);
}
}
// 簽核進度模型
class FlowLog {
final String stepName;
final String approverName;
final String status; // 1:同意, X:駁回, 0:待審
final DateTime? time;
FlowLog({required this.stepName, required this.approverName, required this.status, this.time});
}
class Leave {
final String billNo; // billno (Primary Key)
final DateTime? billDate; // billdate
final String personId; // personid
final String agentId; // agentid (代理人)
final String agentName; /// 關聯顯示
final String leaveType; // leavetype (假別:事假、病假等)
final String leaveTypeName; /// 顯示名稱
final DateTime? startTime; // starttime
final DateTime? endTime; // endtime
final double days; // days
@@ -19,7 +46,9 @@ class Leave {
this.billDate,
required this.personId,
required this.agentId,
this.agentName = '',
required this.leaveType,
this.leaveTypeName = '',
this.startTime,
this.endTime,
this.days = 0,
@@ -34,7 +63,9 @@ class Leave {
billDate: json['billdate'] != null ? DateTime.tryParse(json['billdate']) : null,
personId: json['personid'] as String? ?? '',
agentId: json['agentid'] as String? ?? '',
agentName: json['agentname'] ?? '', /// 假設 API 會 Join 姓名
leaveType: json['leavetype'] as String? ?? '',
leaveTypeName: json['leavetype_name'] ?? json['leavetype'] ?? '',
startTime: json['starttime'] != null ? DateTime.tryParse(json['starttime']) : null,
endTime: json['endtime'] != null ? DateTime.tryParse(json['endtime']) : null,
days: double.tryParse(json['days']?.toString() ?? '0') ?? 0,