Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
5f979a36cb
@ -87,6 +87,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
var table = input.tableType == "year" ? "archive_electric_meter_day" : "archive_electric_meter_" + input.tableType;
|
var table = input.tableType == "year" ? "archive_electric_meter_day" : "archive_electric_meter_" + input.tableType;
|
||||||
var dateFormat = input.tableType == "day" || input.tableType == "week" ? "%Y-%m-%d" : input.tableType == "month" ? "%Y-%m" : input.tableType == "year" ? "%Y" : null;
|
var dateFormat = input.tableType == "day" || input.tableType == "week" ? "%Y-%m-%d" : input.tableType == "month" ? "%Y-%m" : input.tableType == "year" ? "%Y" : null;
|
||||||
|
var aemmEndDate = input.tableType == "year" ? $"year(DATE_ADD(fd.date, INTERVAL +1 {input.tableType}))" : $"DATE_ADD(fd.date, INTERVAL +1 {input.tableType})";
|
||||||
|
var aemmStaDate = input.tableType == "year" ? "year(fd.date)" : "fd.date";
|
||||||
var sql = $@"set @i = -1;
|
var sql = $@"set @i = -1;
|
||||||
select fd.device_number, aemm.avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
|
select fd.device_number, aemm.avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
|
||||||
from (
|
from (
|
||||||
@ -111,7 +113,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
from {table}
|
from {table}
|
||||||
where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'KWH' and SUBSTRING_INDEX(device_number, '_', 1) = @building_tag
|
where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'KWH' and SUBSTRING_INDEX(device_number, '_', 1) = @building_tag
|
||||||
{sqlWhere} {sqlGroup}
|
{sqlWhere} {sqlGroup}
|
||||||
) aemm on aemm.start_timestamp >= fd.date and aemm.end_timestamp < DATE_ADD(fd.date, INTERVAL +1 {input.tableType}) and aemm.device_number = fd.device_number
|
) aemm on aemm.start_timestamp >= {aemmStaDate} and aemm.end_timestamp < {aemmEndDate} and aemm.device_number = fd.device_number
|
||||||
order by fd.device_number, fd.date";
|
order by fd.device_number, fd.date";
|
||||||
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
||||||
new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
||||||
|
@ -224,7 +224,7 @@
|
|||||||
</button>*@
|
</button>*@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form id="emergency-item-form">
|
<form id="emergency-item-form" onsubmit="PassVerify(true)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-6">
|
<div class="form-group col-6">
|
||||||
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
|
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
|
||||||
@ -349,8 +349,11 @@
|
|||||||
var Verifybool = false; //-驗證成功
|
var Verifybool = false; //-驗證成功
|
||||||
var CloseVerify = false;
|
var CloseVerify = false;
|
||||||
var ToVerifyType = 0;
|
var ToVerifyType = 0;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
$("#emergency-item-form").submit((e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
})
|
||||||
|
|
||||||
//#region 定時取得報警設備(3s)
|
//#region 定時取得報警設備(3s)
|
||||||
interval_id = setInterval(function () {
|
interval_id = setInterval(function () {
|
||||||
@ -453,7 +456,7 @@
|
|||||||
SmsMemberTable = $("#smsMemberTable").DataTable({
|
SmsMemberTable = $("#smsMemberTable").DataTable({
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"data": "full_name"
|
"data": "name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": "departmentName"
|
"data": "departmentName"
|
||||||
@ -869,6 +872,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterBuilding();
|
ChangeFilterBuilding();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -889,6 +893,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterBuilding();
|
ChangeFilterBuilding();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -956,6 +961,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterFloor();
|
ChangeFilterFloor();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -968,7 +974,7 @@
|
|||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
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);
|
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>`);
|
$("#floors").append(`<button type="button" class="btn btn-secondary ml-2 mb-2" onclick="AllFloor()">全選</button>`);
|
||||||
var html = "";
|
var html = "";
|
||||||
temp_all_floor.forEach(function (floor, floor_index) {
|
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);
|
$('#floors').append(html);
|
||||||
|
|
||||||
@ -1001,32 +1007,34 @@
|
|||||||
$('#floors').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success');
|
$('#floors').find('.btn-outline-success').removeClass('btn-outline-success').addClass('btn-success');
|
||||||
SelectedFilter.floor_guids = [];
|
SelectedFilter.floor_guids = [];
|
||||||
temp_all_floor.forEach(function (floor, floor_index) {
|
temp_all_floor.forEach(function (floor, floor_index) {
|
||||||
SelectedFilter.floor_guids.push(floor.guid);
|
SelectedFilter.floor_guids.push(floor.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer2();
|
ChangeFilterLayer2();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 選擇樓層
|
//#region 選擇樓層
|
||||||
function SelectFloor(floor_guid, e) {
|
function SelectFloor(floor_tag, e) {
|
||||||
select_all_floor = false;
|
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) { //已選擇 -> 未選擇
|
if (floor_index > -1) { //已選擇 -> 未選擇
|
||||||
SelectedFilter.floor_guids.splice(floor_index, 1);
|
SelectedFilter.floor_guids.splice(floor_index, 1);
|
||||||
$(e).removeClass('btn-success').addClass('btn-outline-success');
|
$(e).removeClass('btn-success').addClass('btn-outline-success');
|
||||||
}
|
}
|
||||||
else { //未選擇 -> 已選擇
|
else { //未選擇 -> 已選擇
|
||||||
SelectedFilter.floor_guids.push(floor_guid);
|
SelectedFilter.floor_guids.push(floor_tag);
|
||||||
$(e).removeClass('btn-outline-success').addClass('btn-success');
|
$(e).removeClass('btn-outline-success').addClass('btn-success');
|
||||||
}
|
}
|
||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer2();
|
ChangeFilterLayer2();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1039,7 +1047,7 @@
|
|||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
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) {
|
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
||||||
if (temp_all_layer2.findIndex(x => x.value == layer2.value) < 0) {
|
if (temp_all_layer2.findIndex(x => x.value == layer2.value) < 0) {
|
||||||
temp_all_layer2.push(layer2);
|
temp_all_layer2.push(layer2);
|
||||||
@ -1098,6 +1106,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer3();
|
ChangeFilterLayer3();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1118,6 +1127,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ChangeFilterLayer3();
|
ChangeFilterLayer3();
|
||||||
|
UpdateDeviceAmount();
|
||||||
@*console.log("SelectedFilter", SelectedFilter);*@
|
@*console.log("SelectedFilter", SelectedFilter);*@
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1130,7 +1140,7 @@
|
|||||||
disaster.groupBuildings.forEach(function (building, building_index) {
|
disaster.groupBuildings.forEach(function (building, building_index) {
|
||||||
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
|
||||||
building.groupFloors.forEach(function (floor, floor_index) {
|
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) {
|
floor.groupLayer2s.forEach(function (layer2, layer2_index) {
|
||||||
if (SelectedFilter.layer2.findIndex(x => x == layer2.value) > -1) { //抓取選擇大類的底下小類
|
if (SelectedFilter.layer2.findIndex(x => x == layer2.value) > -1) { //抓取選擇大類的底下小類
|
||||||
layer2.groupLayer3s.forEach(function (layer3, layer3_index) {
|
layer2.groupLayer3s.forEach(function (layer3, layer3_index) {
|
||||||
@ -1203,6 +1213,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ResetDeviceTable();
|
ResetDeviceTable();
|
||||||
|
UpdateDeviceAmount();
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -1222,6 +1233,7 @@
|
|||||||
|
|
||||||
is_need_reload = true;
|
is_need_reload = true;
|
||||||
ResetDeviceTable();
|
ResetDeviceTable();
|
||||||
|
UpdateDeviceAmount();
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -1751,7 +1763,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PassVerify(Vbool) {
|
function PassVerify(Vbool) {
|
||||||
console.log(SmsMemberTable.data().toArray())
|
|
||||||
if (ToVerifyType == 0) {
|
if (ToVerifyType == 0) {
|
||||||
if (Vbool) {
|
if (Vbool) {
|
||||||
var url = "api/EmergencyDevice/CheckVerifybool";
|
var url = "api/EmergencyDevice/CheckVerifybool";
|
||||||
@ -1788,9 +1799,6 @@
|
|||||||
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
||||||
$('#emergency-verify-modal').modal('hide');
|
$('#emergency-verify-modal').modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ToVerifyType == 1) {
|
if (ToVerifyType == 1) {
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
async: false,
|
async: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (rel) {
|
success: function (rel) {
|
||||||
window.location = "/Home/Index/";
|
window.location = "/EmergencyDeviceMenu";
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, thrownError) {
|
error: function (xhr, textStatus, thrownError) {
|
||||||
alert(textStatus);
|
alert(textStatus);
|
||||||
|
Loading…
Reference in New Issue
Block a user