diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index 5c76a83..6687a49 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -418,7 +418,7 @@ namespace SolarPower.Repository.Implement { PowerStationId = post.Id, Status = post.Status, - })).ToList(); + }, commandTimeout: 600)).ToList(); } catch (Exception exception) { diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 7539c01..6f37cc1 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -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,7 +190,10 @@ function hideLoading() { var i = document.getElementById("loading"); - i.style.display = "none"; + 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($("").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('').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(' 匯出').attr("disabled", false); toast_error(rel.data.msg); return; } @@ -1412,7 +1442,8 @@ //檔案字尾名 fileext: ".xls", }); - hideLoading(); + //hideLoading(); + $("#exportBtn").html(' 匯出').attr("disabled", false); }, 'json'); } //#endregion @@ -1494,6 +1525,7 @@ //#region 查詢近30天(異常) function ChangeDate30exception() { $("#Exception_Table_wrapper").hide(); + $("#to30day").html('').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('').attr("disabled", true); name = "errbutton" + "0"; name2 = "errbutton" + "1"; } else { + $("#errbutton1").html('').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 @@ ''); } $('#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(); }); } diff --git a/SolarPower/Views/StationOverview/_Exception.cshtml b/SolarPower/Views/StationOverview/_Exception.cshtml index 6fb7943..d6a28d1 100644 --- a/SolarPower/Views/StationOverview/_Exception.cshtml +++ b/SolarPower/Views/StationOverview/_Exception.cshtml @@ -15,7 +15,7 @@