1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -54,7 +54,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
allDevices.addAll(result);
|
||||
}
|
||||
|
||||
if (typeFilter != null && typeFilter != '全部') {
|
||||
if (typeFilter != null && typeFilter != 'all') {
|
||||
return allDevices.where((device) => device.type == typeFilter).toList();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
return DeviceDataModel(
|
||||
deviceId: json['device_sn']?.toString() ?? '',
|
||||
name: json['callsign'] ?? '无人机机场',
|
||||
type: '无人机机场',
|
||||
type: 'drone_station',
|
||||
status: onlineStatus == 1 ? '在线' : '离线',
|
||||
power: (json['capacity_percent'] as num?)?.toDouble() ?? 0,
|
||||
todayEnergy: 0,
|
||||
@@ -150,7 +150,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10001',
|
||||
name: '逆变器 INV-001',
|
||||
type: '逆变器',
|
||||
type: 'inverter',
|
||||
status: '在线',
|
||||
power: 125.8,
|
||||
todayEnergy: 752.6,
|
||||
@@ -158,7 +158,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10002',
|
||||
name: '逆变器 INV-002',
|
||||
type: '逆变器',
|
||||
type: 'inverter',
|
||||
status: '在线',
|
||||
power: 118.6,
|
||||
todayEnergy: 698.2,
|
||||
@@ -166,7 +166,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10003',
|
||||
name: '汇流箱 SCB-001',
|
||||
type: '汇流箱',
|
||||
type: 'combiner_box',
|
||||
status: '在线',
|
||||
power: 0,
|
||||
todayEnergy: 0,
|
||||
@@ -176,7 +176,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10004',
|
||||
name: '组件组串 STR-001',
|
||||
type: '组件',
|
||||
type: 'module',
|
||||
status: '在线',
|
||||
power: 85.3,
|
||||
todayEnergy: 0,
|
||||
@@ -185,7 +185,7 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10005',
|
||||
name: '监控 MON-001',
|
||||
type: '监控',
|
||||
type: 'monitor',
|
||||
status: '离线',
|
||||
power: 0,
|
||||
todayEnergy: 0,
|
||||
@@ -193,14 +193,14 @@ class DeviceRemoteDataSourceImpl implements DeviceRemoteDataSource {
|
||||
const DeviceDataModel(
|
||||
deviceId: '10006',
|
||||
name: '逆变器 INV-003',
|
||||
type: '逆变器',
|
||||
type: 'inverter',
|
||||
status: '异常',
|
||||
power: 45.2,
|
||||
todayEnergy: 256.8,
|
||||
),
|
||||
];
|
||||
|
||||
if (typeFilter != null && typeFilter != '全部') {
|
||||
if (typeFilter != null && typeFilter != 'all') {
|
||||
return allDevices.where((device) => device.type == typeFilter).toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,16 @@ class RobotDataModel {
|
||||
|
||||
/// 从 JSON 创建数据模型
|
||||
factory RobotDataModel.fromJson(Map<String, dynamic> json) {
|
||||
final batteryValue = (json['battery'] as num?)?.toDouble() ??
|
||||
(json['capacity_percent'] as num?)?.toDouble() ?? 100.0;
|
||||
|
||||
final batteryValue =
|
||||
(json['battery'] as num?)?.toDouble() ??
|
||||
(json['capacity_percent'] as num?)?.toDouble() ??
|
||||
100.0;
|
||||
|
||||
return RobotDataModel(
|
||||
name: json['deviceName'] ?? json['name'] ?? '',
|
||||
id: json['deviceId']?.toString() ?? json['id']?.toString() ?? '',
|
||||
alias: json['deviceAlias'] as String?, // 获取别名字段
|
||||
type: json['deviceTypeName'] ?? json['type'] ?? '未知类型',
|
||||
type: _convertType(json['deviceTypeName'] ?? json['type'] ?? '未知类型'),
|
||||
status: _getStatusText(json['status'] ?? 0),
|
||||
battery: batteryValue,
|
||||
task: json['task'] ?? json['currentTask'] ?? '待机中',
|
||||
@@ -60,4 +62,15 @@ class RobotDataModel {
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
static String _convertType(String type) {
|
||||
if (type.contains('巡检')) {
|
||||
return 'inspection';
|
||||
} else if (type.contains('清洗')) {
|
||||
return 'cleaning';
|
||||
} else if (type.contains('除草')) {
|
||||
return 'weeding';
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user