From c1ba5c1a4dbb18e96ee47941918df10844e3861c Mon Sep 17 00:00:00 2001 From: dev01 Date: Tue, 31 Oct 2023 14:50:01 +0800 Subject: [PATCH] =?UTF-8?q?[WebAPI][=E7=B7=8A=E6=80=A5=E6=87=89=E8=AE=8A]?= =?UTF-8?q?=20=E5=8E=9F=E5=BE=9E=20variable=20=E5=8F=96=E5=BE=97=20http,?= =?UTF-8?q?=20niagaraRootName=20=E6=94=B9=E7=82=BA=20building=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=AC=84=E4=BD=8D=E5=8F=96=20building=20=E6=AC=84?= =?UTF-8?q?=E4=BD=8D=20|=20[=E5=89=8D=E7=AB=AF][=E7=B7=8A=E6=80=A5?= =?UTF-8?q?=E6=87=89=E8=AE=8A]=20=E5=A2=9E=E5=8A=A0=E6=AF=94=E5=B0=8D=20ni?= =?UTF-8?q?agara=20alarm=20=E8=88=87=20disaster=20device=20Loading=20|=20[?= =?UTF-8?q?=E5=89=8D=E7=AB=AF][=E7=B7=8A=E6=80=A5=E6=87=89=E8=AE=8A?= =?UTF-8?q?=E7=A1=AC=E9=AB=94=E8=A8=AD=E5=82=99]=20=E5=B9=B3=E9=9D=A2?= =?UTF-8?q?=E5=9C=96=E9=80=A3=E7=B5=90=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmergencyDeviceController.cs | 11 +++-------- .../Views/EmergencyDeviceMenu/Index.cshtml | 19 +++++++++++++++++-- .../Views/EmergencyHardwareMenu/Index.cshtml | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs index ea17216..7397b26 100644 --- a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs @@ -132,18 +132,15 @@ namespace FrontendWebApi.ApiControllers if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0) selectdevice.select_disasters = new List(); - var sqlString = $@"SELECT system_key as 'Name', system_value as 'Value' FROM variable where system_type = 'website_config' AND deleted = 0"; - List webSiteConfig = await backendRepository.GetAllAsync(sqlString); - deviceQue += $" AND d.device_building_tag in @building_tag "; disasQue = " where dd.device_system_value IN @disasters "; - sqlString = @$"select + var sqlString = @$"select d.device_guid, d.device_number, d.full_name AS device_name, d.device_building_tag AS building_tag, b.full_name AS building_name, - CONCAT(@niagara_http, '://',b.ip_address , ':', b.ip_port,'/file/',@niagaraRootName) AS ip_address, + CONCAT(b.ip_http, '://',b.ip_address , ':', b.ip_port,'/file/',b.niagara_root_name) AS ip_address, v.layer2, v.layer2_name, v.system_value AS layer3, @@ -181,9 +178,7 @@ namespace FrontendWebApi.ApiControllers disasters = selectdevice.select_disasters, building_tag = selectdevice.selectbuilding, floor = selectdevice.select_Floors, - layer3 = selectdevice.select_Layer3, - niagaraRootName = webSiteConfig.FirstOrDefault(w => w.Name == "frontend_niagara_root_name")?.Value, - niagara_http = webSiteConfig.FirstOrDefault(w => w.Name == "frontend_http")?.Value, + layer3 = selectdevice.select_Layer3 }); apiResult.Code = "0000"; diff --git a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml index e31a844..9fe73ab 100644 --- a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml @@ -53,6 +53,12 @@
+
+
+ Loading... +
+ 正在取得即時異常設備 +
@@ -365,7 +371,6 @@ if (!enable_alarm_timer) { return; } - GetAlarmFromObix((data) => { var is_diff = false; if (Object.keys(temp_alarm_device).length == Object.keys(data.alarmorion).length) { @@ -395,6 +400,7 @@ //data.buildingAlarmDeviceAmount.forEach(function (item) { // $(`#${item.building_tag}_device_amount`).html(item.device_amount); //}); + setNiagaraLoading(true); ResetDeviceTable(); } }) @@ -729,7 +735,7 @@ return []; } - + setNiagaraLoading(false); return data; } @@ -851,6 +857,15 @@ }); //#endregion + function setNiagaraLoading(isShow = true,text = "更新列表中") { + if(isShow) { + $("#getNiagaraLoadingText").text(text); + $("#getNiagaraLoading").animate({opacity:1},500); + } else { + $("#getNiagaraLoading").animate({opacity:0},500); + } + } + function GetAlarmFromObix(callback = null){ let url = "/api/Alarm/GetAlarmFromObix" $.ajax({ diff --git a/FrontendWebApi/Views/EmergencyHardwareMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyHardwareMenu/Index.cshtml index 9688bed..2b5bda3 100644 --- a/FrontendWebApi/Views/EmergencyHardwareMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyHardwareMenu/Index.cshtml @@ -577,7 +577,7 @@ `;*@ var html = ` - + ${data} `;