[WebAPI][緊急應變] 原從 variable 取得 http, niagaraRootName 改為 building 新增欄位取 building 欄位 | [前端][緊急應變] 增加比對 niagara alarm 與 disaster device Loading | [前端][緊急應變硬體設備] 平面圖連結調整

This commit is contained in:
dev01 2023-10-31 14:50:01 +08:00
parent a37224647e
commit c1ba5c1a4d
3 changed files with 21 additions and 11 deletions

View File

@ -132,18 +132,15 @@ namespace FrontendWebApi.ApiControllers
if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0) if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0)
selectdevice.select_disasters = new List<int>(); selectdevice.select_disasters = new List<int>();
var sqlString = $@"SELECT system_key as 'Name', system_value as 'Value' FROM variable where system_type = 'website_config' AND deleted = 0";
List<KeyValue> webSiteConfig = await backendRepository.GetAllAsync<KeyValue>(sqlString);
deviceQue += $" AND d.device_building_tag in @building_tag "; deviceQue += $" AND d.device_building_tag in @building_tag ";
disasQue = " where dd.device_system_value IN @disasters "; disasQue = " where dd.device_system_value IN @disasters ";
sqlString = @$"select var sqlString = @$"select
d.device_guid, d.device_guid,
d.device_number, d.device_number,
d.full_name AS device_name, d.full_name AS device_name,
d.device_building_tag AS building_tag, d.device_building_tag AS building_tag,
b.full_name AS building_name, 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,
v.layer2_name, v.layer2_name,
v.system_value AS layer3, v.system_value AS layer3,
@ -181,9 +178,7 @@ namespace FrontendWebApi.ApiControllers
disasters = selectdevice.select_disasters, disasters = selectdevice.select_disasters,
building_tag = selectdevice.selectbuilding, building_tag = selectdevice.selectbuilding,
floor = selectdevice.select_Floors, floor = selectdevice.select_Floors,
layer3 = selectdevice.select_Layer3, 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,
}); });
apiResult.Code = "0000"; apiResult.Code = "0000";

View File

@ -53,6 +53,12 @@
<div class="frame-wrap"> <div class="frame-wrap">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div id="getNiagaraLoading" class="row m-0 align-items-center" style="opacity:0">
<div class="spinner-border text-info mx-2" role="status" style="width: 1.2rem; height: 1.2rem;">
<span class="sr-only">Loading...</span>
</div>
<span id="getNiagaraLoadingText">正在取得即時異常設備</span>
</div>
<table class="table table-bordered table-hover m-0 text-center" id="alarm-device-table"> <table class="table table-bordered table-hover m-0 text-center" id="alarm-device-table">
<thead class="thead-themed"> <thead class="thead-themed">
<tr> <tr>
@ -365,7 +371,6 @@
if (!enable_alarm_timer) { if (!enable_alarm_timer) {
return; return;
} }
GetAlarmFromObix((data) => { GetAlarmFromObix((data) => {
var is_diff = false; var is_diff = false;
if (Object.keys(temp_alarm_device).length == Object.keys(data.alarmorion).length) { if (Object.keys(temp_alarm_device).length == Object.keys(data.alarmorion).length) {
@ -395,6 +400,7 @@
//data.buildingAlarmDeviceAmount.forEach(function (item) { //data.buildingAlarmDeviceAmount.forEach(function (item) {
// $(`#${item.building_tag}_device_amount`).html(item.device_amount); // $(`#${item.building_tag}_device_amount`).html(item.device_amount);
//}); //});
setNiagaraLoading(true);
ResetDeviceTable(); ResetDeviceTable();
} }
}) })
@ -729,7 +735,7 @@
return []; return [];
} }
setNiagaraLoading(false);
return data; return data;
} }
@ -851,6 +857,15 @@
}); });
//#endregion //#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){ function GetAlarmFromObix(callback = null){
let url = "/api/Alarm/GetAlarmFromObix" let url = "/api/Alarm/GetAlarmFromObix"
$.ajax({ $.ajax({

View File

@ -577,7 +577,7 @@
`;*@ `;*@
var html = ` var html = `
<a href="http://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_tag=${row.building_tag}&floor_guid=${row.floorguid}&layer3=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank"> <a href="${row.ip_address}/_FloorMap.html?building_tag=${row.building_tag}&main_system_tag=${row.layer2}&floor_guid=${row.floorguid}&sub_system_tag=${row.layer3}&device_number=${data}&show_cctv=1&isFromEmergency=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
${data} ${data}
</a> </a>
`; `;