[前台] 告警系統 維修單新增及顯示 | 取得 N4 資料 Ord 修正
This commit is contained in:
parent
0da4c4cdd7
commit
b6f7ff0b75
@ -646,8 +646,7 @@
|
||||
let tag = "#alertTable";
|
||||
|
||||
$.each(data, function (i, v) {
|
||||
v.formId = AlertList(v.uuid.$val);
|
||||
|
||||
v.formId = AlertList(v.uuid.$val || v.uuid);
|
||||
});
|
||||
|
||||
let column_defs = [
|
||||
|
@ -93,12 +93,13 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
||||
var _index = 0;
|
||||
var _recoverState = isRecover ? "!= null" : "= null";
|
||||
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
|
||||
console.log("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 alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")
|
||||
console.log("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 alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")
|
||||
require(['baja!'], function (baja) {
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get()
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
each: function (record) {
|
||||
// console.log(record)
|
||||
const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0]
|
||||
//console.log(alarmDisplayName)
|
||||
_sourceTmp = alarmDisplayName.split('_');
|
||||
@ -236,7 +237,7 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) {
|
||||
var _result = "";
|
||||
var _ss = "";
|
||||
var _index = 0;
|
||||
/* console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")*/
|
||||
/* console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")*/
|
||||
require(['baja!'], function (baja) {
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
@ -531,7 +532,7 @@ function getOneDeviceAlarmByBaja(devicePath, callback) {
|
||||
var _index = 0;
|
||||
|
||||
require(['baja!'], function (baja) {
|
||||
/* console.log("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 alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");*/
|
||||
/* console.log("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 alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");*/
|
||||
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 alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
@ -568,14 +569,14 @@ function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isR
|
||||
if (startDate_millisecond) {
|
||||
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
|
||||
}
|
||||
// console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
|
||||
console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
|
||||
require(['baja!'], function (baja) {
|
||||
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
each: function (record) {
|
||||
// console.log(record,record.get('alarmData').get('sourceName').split(':'))
|
||||
// console.log(record)
|
||||
let main = {};
|
||||
// console.log(record.get('alarmData').get('sourceName'),record.get('timestamp').$cEncStr)
|
||||
const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0]
|
||||
@ -597,7 +598,9 @@ function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isR
|
||||
main.normalTime = record.get('normalTime');
|
||||
main.priority = record.get('priority');
|
||||
main.ackedTime = record.get('ackTime').$cEncStr;
|
||||
main.ackState = record.get('ackState').$ordinal
|
||||
if (!_sourceTmp.includes("undefined")) {
|
||||
// console.log(main.ackState)
|
||||
_result.data.push(main);
|
||||
}
|
||||
_index++;
|
||||
@ -623,42 +626,50 @@ function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, is
|
||||
var _recoverState = isRecover ? "!= null" : "= null";
|
||||
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
|
||||
|
||||
require(['baja!'], function (baja) {
|
||||
let startUrl = "";
|
||||
if (startDate_millisecond) {
|
||||
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
|
||||
}
|
||||
/* console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");*/
|
||||
// console.log("首頁","local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
|
||||
require(['baja!'], function (baja) {
|
||||
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
each: function (record) {
|
||||
// console.log(record)
|
||||
let main = {};
|
||||
//console.log(record.get('alarmData').get('sourceName'))
|
||||
_sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[1];
|
||||
//console.log(_sourcePoint)
|
||||
_sourceTmp = _sourcePoint.split("_");
|
||||
// console.log(record.get('alarmData').get('sourceName'),record.get('timestamp').$cEncStr)
|
||||
const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0]
|
||||
//console.log(alarmDisplayName)
|
||||
_sourceTmp = alarmDisplayName.split('_');
|
||||
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]
|
||||
let _sourceName = _sourceTmp.slice(0, 8).join("_");
|
||||
_sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||
|
||||
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||
let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||
main.buildingFloorName_zh = _bfName;
|
||||
main.sourceName_zh = _sourceName;
|
||||
main.uuid = record.get('uuid').$val;
|
||||
main.timestamp = record.get('timestamp');
|
||||
main.timestamp = record.get('timestamp').$cEncStr;
|
||||
main.alarmClass = record.get('alarmClass');
|
||||
main.point = _sourcePoint;
|
||||
main.devicePath = _sourceTmp.slice(0, 8).join("_");;
|
||||
main.point = _sourceTmp;
|
||||
main.sourceTmp = _sourceTmp;
|
||||
main.devicePath = _sourceName;
|
||||
main.msgText = record.get('alarmData').get('msgText');
|
||||
main.normalTime = record.get('normalTime');
|
||||
main.priority = record.get('priority');
|
||||
main.ackedTime = record.get('ackTime').$cEncStr;
|
||||
main.ackState = record.get('ackState').$ordinal
|
||||
if (!_sourceTmp.includes("undefined")) {
|
||||
// console.log(main.ackState)
|
||||
_result.data.push(main);
|
||||
}
|
||||
_index++;
|
||||
},
|
||||
after: function () {
|
||||
_result.count = _index;
|
||||
if (typeof callback === 'function') {
|
||||
//console.log(_result)
|
||||
callback(_result);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user