From 38564397c9e6037d1aac0d306a817d53f81b3264 Mon Sep 17 00:00:00 2001 From: dev01 Date: Thu, 21 Sep 2023 10:01:12 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=89=8D=E5=8F=B0API][=E7=B7=8A=E6=80=A5?= =?UTF-8?q?=E6=87=89=E8=AE=8A][=E4=BA=8B=E4=BB=B6=E6=B8=85=E5=96=AE]=20?= =?UTF-8?q?=E6=8B=BF=E6=8E=89=E5=8E=9F=E6=9C=AC=E6=A3=9F=E5=88=A5=E6=8C=89?= =?UTF-8?q?=E9=88=95=E5=8F=B3=E9=82=8A=E8=AD=A6=E5=A0=B1=E8=A8=AD=E5=82=99?= =?UTF-8?q?=E6=95=B8=E5=AD=97=20|=20=E8=AD=A6=E5=91=8A=E6=A3=9F=E5=88=A5?= =?UTF-8?q?=E6=94=B9=E7=82=BA=E4=BB=A5=E7=B4=85=E8=89=B2=E6=8C=89=E9=88=95?= =?UTF-8?q?=E5=91=88=E7=8F=BE=20|=20=E4=BF=AE=E6=AD=A3=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E8=A8=AD=E5=82=99=E6=B8=85=E5=96=AE=E5=8F=96=E5=BE=97=E8=AA=9E?= =?UTF-8?q?=E6=B3=95=20SQL=20d.device=5Fsystem=5Fcategory=5Flayer3=20=3D>?= =?UTF-8?q?=20d.devic=5Fname=5Ftag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/AlarmController.cs | 15 ++++++++------- .../ApiControllers/EmergencyDeviceController.cs | 4 ++-- .../Views/EmergencyDeviceMenu/Index.cshtml | 14 +++++++------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/FrontendWebApi/ApiControllers/AlarmController.cs b/FrontendWebApi/ApiControllers/AlarmController.cs index 7179149..924ab5a 100644 --- a/FrontendWebApi/ApiControllers/AlarmController.cs +++ b/FrontendWebApi/ApiControllers/AlarmController.cs @@ -65,7 +65,7 @@ namespace FrontendWebApi.ApiControllers client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded); // 建構 XML 數據 string xmlData = @$" - + "; HttpContent content = new StringContent(xmlData, Encoding.UTF8, "application/xml"); @@ -130,12 +130,13 @@ namespace FrontendWebApi.ApiControllers }).ToList(); // obix alarm 回傳 device_number + point 取出棟別分組 - alarmObj.buildingAlarmDeviceAmount = alarmObj.alarmorion.Where(a => a.device_number?.Contains("_") ?? false) - .GroupBy(g => g.device_number.Split("_")[0]).Select(g => new BuildingAlarmDeviceAmount() - { - building_tag = g.Key, - device_amount = g.Count() - }).ToList(); + // 20230920 - 佳豪表示棟別按鈕不顯示數量 + //alarmObj.buildingAlarmDeviceAmount = alarmObj.alarmorion.Where(a => a.device_number?.Contains("_") ?? false) + // .GroupBy(g => g.device_number.Split("_")[0]).Select(g => new BuildingAlarmDeviceAmount() + //{ + // building_tag = g.Key, + // device_amount = g.Count() + //}).ToList(); apiResult.Data = alarmObj; diff --git a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs index 0b92271..6bad12b 100644 --- a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs @@ -135,7 +135,7 @@ namespace FrontendWebApi.ApiControllers d.device_guid, d.device_number, d.full_name AS device_name, - d.device_building_tag, + d.device_building_tag AS building_tag, b.full_name AS building_name, CONCAT(b.ip_address , ':', b.ip_port) AS ip_address, v.layer2, @@ -163,7 +163,7 @@ namespace FrontendWebApi.ApiControllers from variable v where v.system_type = 'device_system_category_layer3') v LEFT JOIN variable v2 ON v2.deleted = 0 AND v.system_parent_id = v2.id - ) v on v.system_value = d.device_system_category_layer3 + ) v on v.system_value = d.device_name_tag left join device_disaster dd on dd.device_guid = d.device_guid left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value LEFT JOIN building b ON b.deleted = 0 AND d.device_building_tag = b.building_tag diff --git a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml index a814352..951d24f 100644 --- a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml @@ -391,10 +391,10 @@ if (show_mode == "alarm" && (is_need_reload || is_diff)) { enable_alarm_timer = false; //關閉查詢異常設備,避免重複呼叫 - $("#building").find(".building_device_amount").html(0); - data.buildingAlarmDeviceAmount.forEach(function (item) { - $(`#${item.building_tag}_device_amount`).html(item.device_amount); - }); + //$("#building").find(".building_device_amount").html(0); + //data.buildingAlarmDeviceAmount.forEach(function (item) { + // $(`#${item.building_tag}_device_amount`).html(item.device_amount); + //}); ResetDeviceTable(); } }) @@ -639,6 +639,7 @@ is_need_reload = true; } + $(`button[id^=buildingBtn]`).removeClass("btn-danger").addClass("btn-secondary"); enable_alarm_timer = true; is_need_reload = false; @@ -710,7 +711,7 @@ backfill_layer3_alarm_device_amount[temp_layer3_index].device_amount += 1; } - + $(`#buildingBtn${temp_device.building_tag}`).removeClass("btn-secondary").addClass("btn-danger"); alarm_data.push(obj); } }); @@ -949,8 +950,7 @@ `;*@ html += `
- - +
`; }); $('#building').append(``);