Commit be1b16cd authored by 张宏's avatar 张宏

333333333

parent 96e4c909
...@@ -925,19 +925,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -925,19 +925,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
alarmId: alarm.alarmId, alarmId: alarm.alarmId,
); );
// 按告警标题去重:相同标题 → 原地覆盖;不同标题 → 插入头部 // 摄像头告警只保留最新一条,新消息直接覆盖
final existingIndex = state.cameraAlerts.indexWhere((a) => a.title == title); emit(state.copyWith(cameraAlerts: [alert]));
if (existingIndex >= 0) {
// 已存在相同标题 → 原地替换
final updatedAlerts = List<AlertInfoBO>.from(state.cameraAlerts);
updatedAlerts[existingIndex] = alert;
emit(state.copyWith(cameraAlerts: updatedAlerts));
} else {
// 不存在 → 插入头部
emit(state.copyWith(
cameraAlerts: [alert, ...state.cameraAlerts],
));
}
} }
/// 处理 MQTT pet/bind 宠物绑定消息 /// 处理 MQTT pet/bind 宠物绑定消息
...@@ -1024,7 +1013,7 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -1024,7 +1013,7 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
// 温度设定值 (MQTT ×10,如 260 → 26.0℃) // 温度设定值 (MQTT ×10,如 260 → 26.0℃)
case 'temperatureSetting': case 'temperatureSetting':
final temp = (value / 10).toStringAsFixed(1); final temp = (value / 10).toStringAsFixed(1);
bloc.setCabinTempSetValue(temp); bloc.setCabinTempSetValue(temp.toString());
break; break;
// 湿度设定值 // 湿度设定值
...@@ -1066,13 +1055,13 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -1066,13 +1055,13 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
); );
break; break;
// 照明灯:0=关 / 1=开 // 检查灯:0=关 / 1=开
case 'floodLight': case 'inspectionLamp':
bloc.setIlluminationLightSwitch(value == 1); bloc.setIlluminationLightSwitch(value == 1);
break; break;
// 泛光灯/检查灯:0=关 / 1=开 // 照明灯/检查灯:0=关 / 1=开
case 'inspectionLamp': case 'floodLight':
bloc.setCheckLightSwitch(value == 1); bloc.setCheckLightSwitch(value == 1);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment