電站資訊-異常紀錄: 顯示loading圖示、全部資訊加載完,才結束大圈圈(loading)

This commit is contained in:
wanling040@gmail.com 2022-08-22 17:20:48 +08:00
parent 3f009e7c12
commit 44e94c8b67
3 changed files with 48 additions and 7 deletions

View File

@ -418,7 +418,7 @@ namespace SolarPower.Repository.Implement
{
PowerStationId = post.Id,
Status = post.Status,
})).ToList();
}, commandTimeout: 600)).ToList();
}
catch (Exception exception)
{

View File

@ -175,6 +175,13 @@
var selectInverterkwhBarType = 0;
var HeapMapXAxis = [];
var countOperationRecordFile = 0;
var isloadingdone_uptodate = false;
var isloadingdone_info = false;
var isloadingdone_inverterinfo = false;
var isloadingdone_inverter = false;
var isloadingdone_history = false;
var isloadingdone_exception = false;
var isloadingdone_operation = false;
function showLoading() {
var i = document.getElementById("loading");
@ -183,8 +190,11 @@
function hideLoading() {
var i = document.getElementById("loading");
if (isloadingdone_uptodate && isloadingdone_info && isloadingdone_inverterinfo && isloadingdone_inverter && isloadingdone_history && isloadingdone_exception && isloadingdone_operation)
{
i.style.display = "none";
}
}
$(function () {
@ -262,6 +272,7 @@
};
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
isloadingdone_uptodate = true;
hideLoading();
toast_error(rel.msg);
return;
@ -320,6 +331,7 @@
$("#money-card-subtitle-total").html("總計");
$("#money-card-subtitle-avg").html("今日");
}
isloadingdone_uptodate = true;
hideLoading();
}, 'json');
@ -757,6 +769,7 @@
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
isloadingdone_info = true;
hideLoading();
toast_error(rel.msg);
return;
@ -781,6 +794,7 @@
$("#power_station_select_modal").append($("<option />").val(stationId).text(powerStationData.name));
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
isloadingdone_info = true;
hideLoading();
}, 'json');
@ -1101,6 +1115,7 @@
}
$.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") {
isloadingdone_operation = true;
hideLoading();
toast_error(rel.msg);
return;
@ -1117,12 +1132,12 @@
$("#work_person_select_modal_exc").val(record.workPersonId);
}
}
isloadingdone_operation = true;
hideLoading();
});
//#endregion
//#region 異常table
showLoading();
ExceptionTable = $("#Exception_Table").DataTable({
"pageLength": 20,
"paging": true,
@ -1186,6 +1201,10 @@
},
"dataSrc": function (rel) {
if (rel.data.code == "9999") {
isloadingdone_exception = true;
$("#errbutton1").html('未解決').attr("disabled", false);
$("#errbutton0").html('已解決').attr("disabled", false);
$("#to30day").html('近30天').attr("disabled", false);
hideLoading();
toast_error(rel.data.msg);
return;
@ -1195,11 +1214,19 @@
this.data = [];
}
$("#Exception_Table_wrapper").show();
isloadingdone_exception = true;
$("#errbutton1").html('未解決').attr("disabled", false);
$("#errbutton0").html('已解決').attr("disabled", false);
$("#to30day").html('近30天').attr("disabled", false);
hideLoading();
return data;
}
},
"error": function (xhr, error, thrown) {
isloadingdone_exception = true;
$("#errbutton1").html('未解決').attr("disabled", false);
$("#errbutton0").html('已解決').attr("disabled", false);
$("#to30day").html('近30天').attr("disabled", false);
hideLoading();
console.log(xhr);
}
@ -1366,13 +1393,15 @@
//#region 改變日期(異常)
$('#date-range-exception').on('change', function () {
showLoading();
ExceptionTable.ajax.reload();
});
//#endregion
//#region 匯出excel(異常)
function ExportExcelToExc() {
showLoading();
//showLoading();
$("#exportBtn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
var url = "/StationOverview/GetExceptionTable";
var send_data = {
id: stationId,
@ -1381,7 +1410,8 @@
};
$.post(url, send_data, function (rel) {
if (rel.data.code != "0000") {
hideLoading();
//hideLoading();
$("#exportBtn").html('<span class="fal fa-file-excel mr-1"></span> 匯出').attr("disabled", false);
toast_error(rel.data.msg);
return;
}
@ -1412,7 +1442,8 @@
//檔案字尾名
fileext: ".xls",
});
hideLoading();
//hideLoading();
$("#exportBtn").html('<span class="fal fa-file-excel mr-1"></span> 匯出').attr("disabled", false);
}, 'json');
}
//#endregion
@ -1494,6 +1525,7 @@
//#region 查詢近30天(異常)
function ChangeDate30exception() {
$("#Exception_Table_wrapper").hide();
$("#to30day").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
var today = new Date();
var dateLimit = new Date(new Date().setDate(today.getDate() - 30));
@ -1613,9 +1645,11 @@
var name;
var name2;
if (type == 0) {
$("#errbutton0").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
name = "errbutton" + "0";
name2 = "errbutton" + "1";
} else {
$("#errbutton1").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
name = "errbutton" + "1";
name2 = "errbutton" + "0";
}
@ -2378,6 +2412,7 @@
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
isloadingdone_inverter = true;
hideLoading();
toast_error(rel.msg);
return;
@ -2432,6 +2467,7 @@
//#endregion
$('#inverter-kWh-convas-div').show();
isloadingdone_inverter = true;
hideLoading();
}, 'json');
@ -2658,6 +2694,7 @@
var Nurl = "/StationOverview/GetTotalTableToHistory";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
isloadingdone_history = true;
hideLoading();
toast_error(rel.msg);
return;
@ -2944,6 +2981,7 @@
'</tr>');
}
$('#all').show();
isloadingdone_history = true;
hideLoading();
})
}
@ -3051,11 +3089,13 @@
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
isloadingdone_inverterinfo = true;
hideLoading();
toast_error(rel.msg);
return;
}
if (rel.code == "0001") {
isloadingdone_inverterinfo = true;
hideLoading();
toast_warning(rel.msg);
return;
@ -3181,6 +3221,7 @@
}
};
isloadingdone_inverterinfo = true;
hideLoading();
});
}

View File

@ -15,7 +15,7 @@
</div>
</div>
<div class="row d-flex justify-content-end">
<button type="button" class="btn btn-success waves-effect waves-themed mb-3" onclick="ExportExcelToExc()">
<button type="button" class="btn btn-success waves-effect waves-themed mb-3" onclick="ExportExcelToExc()" id="exportBtn">
<span class="fal fa-file-excel mr-1"></span>
匯出
</button>