From 31aa51985f4e7a9dc9643a8fbeef918fa8f78de3 Mon Sep 17 00:00:00 2001 From: Celeste Date: Fri, 2 Jun 2023 15:25:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?[=E5=89=8D=E5=8F=B0]=20=E7=B3=BB=E7=B5=B1?= =?UTF-8?q?=E7=9B=A3=E6=8E=A7=E5=8D=A1=E7=89=87=E5=8E=9F=E9=BB=9E=E7=84=A1?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E5=B8=B8=E8=BD=89=E6=8F=9B=20|=20=20?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E8=AD=A6=E5=91=8A=E5=8D=A1=E7=89=87=20bql=20?= =?UTF-8?q?=E8=AA=9E=E6=B3=95=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysMonAll.html | 1678 ++++++++-------- Frontend/_sysMonFloor.html | 3508 ++++++++++++++++----------------- Frontend/js/n4js/alarmbaja.js | 673 +++++-- 3 files changed, 3063 insertions(+), 2796 deletions(-) diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index dafebe2..24ce87e 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -1,8 +1,8 @@ 
-
-
+
+
@@ -13,906 +13,906 @@ aria-hidden="true" data-backdrop="static" data-keyboard="false"> - diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index ce8a580..c3365f3 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -1,7 +1,7 @@ 
-
-
-
-
- -
-
-
+
+
+
+
+ +
+
+
diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index fd43970..b49054a 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -1,17 +1,16 @@ - function addzero(num) { - return num < 10 ? '0' + num : num; + return num < 10 ? "0" + num : num; } /** -* 取得異常資料 by baja -* @param {any} startDate_millisecond -* @param {any} endDate_millisecond -* @param {any} isRecover -* @param {any} isAck -* @param {any} alarmClass -* @param {any} callback -*/ + * 取得異常資料 by baja + * @param {any} startDate_millisecond + * @param {any} endDate_millisecond + * @param {any} isRecover + * @param {any} isAck + * @param {any} alarmClass + * @param {any} callback + */ // function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) { // let _sourceTmp; // var _result = ""; @@ -84,54 +83,86 @@ function addzero(num) { // }); // }); // } -function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) { +function getAlarmByBaja( + startDate_millisecond, + endDate_millisecond, + isRecover, + isAck, + alarmClass, + callback +) { let _sourceTmp; var _result = ""; var _ss = []; var _bfName = ""; var _sourceName = ""; var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; + var _recoverState = isRecover ? "= 'normal'" : "= 'offnormal'"; 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 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 where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get() + //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 where alarmClass = '" + + alarmClass + + "' and timestamp.millis > " + + startDate_millisecond + + " and timestamp.millis < " + + endDate_millisecond + + " and sourceState " + + _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] + const alarmDisplayName = + record.get("alarmData").get("sourceName").split(":")[1] ?? + record.get("alarmData").get("sourceName").split(":")[0]; //console.log(alarmDisplayName) - _sourceTmp = alarmDisplayName.split('_'); + _sourceTmp = alarmDisplayName.split("_"); _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; _sourceName = _sourceTmp.slice(0, 8).join("_"); _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; if (!_sourceTmp.includes("undefined")) { - _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp').$cEncStr, alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, sourceTmp: _sourceTmp, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime'), ackedTime: record.get('ackTime').$cEncStr }) + _ss.push({ + buildingFloorName_zh: _bfName, + uuid: record.get("uuid"), + timestamp: record.get("timestamp").$cEncStr, + alarmClass: record.get("alarmClass"), + sourceName_zh: _sourceName, + sourceTmp: _sourceTmp, + msgText: record.get("alarmData").get("msgText"), + ackState: record.get("ackState"), + normalTime: record.get("normalTime"), + ackedTime: record.get("ackTime").$cEncStr, + }); } - _index++ + _index++; }, after: function () { - _result = { count: _index, data: _ss } + _result = { count: _index, data: _ss }; //console.log(552, _result); - if (typeof callback === 'function') { + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* 取得單一設備最新10筆異常資料 by baja -* @param {any} devicePath -* @param {any} callback -*/ + * 取得單一設備最新10筆異常資料 by baja + * @param {any} devicePath + * @param {any} callback + */ // function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { // var _result = ""; // var _ss = ""; @@ -168,46 +199,74 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { var _normalTime = ""; var _index = 0; //{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]} - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + + devicePath + + "%' order by timestamp desc" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { _occurrenceTime = ""; _normalTime = ""; // console.log(record.get('timestamp'),record.get('normalTime') ) - var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60 + var _resultUuid = record.get("uuid").toString().split("-"); //43dc7846-bd96-4be2-ab35-f11aec729c60 - var _occurrenceTime = new Date(record.get('timestamp').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); + var _occurrenceTime = new Date( + record.get("timestamp").$cEncStr + ).toLocaleString("zh-tw", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + }); // _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString(); //var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString(); - var _normalTime = new Date(record.get('normalTime').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); + var _normalTime = new Date( + record.get("normalTime").$cEncStr + ).toLocaleString("zh-tw", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + }); // _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString(); - var _msgText = record.get('alarmData').get('msgText');// == 1 ? _occurrenceTime : "未確認"; - var _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認"; - _ss.push({ uuid: _resultUuid[0], msgText: _msgText, ackState: _ackText, timestamp: _occurrenceTime, normalTime: _normalTime }) + var _msgText = record.get("alarmData").get("msgText"); // == 1 ? _occurrenceTime : "未確認"; + var _ackText = + record.get("ackState") == 1 ? _occurrenceTime : "未確認"; + _ss.push({ + uuid: _resultUuid[0], + msgText: _msgText, + ackState: _ackText, + timestamp: _occurrenceTime, + normalTime: _normalTime, + }); _index++; }, after: function () { - _result = JSON.stringify({ count: _index, data: _ss }) - if (typeof callback === 'function') { + _result = JSON.stringify({ count: _index, data: _ss }); + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* 在單一系統下,取得各個設備的異常狀態 -* @param {any} systemPath -* @param {any} callback -*/ + * 在單一系統下,取得各個設備的異常狀態 + * @param {any} systemPath + * @param {any} callback + */ // function getOneSystemAlarmStateByBaja(systemPath, callback) { // var _result = ""; // var _ss = ""; @@ -238,44 +297,70 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) { 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")*/ - 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() + 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) { return table.cursor({ each: function (record) { if (_index == 0) - _ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + _ss += + '{"uuid":"' + + record.get("uuid") + + '", "sourceName":"' + + record.get("alarmData").get("sourceName") + + '", "sourceState":"' + + record.get("sourceState") + + '"}'; else - _ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + _ss += + ',{"uuid":"' + + record.get("uuid") + + '", "sourceName":"' + + record.get("alarmData").get("sourceName") + + '", "sourceState":"' + + record.get("sourceState") + + '"}'; _index++; }, after: function () { - _result += '{' + '"count": ' + _index + ', "data":['; + _result += "{" + '"count": ' + _index + ', "data":['; _result += _ss; - _result += ']}'; - if (typeof callback === 'function') { + _result += "]}"; + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* 在單一系統下,取得各個系統的狀態 異常與否 -* @param {any} systemPath -* @param {any} callback -*/ + * 在單一系統下,取得各個系統的狀態 異常與否 + * @param {any} systemPath + * @param {any} callback + */ function getOneSystemStateByBaja(systemPath, callback) { var _result = ""; var _ss = ""; var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + + systemPath + + "%' order by timestamp desc" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { @@ -283,166 +368,248 @@ function getOneSystemStateByBaja(systemPath, callback) { // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; //else // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; - _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; + _ss += '{"sourceState":"' + record.get("sourceState") + '"}'; _index++; }, after: function () { - _result += '{' + '"count": ' + _index + ', "data":['; + _result += "{" + '"count": ' + _index + ', "data":['; _result += _ss; - _result += ']}'; - if (typeof callback === 'function') { + _result += "]}"; + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 查詢異常數量 -* @param {any} callback -*/ + * [首頁] 查詢異常數量 + * @param {any} callback + */ function getAlarmCountByBaja(callback) { var _result = { count: 0 }; var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get() + // require(['baja!'], function (baja) { + // baja.Ord.make("local:|foxs:"+port+"|alarm:|bql:select sourceState where sourceState = 'offnormal'").get() + // .then(function (table) { + // return table.cursor({ + // each: function (record) { + // _index++; + // }, + // after: function () { + // _result.count = _index; + // if (typeof callback === 'function') { + // callback(_result); + // } + // }, + // limit: -1, + // offset: 0 + // }); + // }); + // }); + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select COUNT(*) where sourceState = 'offnormal'" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); + if (typeof callback === "function") { + // console.log("@@@@@@@@@", record.get("COUNT$28toString$29").$val) + callback(record.get("COUNT$28toString$29").$val); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 查詢復歸數量 -* @param {any} callback -*/ + * [首頁] 查詢復歸數量 + * @param {any} callback + */ function getRecoverCountByBaja(callback) { var _result = { count: 0 }; var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get() + // require(['baja!'], function (baja) { + // baja.Ord.make("local:|foxs:"+port+"|alarm:|bql:select normalTime where normalTime != null").get() + // .then(function (table) { + // return table.cursor({ + // each: function (record) { + // _index++; + // }, + // after: function () { + // _result.count = _index; + // if (typeof callback === 'function') { + // callback(_result); + // } + // }, + // limit: -1, + // offset: 0 + // }); + // }); + // }); + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select COUNT(*) where normalTime != null" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); + if (typeof callback === "function") { + callback(record.get("COUNT$28toString$29").$val); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 查詢已確認異常數量 -* @param {any} callback -*/ + * [首頁] 查詢已確認異常數量 + * @param {any} callback + */ function getCheckedAckedCountByBaja(callback) { var _result = { count: 0 }; var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select ackState where ackState ='acked'").get() + // require(['baja!'], function (baja) { + // baja.Ord.make("local:|foxs:"+port+"|alarm:|bql:select ackState where ackState ='acked'").get() + // .then(function (table) { + // return table.cursor({ + // each: function (record) { + // _index++; + // }, + // after: function () { + // _result.count = _index; + // if (typeof callback === 'function') { + // callback(_result); + // } + // }, + // limit: -1, + // offset: 0 + // }); + // }); + // }); + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select COUNT(*) where ackState='acked'" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); + if (typeof callback === "function") { + callback(record.get("COUNT$28toString$29").$val); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 查詢未確認異常數量 -* @param {any} callback -*/ + * [首頁] 查詢未確認異常數量 + * @param {any} callback + */ function getUnCheckedAckedCountByBaja(callback) { var _result = { count: 0 }; var _index = 0; - - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select ackState where ackState ='unacked'").get() + // console.log("######getUnCheckedAckedCountByBaja#######"); + // require(['baja!'], function (baja) { + // baja.Ord.make("local:|foxs:"+port+"|alarm:|bql:select ackState where ackState ='unacked'").get() + // .then(function (table) { + // return table.cursor({ + // each: function (record) { + // _index++; + // }, + // after: function () { + // _result.count = _index; + // if (typeof callback === 'function') { + // callback(_result); + // } + // }, + // limit: -1, + // offset: 0 + // }); + // }); + // }); + require(["baja!"], function (baja) { + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select COUNT(*) where ackState='unacked'" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); + if (typeof callback === "function") { + callback(record.get("COUNT$28toString$29").$val); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 取得現在是異常的系統 (較快) -* @param {any} callback -*/ + * [首頁] 取得現在是異常的系統 (較快) + * @param {any} callback + */ function getSystemAlarmByBaja(callback) { var _result = { count: 0, data: [] }; var _index = 0; - require(['baja!'], function (baja) { - // console.log("ip:202.39.218.221|foxs:4912|alarm:|bql:select alarmClass where isAlarm") + require(["baja!"], function (baja) { + // console.log("local:|foxs:"+ port +"|alarm:|bql:select alarmClass where isAlarm") //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() + baja.Ord.make( + "local:|foxs:" + + port + + "|alarm:|bql:select alarmClass where sourceState = 'offnormal'" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { // console.log(record) let main = {}; - main.alarmClass = record.get('alarmClass'); + main.alarmClass = record.get("alarmClass"); _result.data.push(main); _index++; }, after: function () { _result.count = _index; - if (typeof callback === 'function') { + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); @@ -521,10 +688,10 @@ function getSystemAlarmByBaja(callback) { // } /** -* 取得單一設備異常 -* @param {any} devicePath -* @param {any} callback -*/ + * 取得單一設備異常 + * @param {any} devicePath + * @param {any} callback + */ function getOneDeviceAlarmByBaja(devicePath, callback) { let _sourceTmp; var _result = ""; @@ -533,77 +700,128 @@ function getOneDeviceAlarmByBaja(devicePath, callback) { var _sourceName = ""; var _index = 0; - require(['baja!'], function (baja) { + 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 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 where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() + 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 alarmData.sourceName like '%" + + devicePath + + "%' order by timestamp desc" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); + _sourceTmp = record + .get("alarmData") + .get("sourceName") + .toString() + .split("_"); _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; - _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp'), alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime') }) - _index++ + _ss.push({ + buildingFloorName_zh: _bfName, + uuid: record.get("uuid"), + timestamp: record.get("timestamp"), + alarmClass: record.get("alarmClass"), + sourceName_zh: _sourceName, + msgText: record.get("alarmData").get("msgText"), + ackState: record.get("ackState"), + normalTime: record.get("normalTime"), + }); + _index++; }, after: function () { - _result = { count: _index, data: _ss } + _result = { count: _index, data: _ss }; //console.log(552, _result); - if (typeof callback === 'function') { + if (typeof callback === "function") { callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } -function getOtherAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) { +function getOtherAlarmByBaja( + startDate_millisecond, + endDate_millisecond, + isRecover, + isAck, + callback +) { var _result = { count: 0, data: [] }; var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; + var _recoverState = isRecover ? "= 'normal'" : "= 'offnormal'"; var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; let startUrl = ""; if (startDate_millisecond) { startUrl = "timestamp.millis >= " + startDate_millisecond + " and "; } - console.log("告警2", "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 where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() + console.log( + "告警2", + "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 sourceState " + + _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 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 = {}; // 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') - _sourceTmp = alarmDisplayName.split('_'); - let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4] + const alarmDisplayName = + record.get("alarmData").get("sourceName").split(":")[1] ?? + record.get("alarmData").get("sourceName"); + _sourceTmp = alarmDisplayName.split("_"); + let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; let _sourceName = _sourceTmp.slice(0, 8).join("_"); _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; - console.log(record.get('alarmData').get('sourceName'), _bfName, _sourceName) + console.log( + record.get("alarmData").get("sourceName"), + _bfName, + _sourceName + ); main.buildingFloorName_zh = _bfName; main.sourceName_zh = _sourceName; - main.uuid = record.get('uuid').$val; - main.timestamp = record.get('timestamp').$cEncStr; - main.alarmClass = record.get('alarmClass'); + main.uuid = record.get("uuid").$val; + main.timestamp = record.get("timestamp").$cEncStr; + main.alarmClass = record.get("alarmClass"); 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 + 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")) { main.buildingFloorName_zh = "無"; - main.alarmClass = "系統異常"; + main.alarmClass = "系統/設備異常"; main.sourceTmp = "無"; main.msgText = ""; _result.data.push(main); @@ -613,61 +831,78 @@ function getOtherAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecov }, after: function () { _result.count = _index; - if (typeof callback === 'function') { + if (typeof callback === "function") { //console.log(_result) callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } -function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) { +function getAllDeviceAlarmByBaja( + startDate_millisecond, + endDate_millisecond, + isRecover, + isAck, + callback +) { var _result = { count: 0, data: [] }; var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; + var _recoverState = isRecover ? "= 'normal'" : "= 'offnormal'"; var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; 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 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 where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() + // 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 where " + + startUrl + + "timestamp.millis <= " + + endDate_millisecond + + " and sourceState " + + _recoverState + + " and ackState " + + _ackState + + " order by timestamp desc" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - // console.log(record) let main = {}; // 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') - _sourceTmp = alarmDisplayName.split('_'); - let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4] + const alarmDisplayName = + record.get("alarmData").get("sourceName").split(":")[1] ?? + record.get("alarmData").get("sourceName"); + _sourceTmp = alarmDisplayName.split("_"); + let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; let _sourceName = _sourceTmp.slice(0, 8).join("_"); _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; main.buildingFloorName_zh = _bfName; main.sourceName_zh = _sourceName; - main.uuid = record.get('uuid').$val; - main.timestamp = record.get('timestamp').$cEncStr; - main.alarmClass = record.get('alarmClass'); + main.uuid = record.get("uuid").$val; + main.timestamp = record.get("timestamp").$cEncStr; + main.alarmClass = record.get("alarmClass"); 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 + 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) main.buildingFloorName_zh = "無"; - main.alarmClass = "系統異常"; + main.alarmClass = "系統/設備異常"; main.sourceTmp = "無"; main.msgText = ""; } @@ -676,23 +911,28 @@ function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isR }, after: function () { _result.count = _index; - if (typeof callback === 'function') { + if (typeof callback === "function") { //console.log(_result) callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } - -function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) { +function getDeviceAlarmCardByBaja( + startDate_millisecond, + endDate_millisecond, + isRecover, + isAck, + callback +) { var _result = { count: 0, data: [] }; var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; + var _recoverState = isRecover ? "= 'normal'" : "= 'offnormal'"; var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; let startUrl = ""; @@ -700,35 +940,47 @@ function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, is 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"); - 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 where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() + 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 where " + + startUrl + + "timestamp.millis <= " + + endDate_millisecond + + " and sourceState " + + _recoverState + + " and ackState " + + _ackState + + " order by timestamp desc" + ) + .get() .then(function (table) { return table.cursor({ each: function (record) { - // console.log(record) + // console.log("%%%%%%%%%%%%%%%%", record.get('alarmData').get('alarmClassDisplayName')) 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] + 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] + _sourceTmp = alarmDisplayName.split("_"); + let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; let _sourceName = _sourceTmp.slice(0, 8).join("_"); _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; main.buildingFloorName_zh = _bfName; main.sourceName_zh = _sourceName; - main.uuid = record.get('uuid').$val; - main.timestamp = record.get('timestamp').$cEncStr; - main.alarmClass = record.get('alarmClass'); + main.uuid = record.get("uuid").$val; + main.timestamp = record.get("timestamp").$cEncStr; + main.alarmClass = record.get("alarmClass"); 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 + 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) // } @@ -737,49 +989,64 @@ function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, is }, after: function () { _result.count = _index; - if (typeof callback === 'function') { + if (typeof callback === "function") { //console.log(_result) callback(_result); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); } /** -* [首頁] 圓餅圖資料 - 全部的異常 -* @param {any} callback -*/ + * [首頁] 圓餅圖資料 - 全部的異常 + * @param {any} callback + */ function getAlarmForChartDataByBaja(callback) { var _result = ""; var _ss = ""; var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select *").get() + require(["baja!"], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select *") + .get() .then(function (table) { return table.cursor({ each: function (record) { if (_index == 0) - _ss += '{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + _ss += + '{"alarmClass":"' + + record.get("alarmClass") + + '", "ackState":"' + + record.get("ackState") + + '", "normalTime":"' + + record.get("normalTime") + + '"}'; else - _ss += ',{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + _ss += + ',{"alarmClass":"' + + record.get("alarmClass") + + '", "ackState":"' + + record.get("ackState") + + '", "normalTime":"' + + record.get("normalTime") + + '"}'; _index++; }, after: function () { //_result += '{' + '"count": ' + _index + ', "data":['; //_result += _ss; //_result += ']}'; - if (typeof callback === 'function') { + if (typeof callback === "function") { callback(_index); } }, limit: -1, - offset: 0 + offset: 0, }); }); }); -} \ No newline at end of file +} From 6458a10215b2ee49aa848484c950b2966ea9dc15 Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 2 Jun 2023 18:02:11 +0800 Subject: [PATCH 2/6] =?UTF-8?q?[=E5=90=8E=E5=8F=B0]=20=E4=BF=AE=E6=94=B9ni?= =?UTF-8?q?agara=20=E5=90=8C=E6=AD=A5device=5Fitem=20=E5=90=8C=E6=AD=A5is?= =?UTF-8?q?=5Flink,=20is=5Fhistory=20=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Startup.cs | 12 +++++----- .../NiagaraDataSynchronizeRepository.cs | 24 +++++++++++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Backend/Startup.cs b/Backend/Startup.cs index a85040b..b5b000e 100644 --- a/Backend/Startup.cs +++ b/Backend/Startup.cs @@ -170,12 +170,12 @@ namespace Backend ); #endregion - #region wɨoHAPI - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue("BackgroundServiceCron:WeatherAPIJob")) - ); - #endregion + //#region wɨoHAPI + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue("BackgroundServiceCron:WeatherAPIJob")) + //); + //#endregion double loginExpireMinute = this.Configuration.GetValue("LoginExpireMinute"); services.AddSession(options => diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index d293e89..53e91eb 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -506,11 +506,25 @@ namespace Repository.BackendRepository.Implement //本次有匯入的 isLink 改為 1, 沒有的 isLink = 0 sb.Append($@" SET SQL_SAFE_UPDATES = 0; - UPDATE device_item d LEFT JOIN import_niagara_item m - ON d.device_system_tag = m.device_system_tag and d.device_name_tag = m.device_name_tag and d.points = m.device_point_name and d.full_name = m.full_name and d.is_show_history = m.is_history - SET d.is_link = case when device_point_name is null then 0 else 1 end , - d.is_show_history = case when device_point_name is null then 0 else 1 end - where m.is_history = 1 + update + device_item d + LEFT JOIN import_niagara_item m + ON d.device_system_tag = m.device_system_tag + and d.device_name_tag = m.device_name_tag + and d.points = m.device_point_name + and d.full_name = m.full_name + SET d.is_link = case when device_point_name is null then 0 else 1 end; + + update + device_item d + LEFT JOIN import_niagara_item m + ON d.device_system_tag = m.device_system_tag + and d.device_name_tag = m.device_name_tag + and d.points = m.device_point_name + and d.full_name = m.full_name + and d.is_show_history = m.is_history + SET d.is_show_history = case when device_point_name is null then 0 else 1 end + where (m.is_history = 1 or d.is_show_history); "); await conn.ExecuteAsync(sb.ToString()); From 01b4db1b92e214865003f78d3723386f578ad31a Mon Sep 17 00:00:00 2001 From: dev01 Date: Mon, 5 Jun 2023 10:26:40 +0800 Subject: [PATCH 3/6] =?UTF-8?q?[=E5=89=8D=E5=8F=B0]=20=E5=9C=96=E8=B3=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=89=8D=E7=AB=AF=E7=A8=8B=E5=BA=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_graphManagement.html | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index 7207b36..ddbe838 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -144,6 +144,7 @@ var uploadFiles = {}; var curActGraid = 0; var cookies = new YourTeam.Utility.Cookie(); + var token = cookies.get("JWT-Authorization"); $(function () { initList(); @@ -335,17 +336,17 @@ //uploader["graMyAsBuilt"][0].dropzone.removeAllFiles(true); //$("#graMyAsBuilt .dz-preview").remove(); }) - + function getGraCatList(callback) { - let url = baseApiUrl + "/GraphManage/GraphManageTreeList"; + let url = baseApiUrl + "/GraphManage/GraphManageTreeList"; ytAjax = new YourTeam.Ajax(url, null, function (res) { if (!res || res.code != "0000" || !res.data) { } else { - res.data.forEach(x => x.parent = x.system_parent_id); - res.data.forEach(x => x.text = x.system_key); - res.data.forEach(x => x.parent = x.parent); + res.data.forEach(x => x.parent = x.parent_id); + res.data.forEach(x => x.text = x.name); + // res.data.forEach(x => x.parent = x.parent); callback ? callback(res.data) : ""; } }, null, "POST").send(); @@ -454,12 +455,12 @@ }) $("#graTree").on('create_node.jstree', function (e, data) { let main = {}; - main.system_key = data.node.text; - main.system_parent_id = parseInt(data.node.parent); + main.name = data.node.text; + main.parent_id = parseInt(data.node.parent); objSendData.Data = main; - ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/SaveVar", objSendData, function (res) { + ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/SaveGraphManageTree", objSendData, function (res) { if (!res || res.code != "0000") { data.instance.delete_node(data.node); toast_error(res.msg || common.SysErr); @@ -475,10 +476,10 @@ let main = {} main.id = parseInt(data.node.id); - main.system_key = data.node.text; + main.name = data.node.text; objSendData.Data = main; - ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/EditVar", objSendData, function (res) { + ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/EditGraphManageTree", objSendData, function (res) { if (!res || res.code != "0000" || !res.data) { toast_error(res.msg || common.SysErr); } else { @@ -495,7 +496,7 @@ if (!isNaN(parseInt(data.node.id))) { main.id = parseInt(data.node.id); objSendData.Data = main; - ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/DelVar", objSendData, function (res) { + ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/DelGraphManageTree", objSendData, function (res) { if (!res || res.code != "0000" || !res.data) { toast_error(res.msg || common.SysErr); } else { From 49bff5f78b39042eab48e2864221e8891bdbe48c Mon Sep 17 00:00:00 2001 From: Celeste Date: Mon, 5 Jun 2023 13:36:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=8D=B3=E6=99=82=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=96=87=E5=AD=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/js/n4js/alarmbaja.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index b49054a..988f8da 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -820,10 +820,10 @@ function getOtherAlarmByBaja( main.ackedTime = record.get("ackTime").$cEncStr; main.ackState = record.get("ackState").$ordinal; if (_sourceTmp.includes("undefined")) { - main.buildingFloorName_zh = "無"; - main.alarmClass = "系統/設備異常"; - main.sourceTmp = "無"; - main.msgText = ""; + main.buildingFloorName_zh = ""; + //main.alarmClass = "系統異常"; + main.sourceTmp = ""; + //main.msgText = ""; _result.data.push(main); } @@ -901,10 +901,10 @@ function getAllDeviceAlarmByBaja( main.ackState = record.get("ackState").$ordinal; if (_sourceTmp.includes("undefined")) { // console.log(main.ackState) - main.buildingFloorName_zh = "無"; - main.alarmClass = "系統/設備異常"; - main.sourceTmp = "無"; - main.msgText = ""; + main.buildingFloorName_zh = ""; + //main.alarmClass = "系統異常"; + main.sourceTmp = ""; + //main.msgText = ""; } _result.data.push(main); _index++; From dd244589c572ca622a516c6a204bdc4dd7b9dbc0 Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 6 Jun 2023 09:07:18 +0800 Subject: [PATCH 5/6] =?UTF-8?q?[=E5=89=8D=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8D=B3=E6=99=82=E5=91=8A=E8=AD=A6=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=B6=AD=E4=BF=AE=E5=96=AE=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_alert.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Frontend/_alert.html b/Frontend/_alert.html index 7ca1713..1938618 100644 --- a/Frontend/_alert.html +++ b/Frontend/_alert.html @@ -89,7 +89,7 @@
-
+
@@ -218,7 +218,7 @@ pageAct.alrSelSysSub = []; pageAct.selAllSysSub = false; first = true; - let dataAlarm = []; + // let dataAlarm = []; var historyTable = null; var elemIndex = 0; var index = 0; @@ -386,8 +386,8 @@ $('#inpFixDoCode').val(alr_fixDoCode); }); - onEvent('click', '#OpeRecSendBtn', function () { - let form = $("#opeRecForm"); + onEvent('click', '#alr_OpeRecSendBtn', function () { + let form = $("#alr_opeRecForm"); $(form).validate({ rules: { inpWorTyp: { required: true }, @@ -441,7 +441,7 @@ } else { //toast_ok(common.AddSuc); //$("#opeFirmModal").modal("hide"); - $("#OpeRecCanBtn").click(); + $("#alr_OpeRecCanBtn").click(); getData(); } } From fd12f921a1c443d0465351a02d9b6c2c8ff3ad57 Mon Sep 17 00:00:00 2001 From: Celeste Date: Tue, 6 Jun 2023 10:35:17 +0800 Subject: [PATCH 6/6] =?UTF-8?q?[=E5=89=8D=E5=8F=B0]=20=E5=8F=8A=E6=99=82?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E9=96=83=E7=88=8D=E9=8C=AF=E8=AA=A4=20|=20al?= =?UTF-8?q?armbaja=20=E8=AA=9E=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/index.html | 2 +- Frontend/js/n4js/alarmbaja.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Frontend/index.html b/Frontend/index.html index d7b3724..9b47826 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -1152,7 +1152,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li getAlarmSub(data); } - alarmIconBlink(); + alarmIconBlink(data); }); getAlarm(); }); diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index 988f8da..8095336 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -780,7 +780,7 @@ function getOtherAlarmByBaja( startUrl + "timestamp.millis <= " + endDate_millisecond + - " and normalTime " + + " and sourceState " + _recoverState + " and ackState " + _ackState +