[緊急應變] 設備總攬 Filter Panel 前端程序優化及調整 | 緊急應變初始頁面直接導進設備總覽

This commit is contained in:
dev01 2023-05-22 16:29:07 +08:00
parent 86548b7fb6
commit a5bcf2e8fb
2 changed files with 28 additions and 20 deletions

View File

@ -224,7 +224,7 @@
</button>*@
</div>
<div class="modal-body">
<form id="emergency-item-form">
<form id="emergency-item-form" onsubmit="PassVerify(true)">
<div class="row">
<div class="form-group col-6">
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
@ -351,6 +351,9 @@
var ToVerifyType = 0;
$(function () {
$("#emergency-item-form").submit((e) => {
e.preventDefault();
})
//#region 定時取得報警設備(3s)
interval_id = setInterval(function () {
@ -409,7 +412,7 @@
emergencyContactTable = $("#membertable").DataTable({
"columns": [
{
"data": "full_name"
"data": "name"
},
{
"data": "departmentName"
@ -453,7 +456,7 @@
SmsMemberTable = $("#smsMemberTable").DataTable({
"columns": [
{
"data": "full_name"
"data": "name"
},
{
"data": "departmentName"
@ -869,6 +872,7 @@
is_need_reload = true;
ChangeFilterBuilding();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -889,6 +893,7 @@
is_need_reload = true;
ChangeFilterBuilding();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -956,6 +961,7 @@
is_need_reload = true;
ChangeFilterFloor();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -968,7 +974,7 @@
disaster.groupBuildings.forEach(function (building, building_index) {
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) {
if (temp_all_floor.findIndex(x => x.guid == floor.guid) < 0) { //表示未加入,需加入
if (temp_all_floor.findIndex(x => x.name == floor.name) < 0) { //表示未加入,需加入
temp_all_floor.push(floor);
}
});
@ -981,7 +987,7 @@
$("#floors").append(`<button type="button" class="btn btn-secondary ml-2 mb-2" onclick="AllFloor()">全選</button>`);
var html = "";
temp_all_floor.forEach(function (floor, floor_index) {
html += '<button type="button" class="btn btn-outline-success ml-2 mb-2" onclick="SelectFloor(\'' + floor.guid + '\',this)">' + floor.name + '</button>';
html += '<button type="button" class="btn btn-outline-success ml-2 mb-2" onclick="SelectFloor(\'' + floor.name + '\',this)">' + floor.name + '</button>';
});
$('#floors').append(html);
@ -1001,32 +1007,34 @@
$('#floors').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success');
SelectedFilter.floor_guids = [];
temp_all_floor.forEach(function (floor, floor_index) {
SelectedFilter.floor_guids.push(floor.guid);
SelectedFilter.floor_guids.push(floor.name);
});
}
is_need_reload = true;
ChangeFilterLayer2();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
//#region 選擇樓層
function SelectFloor(floor_guid, e) {
function SelectFloor(floor_tag, e) {
select_all_floor = false;
var floor_index = SelectedFilter.floor_guids.findIndex(x => x == floor_guid);
var floor_index = SelectedFilter.floor_guids.findIndex(x => x == floor_tag);
if (floor_index > -1) { //已選擇 -> 未選擇
SelectedFilter.floor_guids.splice(floor_index, 1);
$(e).removeClass('btn-success').addClass('btn-outline-success');
}
else { //未選擇 -> 已選擇
SelectedFilter.floor_guids.push(floor_guid);
SelectedFilter.floor_guids.push(floor_tag);
$(e).removeClass('btn-outline-success').addClass('btn-success');
}
is_need_reload = true;
ChangeFilterLayer2();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -1039,7 +1047,7 @@
disaster.groupBuildings.forEach(function (building, building_index) {
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) {
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
if (SelectedFilter.floor_guids.findIndex(x => x == floor.name) > -1) { //抓取選擇樓層的底下大類
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
if (temp_all_layer2.findIndex(x => x.value == layer2.value) < 0) {
temp_all_layer2.push(layer2);
@ -1098,6 +1106,7 @@
is_need_reload = true;
ChangeFilterLayer3();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -1118,6 +1127,7 @@
is_need_reload = true;
ChangeFilterLayer3();
UpdateDeviceAmount();
@*console.log("SelectedFilter", SelectedFilter);*@
}
//#endregion
@ -1130,7 +1140,7 @@
disaster.groupBuildings.forEach(function (building, building_index) {
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) {
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
if (SelectedFilter.floor_guids.findIndex(x => x == floor.name) > -1) { //抓取選擇樓層的底下大類
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
if (SelectedFilter.layer2.findIndex(x => x == layer2.value) > -1) { //抓取選擇大類的底下小類
layer2.groupLayer3s.forEach(function (layer3, layer3_index) {
@ -1203,6 +1213,7 @@
is_need_reload = true;
ResetDeviceTable();
UpdateDeviceAmount();
}
//#endregion
@ -1222,6 +1233,7 @@
is_need_reload = true;
ResetDeviceTable();
UpdateDeviceAmount();
}
//#endregion
@ -1601,9 +1613,9 @@
var includeli = "";
$.each(rel.data, function (index, val) {
if (index == 0) {
includeli += '<li class="list-group-item active" id="li_' + val.emergency_guid + '" > <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.full_name + '</a></li>';
includeli += '<li class="list-group-item active" id="li_' + val.emergency_guid + '" > <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.name + '</a></li>';
} else {
includeli += '<li class="list-group-item" id="li_' + val.emergency_guid + '"> <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.full_name + '</a></li>';
includeli += '<li class="list-group-item" id="li_' + val.emergency_guid + '"> <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.name + '</a></li>';
}
});
@ -1666,7 +1678,7 @@
}
$('#hbr_' + setting).empty();
$('#hbr_' + setting).append('<h2>' + rel.data.full_name + '</h2>');
$('#hbr_' + setting).append('<h2>' + rel.data.name + '</h2>');
$('#tag_' + setting).empty();
$('#tag_' + setting).append(rel.data.set_doing);
@ -1751,7 +1763,6 @@
}
function PassVerify(Vbool) {
console.log(SmsMemberTable.data().toArray())
if (ToVerifyType == 0) {
if (Vbool) {
var url = "api/EmergencyDevice/CheckVerifybool";
@ -1788,9 +1799,6 @@
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
$('#emergency-verify-modal').modal('hide');
}
}
}
if (ToVerifyType == 1) {

View File

@ -78,7 +78,7 @@
async: false,
dataType: 'json',
success: function (rel) {
window.location = "/Home/Index/";
window.location = "/EmergencyDeviceMenu";
},
error: function (xhr, textStatus, thrownError) {
alert(textStatus);