diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index ff7f8c7..62c1bb2 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -182,6 +182,10 @@ var isloadingdone_history = false; var isloadingdone_exception = false; var isloadingdone_operation = false; + var datepicker_record; + var datepicker_history; + var datepicker_exception; + function showLoading() { var i = document.getElementById("loading"); @@ -248,14 +252,16 @@ });*@ //#region Date-Picker add by jiahao 2022-05-21 - datepicker = $('#date-range-history').daterangepicker({ - autoUpdateInput: false, - locale: { format: 'YYYY-MM-DD' }, - //miniDate: new Date(Date.setDate(Date.getDate() - 30)), - //maxDate: Date.getDate(), - opens: 'left' - }, function (start, end, label) { - }); + if(document.getElementById('date-range-history') != null) { + datepicker_history = $('#date-range-history').daterangepicker({ + autoUpdateInput: false, + locale: { format: 'YYYY-MM-DD' }, + //miniDate: new Date(Date.setDate(Date.getDate() - 30)), + //maxDate: Date.getDate(), + opens: 'left' + }, function (start, end, label) { + }); + } $('#date-range-history').on('apply.daterangepicker', function (ev, picker) { $(this).val(picker.startDate.format('YYYY-MM-DD') + ' ~ ' + picker.endDate.format('YYYY-MM-DD')); @@ -274,8 +280,10 @@ var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); //var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); //datepicker.data('daterangepicker').setStartDate(dateLimit_format); - datepicker.data('daterangepicker').setStartDate(today_format); - datepicker.data('daterangepicker').setEndDate(today_format); + if(datepicker_history != undefined && datepicker_history != null) { + datepicker_history.data('daterangepicker').setStartDate(today_format); + datepicker_history.data('daterangepicker').setEndDate(today_format); + } //$('#date-range-history').val(dateLimit_format + ' - ' + today_format); $('#date-range-history').val(today_format + ' ~ ' + today_format); //alert(" date-range-history = "+$('#date-range-history').val()); @@ -898,13 +906,15 @@ //#endregion //#region Date Picker record - datepicker = $('#date-range-record').daterangepicker({ - autoUpdateInput: false, - locale: { format: 'YYYY/MM/DD' }, - opens: 'left' - }, function (start, end, label) { - @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ - }); + if(document.getElementById('date-range-record') != null) { + datepicker_record = $('#date-range-record').daterangepicker({ + autoUpdateInput: false, + locale: { format: 'YYYY/MM/DD' }, + opens: 'left' + }, function (start, end, label) { + @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ + }); + } $('#date-range-record').on('apply.daterangepicker', function (ev, picker) { $(this).val(picker.startDate.format('YYYY/MM/DD') + ' ~ ' + picker.endDate.format('YYYY/MM/DD')); @@ -918,13 +928,15 @@ //#endregion //#region Date Picker exception - datepicker = $('#date-range-exception').daterangepicker({ - autoUpdateInput: false, - locale: { format: 'YYYY/MM/DD' }, - opens: 'left' - }, function (start, end, label) { - @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ - }); + if(document.getElementById('date-range-exception') != null) { + datepicker_exception = $('#date-range-exception').daterangepicker({ + autoUpdateInput: false, + locale: { format: 'YYYY/MM/DD' }, + opens: 'left' + }, function (start, end, label) { + @* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@ + }); + } $('#date-range-exception').on('apply.daterangepicker', function (ev, picker) { $(this).val(picker.startDate.format('YYYY/MM/DD') + ' - ' + picker.endDate.format('YYYY/MM/DD')); @@ -1112,10 +1124,14 @@ //#region 逆變器分析 tab ChangeInverterDateToday(); - LoadInvertAnalysisHeatMap(); + if(document.getElementById('InverterResult') != null) { + LoadInvertAnalysisHeatMap(); + } ChangeInverterkwhBarDaily(''); - LoadInvertAnalysiskwhBar(); + if(document.getElementById('inverter-kWh-convas-div') != null) { + LoadInvertAnalysiskwhBar(); + } //#region 載入電站逆變器資料 showLoading(); @@ -1571,8 +1587,8 @@ var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); - datepicker.data('daterangepicker').setStartDate(dateLimit_format); - datepicker.data('daterangepicker').setEndDate(today_format); + datepicker_exception.data('daterangepicker').setStartDate(dateLimit_format); + datepicker_exception.data('daterangepicker').setEndDate(today_format); $('#date-range-exception').val(dateLimit_format + ' - ' + today_format); $('#date-range-exception').trigger('change'); @@ -1827,8 +1843,8 @@ var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); - datepicker.data('daterangepicker').setStartDate(dateLimit_format); - datepicker.data('daterangepicker').setEndDate(today_format); + datepicker_record.data('daterangepicker').setStartDate(dateLimit_format); + datepicker_record.data('daterangepicker').setEndDate(today_format); $('#date-range-record').val(dateLimit_format + ' - ' + today_format); $('#date-range-record').trigger('change'); @@ -2310,6 +2326,9 @@ type: 'heatmap', height: 600 }, + accessibility: { + enabled: false + }, title: { text: '各逆變器當日日均發電度數' @@ -2901,6 +2920,9 @@ viewData: '檢視資料表格', viewFullscreen: '全屏檢視' }, + accessibility: { + enabled: false + }, chart: { renderTo: 'history-kWh', height: 600,