|
|
@@ -1536,6 +1536,22 @@
|
|
|
a = pkt_to_bin(0, PKT_TYPE.NEW_PKT_TYPE_NETWORK,0, 0, 0, ip_data);
|
|
|
ws.send(a);
|
|
|
}
|
|
|
+ function addAlarm(data,i) {
|
|
|
+ // const now = new Date();
|
|
|
+ // const timeStr = now.toLocaleString();
|
|
|
+ const alarmId = 'AL' + String(i).padStart(4, '0');
|
|
|
+ type = (data.type == 0) ? "电能告警" : (data.type == 1) ? "传感器告警" : (data.type == 2) ? "网络告警" : "其他告警";
|
|
|
+ alarmList.unshift({
|
|
|
+ id: alarmId,
|
|
|
+ time: data.date,
|
|
|
+ type: type,
|
|
|
+ message: data.context
|
|
|
+ });
|
|
|
+ if (alarmList.length > 10) alarmList.pop();
|
|
|
+ // updateAlarmBadge();
|
|
|
+ // updateAlarmUI();
|
|
|
+ // showToast("新告警: " + type, 2000);
|
|
|
+ }
|
|
|
|
|
|
function confirmNtp()
|
|
|
{
|