1. bug fix

2. 畫面調整
This commit is contained in:
Kai 2021-09-02 17:14:41 +08:00
parent f114901a2c
commit da9730325a
8 changed files with 33 additions and 26 deletions

View File

@ -2172,14 +2172,16 @@ namespace SolarPower.Controllers
/// 取得該使用者可看的所有電站分佈縣市以及各縣市電站數量 /// 取得該使用者可看的所有電站分佈縣市以及各縣市電站數量
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<ApiResult<List<SolarCityAmount>>> GetSolarCitySummary() public async Task<ApiResult<List<MyCity>>> GetSolarCitySummary()
{ {
ApiResult<List<SolarCityAmount>> apiResult = new ApiResult<List<SolarCityAmount>>(); ApiResult<List<MyCity>> apiResult = new ApiResult<List<MyCity>>();
List<SolarCityAmount> solaramount = new List<SolarCityAmount>(); List<MyCity> solaramount = new List<MyCity>();
try try
{ {
apiResult.Code = "0000"; apiResult.Code = "0000";
solaramount = await powerStationRepository.GetSolarCitySummary(myUser); //solaramount = await powerStationRepository.GetSolarCitySummary(myUser);
solaramount = myPowerStationService.GetMyCities(myUser);
apiResult.Data = solaramount; apiResult.Data = solaramount;
} }
catch (Exception exception) catch (Exception exception)
@ -2202,7 +2204,9 @@ namespace SolarPower.Controllers
try try
{ {
apiResult.Code = "0000"; apiResult.Code = "0000";
solaramount = await powerStationRepository.GetSolarByCity(myUser, cityid); //solaramount = await powerStationRepository.GetSolarByCity(myUser, cityid);
solaramount = myPowerStationService.GetMyPowerStations(myUser, cityid);
foreach (var solar in solaramount) foreach (var solar in solaramount)
{ {

View File

@ -46,6 +46,7 @@ namespace SolarPower.Services.Implement
foreach (var powerStations_group_item in myPowerStations_group) foreach (var powerStations_group_item in myPowerStations_group)
{ {
MyPowerStationGroupByCity myPowerStationGroupByCity = new MyPowerStationGroupByCity(); MyPowerStationGroupByCity myPowerStationGroupByCity = new MyPowerStationGroupByCity();
myPowerStationGroupByCity.CityId = powerStations_group_item.Key;
myPowerStationGroupByCity.CityName = powerStations_group_item.First().CityName; myPowerStationGroupByCity.CityName = powerStations_group_item.First().CityName;
myPowerStationGroupByCity.Amount = powerStations_group_item.Count(); myPowerStationGroupByCity.Amount = powerStations_group_item.Count();
myPowerStationGroupByCity.MyPowerStations = powerStations_group_item.ToList(); myPowerStationGroupByCity.MyPowerStations = powerStations_group_item.ToList();

View File

@ -437,7 +437,7 @@
$('#templateAreaTab').find('li').attr('id', 'AreaTab' + val.cityId).clone().appendTo($('#areaTab')); $('#templateAreaTab').find('li').attr('id', 'AreaTab' + val.cityId).clone().appendTo($('#areaTab'));
$('#AreaTab' + val.cityId).find('a').attr('href', '#tab-' + val.cityId); $('#AreaTab' + val.cityId).find('a').attr('href', '#tab-' + val.cityId);
$('#AreaTab' + val.cityId).find('a').attr('class', 'nav-link fs-lg px-4'); $('#AreaTab' + val.cityId).find('a').attr('class', 'nav-link fs-lg px-4');
$('#AreaTab' + val.cityId).find('#areaName').html(val.city) $('#AreaTab' + val.cityId).find('#areaName').html(val.cityName)
$('#AreaTab' + val.cityId).find('#solarCount').html(val.amount) $('#AreaTab' + val.cityId).find('#solarCount').html(val.amount)
//alert(val.cityId+val.city + val.amount); //alert(val.cityId+val.city + val.amount);
//電站區域內容 //電站區域內容
@ -455,12 +455,12 @@
} }
function addPowerStationCard(idsd) { function addPowerStationCard(ids) {
//alert(ids); //alert(ids);
var url = "/PowerStation/GetSolarByCity"; var url = "/PowerStation/GetSolarByCity";
var send_data = { var send_data = {
cityid: idsd cityid: ids
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
@ -473,6 +473,11 @@
}); });
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
//電站卡片 //電站卡片
if (val.electricityMeterAt == undefined || val.electricityMeterAt == null) {
val.electricityMeterAt = "";
}
$('#templateCard').find('.col-xl-2').attr('id', 'card' + val.id).clone().appendTo($('#solarCard' + val.cityId)); $('#templateCard').find('.col-xl-2').attr('id', 'card' + val.id).clone().appendTo($('#solarCard' + val.cityId));
$('#card' + val.id).find('#editSolarUrl').attr('href', localurl + '/edit?stationId=' + val.id); $('#card' + val.id).find('#editSolarUrl').attr('href', localurl + '/edit?stationId=' + val.id);
$('#card' + val.id).find('#editSolarUrl').find('#Solarimg').attr('src', val.mainDisplay); $('#card' + val.id).find('#editSolarUrl').find('#Solarimg').attr('src', val.mainDisplay);
@ -487,6 +492,7 @@
'<td>' + val.name + '</td>' + '<td>' + val.name + '</td>' +
'<td>' + val.generatingCapacity.toFixed(2) + '</td>' + '<td>' + val.generatingCapacity.toFixed(2) + '</td>' +
'<td>' + val.inverterAmount + '</td>' + '<td>' + val.inverterAmount + '</td>' +
'<td>' + val.electricityMeterAt + '</td>' + '<td>' + val.electricityMeterAt + '</td>' +
'<td> <button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=' + val.id + '\'">選擇</button> <button type="button" class="btn btn-danger btn-pills waves-effect waves-themed del-btnto">刪除</button></td>' + '<td> <button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=' + val.id + '\'">選擇</button> <button type="button" class="btn btn-danger btn-pills waves-effect waves-themed del-btnto">刪除</button></td>' +

View File

@ -122,7 +122,12 @@
}); });
//預設查詢自己的公司 //預設查詢自己的公司
if (powerStationData == undefined || powerStationData == null) {
$("#select_power_station_company").val(@ViewBag.myUser.CompanyId).trigger('change'); $("#select_power_station_company").val(@ViewBag.myUser.CompanyId).trigger('change');
}
else {
$("#select_power_station_company").val(powerStationData.companyId).trigger('change');
}
}); });
//#endregion //#endregion
@ -1074,15 +1079,7 @@
if ($('#power_station_operation_personnel').val().length == 0) { if ($('#power_station_operation_personnel').val().length == 0) {
$('#power_station_operation_personnel-error').show(); $('#power_station_operation_personnel-error').show();
} }
} }
} }
//#endregion //#endregion

View File

@ -23,7 +23,7 @@
<label class="col-xl-4 form-label" id="city_label"><span class="text-danger">*</span>縣市</label> <label class="col-xl-4 form-label" id="city_label"><span class="text-danger">*</span>縣市</label>
<div class="col-xl-8"> <div class="col-xl-8">
<select class="form-control" id="select_city"> <select class="form-control" id="select_city">
<option value="0" selected>全部</option> <option value="0" selected>請選擇</option>
</select> </select>
</div> </div>
</div> </div>
@ -31,7 +31,7 @@
<label class="col-xl-4 form-label" id="area_label"><span class="text-danger">*</span>地區</label> <label class="col-xl-4 form-label" id="area_label"><span class="text-danger">*</span>地區</label>
<div class="col-xl-8"> <div class="col-xl-8">
<select class="form-control" id="select_area"> <select class="form-control" id="select_area">
<option value="0" selected>全部</option> <option value="0" selected>請選擇</option>
</select> </select>
</div> </div>
</div> </div>
@ -178,7 +178,7 @@
</div> </div>
<div class="row align-items-end"> <div class="row align-items-end">
<div class="col-xl-8"> <div class="col-xl-10">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5> <h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
<div class="row d-flex justify-content-between px-5"> <div class="row d-flex justify-content-between px-5">
<div class="col-xl-3 mb-3 row"> <div class="col-xl-3 mb-3 row">

View File

@ -386,8 +386,7 @@
$("#today_kwhkwp").html(0); $("#today_kwhkwp").html(0);
$("#avg_kwhkwp").html(0); $("#avg_kwhkwp").html(0);
$("#today_carbon").html(0); $("#today_carbon").html(0);
$("#total_power_station_count").html(0); $("#total_carbon").html(0);
$("#total_capacity").html(0);
$("#update_at").html(0); $("#update_at").html(0);
} }
else { else {
@ -582,7 +581,7 @@
StatusType = true; StatusType = true;
}*@ }*@
var checked = $(this).attr("data-checked"); var checked = $(this).attr("data-checked") == "true";
if (checked) { if (checked) {
$(this).attr("data-checked", false); $(this).attr("data-checked", false);
$("input[name='powerStationStatus[]']").prop('checked', false); $("input[name='powerStationStatus[]']").prop('checked', false);

View File

@ -151,7 +151,7 @@
</div> </div>
<div class="row align-items-end"> <div class="row align-items-end">
<div class="col-xl-8"> <div class="col-xl-10">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5> <h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
<div class="row d-flex justify-content-between px-5"> <div class="row d-flex justify-content-between px-5">
<div class="col-xl-3 mb-3 row"> <div class="col-xl-3 mb-3 row">

View File

@ -88,11 +88,11 @@
<div class="card-body"> <div class="card-body">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<p>今日減碳量</p> <p>今日減碳量</p>
<p><span class="color-info-700" id="today_carbon">0.00</span></p> <p><span class="color-info-700 fs-xl font-weight-bold" id="today_carbon">0.00</span></p>
</div> </div>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<p>累積減碳量</p> <p>累積減碳量</p>
<p><span class="color-info-700" id="total_carbon">0.00</span></p> <p><span class="color-info-700 fs-xl font-weight-bold" id="total_carbon">0.00</span></p>
</div> </div>
</div> </div>
</div> </div>