[前台API][緊急應變][事件清單] 拿掉原本棟別按鈕右邊警報設備數字 | 警告棟別改為以紅色按鈕呈現 | 修正告警設備清單取得語法 SQL d.device_system_category_layer3 => d.devic_name_tag

This commit is contained in:
dev01 2023-09-21 10:01:12 +08:00
parent 23bd391c5d
commit 38564397c9
3 changed files with 17 additions and 16 deletions

View File

@ -65,7 +65,7 @@ namespace FrontendWebApi.ApiControllers
client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);
// 建構 XML 數據
string xmlData = @$"<obj href='obix:AlarmFilter'>
<abstime name='start' val='{DateTime.Now.AddDays(-180).ToString("yyyy-MM-ddTHH:mm:ss.fff")}+08:00' />
<abstime name='start' val='{DateTime.Now.AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ss.fff")}+08:00' />
<abstime name='end' val='{DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff")}+08:00'/>
</obj>";
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;

View File

@ -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

View File

@ -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 @@
</div>`;*@
html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.tag}',this)">
<button type="button" class="btn btn-secondary" data-tag="${building.tag}" >${building.name}</button>
<button type="button" class="btn btn-secondary building_device_amount" data-tag="${building.tag}" id="${building.tag}_device_amount">0</button>
<button id="buildingBtn${building.tag}" type="button" class="btn btn-secondary" data-tag="${building.tag}" >${building.name}</button>
</div>`;
});
$('#building').append(`<button type="button" class="btn btn-secondary waves-effect waves-themed d-inline-block ml-2" onclick="AllBuilding()"> 全選 </button>`);