diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 475c909..f58d198 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -315,6 +315,9 @@ $('#DateGet').attr('style', 'width:205px'); $('#DateGettext').attr('style', 'width:205px'); timerange = $('#DateGet').val(); + $('#monthbtn').hide(); + $('#yearbtn').show(); + $('#daybtn').show(); document.getElementById("monthbtn").disabled = true;//月報表鎖定 document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 document.getElementById("daybtn").disabled = false;//日報表鎖定 @@ -340,6 +343,9 @@ $(".btn-change-quickSearch2").html("前天"); var today = new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().substring(0, 10); $('#DateGet').val(today); + $('#monthbtn').hide(); + $('#yearbtn').show(); + $('#daybtn').show(); document.getElementById("monthbtn").disabled = true;//月報表鎖定 document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 document.getElementById("daybtn").disabled = false;//日報表鎖定 @@ -367,7 +373,7 @@ $(".btn-change-quickSearch1").html("近7天"); $(".btn-change-quickSearch2").html("近30天"); //#region 預設近7天 - var today = new Date(); + var today = new Date(new Date().setDate(new Date().getDate() - 1)); var dateLimit = new Date(new Date().setDate(today.getDate() - 7)); var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); @@ -377,6 +383,9 @@ document.getElementById("DateGet").style.display = "none";//隱藏 //#endregion $('#DateGettext').val(dateLimit_format + ' - ' + today_format); + $('#daybtn').hide(); + $('#monthbtn').show(); + $('#yearbtn').show(); document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = false;//月報表鎖定 document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 @@ -386,6 +395,9 @@ $(".btn-change-quickSearch2").html("上個月"); var now_month = new Date().toISOString().substring(0, 7); $('#DateGet').val(now_month); + $('#daybtn').hide(); + $('#monthbtn').show(); + $('#yearbtn').show(); document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = false;//月報表鎖定 document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 @@ -396,6 +408,9 @@ var now_year = new Date().toISOString().substring(0, 4); $('#DateGet').prop({ 'type': 'number', 'min': 1900, 'max': now_year, 'step': 1 }); $('#DateGet').val(now_year); + $('#daybtn').hide(); + $('#monthbtn').hide(); + $('#yearbtn').show(); document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = true;//月報表鎖定 document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 @@ -426,7 +441,7 @@ case 1: if (day == 0) { //#region 預設近7天 - var today = new Date(); + var today = new Date(new Date().setDate(new Date().getDate() - 1)); var dateLimit = new Date(new Date().setDate(today.getDate() - 7)); var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/"); @@ -436,7 +451,7 @@ $('#DateGettext').val(dateLimit_format + ' - ' + today_format).trigger('change'); } else { //#region 預設近30天 - var today = new Date(); + var today = new Date(new Date().setDate(new Date().getDate() - 1)); var dateLimit = new Date(new Date().setDate(today.getDate() - 30)); var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/"); var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/");