From 06d7772dfd92989967a189dbd0640f87e44514b7 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Tue, 31 Aug 2021 10:15:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=81=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Views/ExceptionRecord/Index.cshtml | 33 +++++++++++++++-- .../Views/Operation/OperationRecord.cshtml | 1 - SolarPower/Views/StationOverview/Index.cshtml | 35 +++++++++++++++---- 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/SolarPower/Views/ExceptionRecord/Index.cshtml b/SolarPower/Views/ExceptionRecord/Index.cshtml index 364f4bb..ff79f8a 100644 --- a/SolarPower/Views/ExceptionRecord/Index.cshtml +++ b/SolarPower/Views/ExceptionRecord/Index.cshtml @@ -229,6 +229,8 @@ var record; var psids; var countOperationRecordFile = 0; + var AllpoweridsType = true; + var AllidsType = true; //#region Array.Remove Array.prototype.remove = function (val) { @@ -339,8 +341,22 @@ $.each(Allids, function (index, val) { var cityid = 'cityID_' + val; document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); - ids.push(val); + if (AllidsType) { + document.getElementById(cityid).setAttribute("class", 'btn btn-outline-success waves-effect waves-themed ml-2'); + ids = []; + powerids = []; + } + else { + document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); + ids.push(val); + } }); + if (AllidsType) { + AllidsType = false; + AllpoweridsType = false; + } else { + AllidsType = true; + } var send_data = { cityid: ids } @@ -391,10 +407,21 @@ //#region 電站全選 function Allpowerstation() { + if (AllpoweridsType) { + AllpoweridsType = false; + } else { + AllpoweridsType = true; + } + powerids = []; $.each(Allpowerids, function (index, val) { - $('#check_' + val).prop("checked", true); - powerids.push(val); + if (AllpoweridsType) { + $('#check_' + val).prop("checked", true); + powerids.push(val); + } else { + $('#check_' + val).prop("checked", false); + powerids = []; + } }) ExceptionTable.ajax.reload(); } diff --git a/SolarPower/Views/Operation/OperationRecord.cshtml b/SolarPower/Views/Operation/OperationRecord.cshtml index f26b074..9b9a05b 100644 --- a/SolarPower/Views/Operation/OperationRecord.cshtml +++ b/SolarPower/Views/Operation/OperationRecord.cshtml @@ -592,7 +592,6 @@ else { document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); ids.push(val); - } }); if (AllidsType) { diff --git a/SolarPower/Views/StationOverview/Index.cshtml b/SolarPower/Views/StationOverview/Index.cshtml index 3961919..6f82410 100644 --- a/SolarPower/Views/StationOverview/Index.cshtml +++ b/SolarPower/Views/StationOverview/Index.cshtml @@ -96,7 +96,7 @@

日照度

-
k W/m2
+
k W/㎡
@@ -296,6 +296,8 @@ var powerids = new Array(0);//當前選擇電站 var Allids = new Array(0);//全部縣市 var status123 = new Array(0);//狀態 + var AllidsType = true; + var StatusType = true; //#region Array.Remove Array.prototype.remove = function (val) { var index = this.indexOf(val); @@ -519,9 +521,21 @@ ids = []; $.each(Allids, function (index, val) { var cityid = 'cityID_' + val; - document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); - ids.push(val); + if (AllidsType) { + document.getElementById(cityid).setAttribute("class", 'btn btn-outline-success waves-effect waves-themed ml-2'); + ids = []; + } + else { + document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); + ids.push(val); + } }); + if (AllidsType) { + AllidsType = false; + AllpoweridsType = false; + } else { + AllidsType = true; + } getStation(ids); } //#endregion @@ -529,9 +543,18 @@ //#region 狀態全選 function AllStatus() { status123 = []; - for (var i = 1; i <= 3; i++) { - $('#Status_' + i).prop("checked", true); - status123.push(i); + + if (StatusType) { + for (var i = 1; i <= 3; i++) { + $('#Status_' + i).prop("checked", false); + } + StatusType = false; + } else { + for (var i = 1; i <= 3; i++) { + $('#Status_' + i).prop("checked", true); + status123.push(i); + } + StatusType = true; } getStation(ids); }