From e5cbb86d8e487a053d900bc180814a7fc9b5b9f3 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Fri, 10 Sep 2021 18:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=97=A5=E6=9C=88=E5=A0=B1?= =?UTF-8?q?=E9=A0=90=E8=A8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Views/StationReport/Index.cshtml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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, "/");