[Frontend] baja語法: 修改查詢異常、復歸、已確認、未確認數量;新增取得正在異常的系統

This commit is contained in:
wanli 2022-12-06 22:56:13 +08:00
parent c4a80be378
commit 2db82f49aa

View File

@ -273,7 +273,7 @@ function getAlarmCountByBaja(callback) {
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where sourceState = 'offnormal' order by timestamp desc").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
@ -301,7 +301,7 @@ function getRecoverCountByBaja(callback) {
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where normalTime != null order by timestamp desc").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get()
.then(function (table) {
return table.cursor({
each: function (record) {
@ -329,7 +329,7 @@ function getCheckedAckedCountByBaja(callback) {
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where ackState ='acked' order by timestamp asc").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
@ -357,7 +357,7 @@ function getUnCheckedAckedCountByBaja(callback) {
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where ackState ='unacked' order by timestamp asc").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
@ -375,3 +375,39 @@ function getUnCheckedAckedCountByBaja(callback) {
});
});
}
/**
* [首頁] 取得現在是異常的系統 (較快)
* @param {any} callback
*/
function getSystemAlarmByBaja(callback) {
var _result = "";
var _ss = "";
var _index = 0;
require(['baja!'], function (baja) {
//baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get()
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"alarmClass":"' + record.get('alarmClass') + '"}';
else
_ss += ',{"alarmClass":"' + record.get('alarmClass') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}