diff --git a/Frontend/_alert.html b/Frontend/_alert.html index 588e5d4..89551d1 100644 --- a/Frontend/_alert.html +++ b/Frontend/_alert.html @@ -218,6 +218,7 @@ pageAct.alrSelSysSub = []; pageAct.selAllSysSub = false; first = true; + let dataAlarm = []; $(function () { initDropzone(); @@ -247,10 +248,9 @@ // console.log(this); pageAct.selAllSysSub = true; - - $.each($('input[type=checkbox][data-type=sub]:checked'), function (i, v) { - $(v).click(); - }); + //$.each($('input[type=checkbox][data-type=sub]:checked'), function (i, v) { + // $(v).click(); + //}); if (pageAct.SysType == "all") { if (!$(this).is(':checked')) { @@ -595,7 +595,6 @@ } function selAllSysVal(elem) { - $(loadEle).Loading("start"); pageAct.selAllSysSub = true; if ($(elem).html() == '全選類別') { $('#alr_mainList input').map(function (i, v) { @@ -630,6 +629,8 @@ } function getData(type = null) { + dataAlarm = []; + $(loadEle).Loading("start"); let enddate = new Date(new Date().setDate(new Date(pageAct.alr_enddate).getDate() + 1)).getTime(); if (pageAct.SysType == "all") { @@ -637,15 +638,28 @@ } else { let elem = $('input[type=checkbox][data-type=sub]:checked'); - if (elem[0]?.id === "other") { - console.log(elem[0]?.id) - getOtherAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert); - return + if (elem && elem.length > 0) { + elem.each(function (i, v) { + if (v?.id === "other") { + console.log(v?.id) + getOtherAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, stackData); + } + else { + pageAct.selSysMain = $(v).parent().data('main'); + pageAct.selSysSub = $(v).prop('id'); + getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", stackData); + } + }); } - pageAct.selSysMain = $(elem).parent().data('main'); - pageAct.selSysSub = $(elem).prop('id'); - getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", callBackFromOneDeviceAlert); } + $(loadEle).Loading("close"); + } + + function stackData(res) { + res.data.forEach(v => { + dataAlarm.push(v); + }); + callBackFromOneDeviceAlert(dataAlarm); } function callBackFromAllDeviceAlert(res) { @@ -657,20 +671,18 @@ if (res.data.length > 0) t.fnAddData(res.data); } - $(loadEle).Loading("close"); } function callBackFromOneDeviceAlert(res) { - //res = JSON.parse(res); - refTable(res.data); + refTable(res); + if (historyTable != null) { let t = $('#alertTable').dataTable(); t.fnClearTable(); - if (res.data.length > 0) - t.fnAddData(res.data); + if (res.length > 0) + t.fnAddData(res); } - $(loadEle).Loading("close"); } function refTable(data) { diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index 1647fea..7207b36 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -337,7 +337,7 @@ }) function getGraCatList(callback) { - let url = baseApiUrl + "/GraphManage/VarList"; + let url = baseApiUrl + "/GraphManage/GraphManageTreeList"; ytAjax = new YourTeam.Ajax(url, null, function (res) { if (!res || res.code != "0000" || !res.data) { diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html index 0f79cb0..ac91126 100644 --- a/Frontend/_historyData.html +++ b/Frontend/_historyData.html @@ -264,9 +264,9 @@ function getData(start = null, end = null) { var sdt = new Date(); var edt = new Date(new Date().setDate(sdt.getDate() + 1)); + $(loadEle).Loading("start"); start = start ?? sdt.toLocaleDateString(); end = end ?? edt.toLocaleDateString(); - $(loadEle).Loading("start"); callBackFromHistory() getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem, new Date(start).getTime(), @@ -394,48 +394,49 @@ v.type = pageAct.devicePoiName.split(" ")[0]; }); - let tag = "#historyTable"; + let tag = "#historyTable"; - let column_defs = [ - { "targets": [0], "width": "20%", "sortable": true }, - { "targets": [1], "width": "20%", "sortable": true }, - { "targets": [2], "width": "20%", "sortable": true } - ]; + let column_defs = [ + { "targets": [0], "width": "20%", "sortable": true }, + { "targets": [1], "width": "20%", "sortable": true }, + { "targets": [2], "width": "20%", "sortable": true } + ]; - let columns = [ - { - "title": "類別", - "data": "type" - }, - { - "title": "設備名稱", - "data": "deviceName", - }, - { - "title": "數值", - "data": "value", - "render": function (data) { - if (isNaN(data.toString())) { - return data - } - return data.roundDecimal(2); - } - }, - { - "title": "紀錄時間", - "data": "timestamp", - "render": function (data) { - // console.log(data) - return displayDate(data, "datetime"); - } - } - ]; + let columns = [ + { + "title": "類別", + "data": "type" + }, + { + "title": "設備名稱", + "data": "deviceName", + }, + { + "title": "數值", + "data": "value", + "render": function (data) { + if (isNaN(data.toString())) { + return data + } + return data.roundDecimal(2); + } + }, + { + "title": "紀錄時間", + "data": "timestamp", + "render": function (data) { + // console.log(data) + return displayDate(data, "datetime"); + } + } + ]; - historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); + historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); } } function exportExcel() { + $(loadEle).Loading("start"); let url = baseApiUrl + "/History/OpeExportExcel"; objSendData.Data = $('#historyTable').dataTable().fnGetData(); @@ -446,8 +447,10 @@ }); ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) { - if (rel.code == "0000") + if (rel.code == "0000") { location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization"); + } }, null, "POST").send(); + $(loadEle).Loading("close"); } \ No newline at end of file diff --git a/Frontend/_operation.html b/Frontend/_operation.html index 0e6f5e6..809a260 100644 --- a/Frontend/_operation.html +++ b/Frontend/_operation.html @@ -8,22 +8,13 @@
- +
- - + +
@@ -69,7 +60,7 @@ 新增 - 匯出 + 匯出
@@ -85,8 +76,7 @@ -