接入设备故障告警和场站实时任务进度
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import '../../../../core/localization/app_localizations.dart';
|
||||
|
||||
String deviceAlarmTime(DateTime? time) {
|
||||
if (time == null) return '—';
|
||||
String two(int value) => value.toString().padLeft(2, '0');
|
||||
return '${time.year}-${two(time.month)}-${two(time.day)} '
|
||||
'${two(time.hour)}:${two(time.minute)}:${two(time.second)}';
|
||||
}
|
||||
|
||||
String deviceAlarmLevel(AppLocalizations l10n, String level) {
|
||||
if (level.toUpperCase() == 'WARNING') {
|
||||
return l10n.translate('device_alarms.level_warning');
|
||||
}
|
||||
if (const ['1', '2', '3', '4'].contains(level)) {
|
||||
return l10n.translate('device_alarms.level_$level');
|
||||
}
|
||||
return level.isEmpty ? '—' : level;
|
||||
}
|
||||
|
||||
String deviceAlarmType(AppLocalizations l10n, String type) {
|
||||
if (type.toUpperCase() == 'MOWER_FAULT') {
|
||||
return l10n.translate('device_alarms.type_mower_fault');
|
||||
}
|
||||
if (const ['1', '2', '3', '4', '5', '6'].contains(type)) {
|
||||
return l10n.translate('device_alarms.type_$type');
|
||||
}
|
||||
return type.isEmpty ? '—' : type;
|
||||
}
|
||||
Reference in New Issue
Block a user