diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index fdad389..d0104ce 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -524,12 +524,12 @@ namespace FrontendWebApi.ApiControllers {string.Join(" AND ", str_arr)} ) OR - d.device_system_category_layer3 = 'C' + d.device_name_tag = 'C' )"; } else { - sWhere = $@" AND d.device_system_category_layer3 = 'C'"; + sWhere = $@" AND d.device_name_tag = 'C'"; } } else diff --git a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs index fd1dc76..3ea13d5 100644 --- a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs @@ -123,15 +123,17 @@ namespace FrontendWebApi.ApiControllers { string deviceQue = ""; string disasQue = ""; - if (selectdevice.selectbuilding != null && selectdevice.selectbuilding.Count > 0) - deviceQue += $" AND d.device_building_tag in @building_tag "; + if (selectdevice.selectbuilding == null || selectdevice.selectbuilding.Count == 0) + selectdevice.selectbuilding = new List(); if (selectdevice.select_Floors != null && selectdevice.select_Floors.Count > 0) deviceQue += $" AND d.device_floor_tag in @floor "; if (selectdevice.select_Layer3 != null && selectdevice.select_Layer3.Count > 0) deviceQue += $" AND d.device_name_tag IN @layer3 "; - if (selectdevice.select_disasters != null && selectdevice.select_disasters.Count > 0) - disasQue = " where dd.device_system_value IN @disasters "; + if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0) + selectdevice.select_disasters = new List(); + deviceQue += $" AND d.device_building_tag in @building_tag "; + disasQue = " where dd.device_system_value IN @disasters "; var sqlString = @$"select d.device_guid, d.device_number, diff --git a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml index 152917a..36810bb 100644 --- a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml @@ -569,7 +569,7 @@ `;*@ var html = ` - + ${data} `; @@ -639,7 +639,9 @@ is_need_reload = true; } - $(`button[id^=buildingBtn]`).removeClass("btn-danger").addClass("btn-secondary"); + + $(`button[id^=buildingBtn]`).removeClass("btn-danger"); + $(`button[id^=disasterBtn]`).removeClass("btn-danger"); enable_alarm_timer = true; is_need_reload = false; @@ -711,7 +713,8 @@ backfill_layer3_alarm_device_amount[temp_layer3_index].device_amount += 1; } - $(`#buildingBtn${temp_device.building_tag}`).removeClass("btn-secondary").addClass("btn-danger"); + $(`#buildingBtn${temp_device.building_tag}`).addClass("btn-danger"); + $(`#disasterBtn${temp_device.disaster}`).addClass("btn-danger"); alarm_data.push(obj); } }); @@ -822,13 +825,13 @@ temp_all_disaster = []; $('#disaster').empty(); - $('#disaster').append(``); + $('#disaster').append(``); var html = ""; rel.data.forEach(function (item, index) { temp_all_disaster.push(item.value); SelectedFilter.disasters.push(item.value); - html += ''; + html += ''; }); $('#disaster').append(html); @@ -887,15 +890,16 @@ function AllDisaster() { if (select_all_disaster) { //全選 -> 取消全選 select_all_disaster = false; - $('#disaster').find('.btn-success').removeClass('btn-success').addClass('btn-outline-success'); + $('#disaster').find('button').not(".all-btn").removeClass('btn-success').removeClass('btn-danger').addClass('btn-outline-success'); SelectedFilter.disasters = []; } else { //取消全選 -> 全選 select_all_disaster = true; - $('#disaster').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success'); + $('#disaster').find('button').not(".all-btn").removeClass('btn-outline-success').addClass('btn-success'); SelectedFilter.disasters = temp_all_disaster; } is_need_reload = true; + ResetDeviceTable(); ChangeFilterBuilding(); UpdateDeviceAmount(); @*console.log("SelectedFilter", SelectedFilter);*@ @@ -953,10 +957,10 @@ `; }); - $('#building').append(``); + $('#building').append(``); $('#building').append(html); - $('#building').find('div').first().click(); + $('#building').find('button').first().click(); } else { var html = ""; @@ -964,7 +968,7 @@ html += ''; }); - $('#building').append(``); + $('#building').append(``); $('#building').append(html); $('#building').find('button').first().click(); @@ -1138,14 +1142,15 @@ function AllBuilding() { if (select_all_building) { //全選 -> 取消全選 select_all_building = false; - $('#building').find('div > button.btn-success').removeClass('btn-success').addClass('btn-secondary'); + $('#building').find('button').not(".all-btn").removeClass('btn-success').removeClass('btn-danger').addClass('btn-secondary'); } else { //取消全選 -> 全選 select_all_building = true; - $('#building').find('div > button.btn-secondary').removeClass('btn-secondary').addClass('btn-success'); + $('#building').find('button').not(".all-btn").removeClass('btn-secondary').addClass('btn-success'); } resetCalSelectBuilding(); is_need_reload = true; + ResetDeviceTable(); UpdateDeviceAmount(); @*console.log("SelectedFilter", SelectedFilter);*@ } @@ -1302,11 +1307,12 @@ //#region 重設設備表格 function ResetDeviceTable() { - if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0) - || (SelectedFilter.building_tag == null || SelectedFilter.building_tag.length <= 0) - ) { - return; - } + //if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0) + // || (SelectedFilter.building_tag == null || SelectedFilter.building_tag.length <= 0) + //) { + // alarmDeviceTable.clear().draw(); + // return; + //} //if (changeBuilding != "" && changeBuilding != SelectedFilter.building_tag) { // alarmDeviceTable.clear().draw();