From 4e47d8e7fad4ad04471ec09a417503ba9a7bcdad Mon Sep 17 00:00:00 2001 From: dev02 Date: Mon, 5 Dec 2022 14:36:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=81=8B=E7=B6=AD=E5=92=8C?= =?UTF-8?q?=E6=AD=B7=E5=8F=B2=E8=B3=87=E6=96=99=E6=99=82=E9=96=93=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_historyData.html | 75 +++++++++++++++--- Frontend/_operation.html | 53 ++++++++++--- Frontend/index.html | 3 + .../excel/operation/廠商資料_2022-12-03.xlsx | Bin 0 -> 4670 bytes .../廠商資料_2022-12-22_2022-12-05.xlsx | Bin 0 -> 4669 bytes 5 files changed, 106 insertions(+), 25 deletions(-) create mode 100644 FrontendWebApi/wwwroot/excel/operation/廠商資料_2022-12-03.xlsx create mode 100644 FrontendWebApi/wwwroot/excel/operation/廠商資料_2022-12-22_2022-12-05.xlsx diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html index f89f042..bd3b25c 100644 --- a/Frontend/_historyData.html +++ b/Frontend/_historyData.html @@ -31,13 +31,13 @@
- +
@@ -71,7 +71,7 @@ var historyTable = null; $(function () { initList(); - + $(loadEle).Loading("close"); // default list filter initApp.listFilter($('#js_default_list'), $('#js_default_list_filter')); // custom response message @@ -90,9 +90,34 @@ onEvent('change', '#startdate', function () { let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-'); let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-'); - console.log(today); - console.log(ytd); - if ($(this).val() == today) { + + if (pageAct.dateType == 'range') { + if ($('#startdate').val() > $('#enddate input').val() && ($('#startdate').val() != "" && $('#enddate input').val() != "")) { + $('#startdate').val($('#startdate').data('val')); + toast_error('不可選擇大於結束時間'); + } + else { + $('#startdate').data('val', $('#startdate').val()); + $('#enddate input').data('val', $('#enddate input').val()); + + $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary'); + $(`[onclick="setDateType('today', this)"]`).removeClass('btn-dark'); + $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary'); + $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-dark'); + + if ($('#startdate').val() == $('#enddate input').val()) { + if ($('#startdate').val() == today) { + $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary'); + $(`[onclick="setDateType('today', this)"]`).addClass('btn-dark'); + } + else if ($('#startdate').val() == ytd) { + $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary'); + $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-dark'); + } + } + } + } + else if ($(this).val() == today) { $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary'); $(`[onclick="setDateType('today', this)"]`).addClass('btn-dark'); $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary'); @@ -104,13 +129,37 @@ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary'); $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-dark'); } - else { - $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary'); - $(`[onclick="setDateType('today', this)"]`).removeClass('btn-dark'); - $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary'); - $(`[onclick="setDateType('ytd', this)"]`).removClass('btn-dark'); - } }); + + onEvent('change', '#enddate input', function () { + let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-'); + let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-'); + + if ($('#startdate').val() > $('#enddate input').val() && ($('#startdate').val() != "" && $('#enddate input').val() != "")) { + $('#enddate input').val($('#enddate input').data('val')); + toast_error('不可選擇大於結束時間'); + } + else { + $('#startdate').data('val', $('#startdate').val()); + $('#enddate input').data('val', $('#enddate input').val()); + + $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary'); + $(`[onclick="setDateType('today', this)"]`).removeClass('btn-dark'); + $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary'); + $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-dark'); + + if ($('#startdate').val() == $('#enddate input').val()) { + if ($('#startdate').val() == today) { + $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary'); + $(`[onclick="setDateType('today', this)"]`).addClass('btn-dark'); + } + else if ($('#startdate').val() == ytd) { + $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary'); + $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-dark'); + } + } + } + }); }); function initList() { @@ -283,7 +332,9 @@ $('#enddate').css('display', 'block'); $('#getmonth').css('display', 'none'); $('#startdate').val(now); + $('#startdate').data('val', now); $('#enddate input').val(tmr); + $('#enddate input').data('val', tmr); } else if (type == "month") { $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-dark'); diff --git a/Frontend/_operation.html b/Frontend/_operation.html index 3cbc47e..49f2fb7 100644 --- a/Frontend/_operation.html +++ b/Frontend/_operation.html @@ -19,12 +19,12 @@
- +
- +