mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-25 23:57:57 +00:00
connect generate reports model and api to view
This commit is contained in:
@@ -2,7 +2,7 @@ class DeviceReport {
|
||||
final String? deviceUuid;
|
||||
final int? startTime;
|
||||
final int? endTime;
|
||||
final List<dynamic>? data;
|
||||
final List<DeviceEvent>? data;
|
||||
|
||||
DeviceReport({
|
||||
this.deviceUuid,
|
||||
@@ -15,12 +15,37 @@ class DeviceReport {
|
||||
: deviceUuid = json['deviceUuid'] as String?,
|
||||
startTime = json['startTime'] as int?,
|
||||
endTime = json['endTime'] as int?,
|
||||
data = json['data'] as List?;
|
||||
data = (json['data'] as List<dynamic>?)
|
||||
?.map((e) => DeviceEvent.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'deviceUuid': deviceUuid,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'data': data
|
||||
'data': data?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
class DeviceEvent {
|
||||
final String? code;
|
||||
final int? eventTime;
|
||||
final String? value;
|
||||
|
||||
DeviceEvent({
|
||||
this.code,
|
||||
this.eventTime,
|
||||
this.value,
|
||||
});
|
||||
|
||||
DeviceEvent.fromJson(Map<String, dynamic> json)
|
||||
: code = json['code'] as String?,
|
||||
eventTime = json['eventTime'] as int?,
|
||||
value = json['value'] as String?;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'code': code,
|
||||
'eventTime': eventTime,
|
||||
'value': value,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user