From f094af892ad3cfba8a24e400617068840dc53e1a Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 24 May 2023 12:58:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20=E4=B8=8B=E8=BC=89=E6=AA=94=E6=A1=88=E5=95=8F=E9=A1=8C=20[?= =?UTF-8?q?=E5=89=8D=E7=AB=AF]=20=E4=BF=AE=E6=94=B9=E5=89=8D=E5=8F=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9C=80=E6=B1=82=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_alert.html | 48 ++++++---- Frontend/_graphManagement.html | 2 +- Frontend/_historyData.html | 77 ++++++++-------- Frontend/_operation.html | 82 ++++++------------ .../ApiControllers/FileController.cs | 14 --- .../ApiControllers/HistoryController.cs | 9 +- .../ApiControllers/LoginController.cs | 13 +++ .../excel/history/歷史資料_2023-05-23.xlsx | Bin 0 -> 5279 bytes 8 files changed, 118 insertions(+), 127 deletions(-) create mode 100644 FrontendWebApi/wwwroot/excel/history/歷史資料_2023-05-23.xlsx 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 @@ -