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