1. 修改主圖顯示
This commit is contained in:
parent
ed0a777f75
commit
dbac46c03c
@ -1662,7 +1662,9 @@ namespace SolarPower.Controllers
|
||||
updata = new UpdataPowerStationImage()
|
||||
{
|
||||
Id = post.TargetImageId,
|
||||
PowerStationId = post.PowerStationId,
|
||||
IsMainDisplay = 1,
|
||||
Image = powerStationImage.Image,
|
||||
UpdatedBy = myUser.Id
|
||||
};
|
||||
|
||||
@ -1932,6 +1934,12 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "0000";
|
||||
solaramount = await powerStationRepository.GetSolarByCity(myUser, cityid);
|
||||
|
||||
foreach(var solar in solaramount)
|
||||
{
|
||||
solar.MainDisplay = Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
||||
}
|
||||
|
||||
apiResult.Data = solaramount;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
||||
@ -17,6 +17,7 @@ namespace SolarPower.Models.PowerStation
|
||||
public int AreaId { get; set; } //地區
|
||||
public string Address { get; set; } //地址
|
||||
public string Name { get; set; } //名稱
|
||||
public string MainDisplay { get; set; } //主要顯示圖片
|
||||
public string Code { get; set; } //電站代碼
|
||||
public string SerialNumber { get; set; } //四碼流水號
|
||||
public byte IsEscrow { get; set; } //是否被代管
|
||||
|
||||
@ -224,8 +224,9 @@ namespace SolarPower.Repository.Implement
|
||||
sql += " AND opr.EndTime >= @StartDate";
|
||||
}
|
||||
|
||||
if (filter.WorkType > -1)
|
||||
if (filter.WorkType > 0)
|
||||
{
|
||||
filter.WorkType -= 1;
|
||||
sql += @" AND opr.WorkType = @WorkType";
|
||||
}
|
||||
else
|
||||
|
||||
@ -1155,6 +1155,25 @@ namespace SolarPower.Repository.Implement
|
||||
|
||||
await conn.ExecuteAsync(sql, image, trans);
|
||||
|
||||
|
||||
var sql_MainDispalyImg = string.Empty;
|
||||
List<string> powerStationMainDispalyImg = new List<string>()
|
||||
{
|
||||
"Id",
|
||||
"MainDisplay"
|
||||
};
|
||||
|
||||
if(image.IsMainDisplay == 1)
|
||||
{
|
||||
//修改主資料庫
|
||||
sql_MainDispalyImg = GenerateUpdateQuery(powerStationMainDispalyImg);
|
||||
await conn.ExecuteAsync(sql_MainDispalyImg, new { Id = image.PowerStationId, MainDisplay = image.Image }, trans);
|
||||
|
||||
//修改子資料庫
|
||||
sql_MainDispalyImg = GenerateUpdateQueryWithCustomDBNameAndTable(powerStationMainDispalyImg, db_name, "power_station");
|
||||
await conn.ExecuteAsync(sql_MainDispalyImg, new { Id = image.PowerStationId, MainDisplay = image.Image }, trans);
|
||||
}
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
||||
@ -51,12 +51,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-5 d-flex align-items-center px-3">
|
||||
<div class="pr-3">
|
||||
<div class="row mb-5 d-flex align-items-top px-3">
|
||||
<div class="col-1 p-0">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="Allpowerstation()">全選</button>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<div class="frame-wrap" id="CheckPowerStation">
|
||||
<div class="col-11">
|
||||
<div class="row frame-wrap" id="CheckPowerStation">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -282,7 +282,7 @@
|
||||
}
|
||||
$('#CheckPowerStation').empty();
|
||||
$.each(rel.data, function (index, val) {
|
||||
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
|
||||
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
|
||||
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
|
||||
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
|
||||
powerids.push(String(val.id));
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
<div class="row mb-3 d-flex justify-content-start px-3">
|
||||
<div class="pr-3">
|
||||
<div class="btn-group btn-group-md">
|
||||
<button type="button" class="btn btn-success waves-effect waves-themed" onclick="ChangeType(-1)" id="button0">全部</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(2)" id="button3">維修</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(1)" id="button2">巡檢</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(0)" id="button1">清洗</button>
|
||||
<button type="button" class="btn btn-success waves-effect waves-themed" onclick="ChangeType(0)" id="button0">全部</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(3)" id="button3">維修</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(2)" id="button2">巡檢</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(1)" id="button1">清洗</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
|
||||
@ -464,7 +464,7 @@
|
||||
//電站卡片
|
||||
$('#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').find('#Solarimg').attr('src', '/upload/power_station/' + + val.id+'/main.png');
|
||||
$('#card' + val.id).find('#editSolarUrl').find('#Solarimg').attr('src', val.mainDisplay);
|
||||
$('#card' + val.id).find('#solarName').text(val.name);
|
||||
$('#card' + val.id).find('#today_kwh').text(val.kwh);
|
||||
$('#card' + val.id).find('#kwhkwp').text(val.inverterAmount);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user