1. 電站總覽 即時資訊加入電站狀態

This commit is contained in:
Kai 2021-07-21 16:18:27 +08:00
parent e32b95f7ba
commit 5eabef5134
3 changed files with 14 additions and 5 deletions

View File

@ -182,6 +182,7 @@ namespace SolarPower.Controllers
stationOverview.TodayWeatherTemp = powerStation.TodayWeatherTemp;
stationOverview.RateOfRain = powerStation.RateOfRain;
stationOverview.StationName = powerStation.Name;
stationOverview.HealthStatus = powerStation.HealthStatus;
apiResult.Code = "0000";
apiResult.Data = stationOverview;

View File

@ -61,6 +61,7 @@ namespace SolarPower.Models
public double TodayWeatherTemp { get; set; }
public string StationName { get; set; }
public string CityName { get; set; }
public byte HealthStatus { get; set; }
}
public class ChartUptoDate

View File

@ -21,11 +21,7 @@
<div class="row subheader d-flex justify-content-between">
<div class="col-xl-2">
<h1 class="subheader-title">
<span class="icon-stack fa-1x">
<i class="base-7 icon-stack-3x color-info-500"></i>
<i class="base-7 icon-stack-2x color-info-700"></i>
<i class="ni ni-graph icon-stack-1x text-white"></i>
</span>
<span id="power-station-healthStatus"></span>
<span id="power-station-title">新竹巨城站</span>
</h1>
</div>
@ -195,7 +191,18 @@
$("#today_carbon").html(stationOverview.today_carbon.toFixed(2));
$("#total_carbon").html(stationOverview.total_carbon.toFixed(2));
$("#update_at").html(stationOverview.updatedAt);
var statusicon;
switch (stationOverview.healthStatus) {
case 1: statusicon = "<i class='btn btn-success btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-check'></i>"; break;
case 2: statusicon = "<i class='btn btn-warning btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-exclamation'></i>"; break;
case 3: statusicon = "<i class='btn btn-danger btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-horizontal-rule'></i>"; break;
default:
statusicon = ''; break;
}
$('#power-station-healthStatus').html(statusicon);
$('#power-station-title').html(stationOverview.stationName);
$('#weather-temp').html(stationOverview.todayWeatherTemp + '°C <br>降雨幾率: ' + stationOverview.rateOfRain + '%');
$('#weather-icon')[0].setAttribute("class", 'fal fa-' + stationOverview.todayWeather + ' fa-3x');
$('#breadcrumbname').html(stationOverview.stationName);