diff --git a/Backend/ApiControllers/DeviceApiController.cs b/Backend/ApiControllers/DeviceApiController.cs index cf3547f..724d76d 100644 --- a/Backend/ApiControllers/DeviceApiController.cs +++ b/Backend/ApiControllers/DeviceApiController.cs @@ -61,10 +61,10 @@ namespace Backend.ApiControllers { { "@user_guid", myUser.userinfo_guid }, { "@operation_type", 1 }, //1:名稱修改 - { "@building_guid", GetOne.Building_guid }, - { "@main_system_guid", GetOne.Main_system_guid }, - { "@sub_system_guid", GetOne.Sub_system_guid }, - { "@floor_guid", GetOne.Floor_guid }, + { "@building_guid", GetOne.building_tag }, + { "@main_system_guid", GetOne.device_system_tag }, + { "@sub_system_guid", GetOne.device_name_tag }, + { "@floor_guid", GetOne.floor_tag }, { "@device_guid", GetOne.Device_guid }, { "@action_name", "修改名稱" }, { "@parameter", JsonConvert.SerializeObject(change) }, diff --git a/Backend/Models/Device.cs b/Backend/Models/Device.cs index c611d80..ece58ee 100644 --- a/Backend/Models/Device.cs +++ b/Backend/Models/Device.cs @@ -54,13 +54,13 @@ namespace Backend.Models public string Device_guid { get; set; } public byte Deleted { get; set; } public byte Status { get; set; } - public string Building_guid { get; set; } + public string building_tag { get; set; } public string Building_full_name { get; set; } public string Main_system_guid { get; set; } public string Main_system_full_name { get; set; } public string Sub_system_guid { get; set; } public string Sub_system_full_name { get; set; } - public string Floor_guid { get; set; } + public string floor_tag { get; set; } public string Floor_full_name { get; set; } public string Device_coordinate { get; set; } public string Device_full_name { get; set; } @@ -76,7 +76,8 @@ namespace Backend.Models public string Device_flashing { get; set; } public string Device_ip { get; set; } public string Device_port { get; set; } - public string Device_name_tag { get; set; } + public string device_name_tag { get; set; } + public string device_system_tag { get; set; } public List Device_disasters { get; set; } //防災類型 public List Device_nodes { get; set; } //設備子節點 } 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..8c23cb7 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(), @@ -363,7 +363,7 @@ let start = new Date($('#his_startdate').val()); let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1)); - if (pageAct.dateType == "day") + if (pageAct.dateType == "today") end = new Date(new Date().setDate(start.getDate() + 1)); else if (pageAct.dateType == "month") { start = new Date($('#getmonth').val()); @@ -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(); @@ -444,10 +445,11 @@ v.endtime = $('#his_enddate input').val() === "" ? null : new Date($('#his_enddate input').val()); v.dateType = pageAct.dateType; }); - 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 @@ -