Merge branch 'Gary'
This commit is contained in:
commit
317597571d
@ -1333,20 +1333,20 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
if (User.Role.Layer == 0 || User.Role.Layer == 1)
|
||||
{
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN(@Ids)";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { Ids = ids })).ToList();
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = CityId })).ToList();
|
||||
trans.Commit();
|
||||
}
|
||||
else if (User.Role.Layer == 2)
|
||||
{
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN(@Ids) AND CompanyId=@CompanyId";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { Ids = ids ,CompanyId = User.CompanyId })).ToList();
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND CompanyId=@CompanyId";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = CityId,CompanyId = User.CompanyId })).ToList();
|
||||
trans.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
var sql = "SELECT power_station.* FROM power_station LEFT JOIN power_station_operation_personnel ON power_station.Id = power_station_operation_personnel.PowerStationId WHERE CityId IN(@Ids) AND Userid = @UserId";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { UserId = User.Id })).ToList();
|
||||
var sql = "SELECT power_station.* FROM power_station LEFT JOIN power_station_operation_personnel ON power_station.Id = power_station_operation_personnel.PowerStationId WHERE CityId IN @IDs AND Userid = @UserId";
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = CityId, UserId = User.Id })).ToList();
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,190 +406,128 @@
|
||||
|
||||
@section Scripts{
|
||||
<script>
|
||||
|
||||
var tablocation = "";
|
||||
$(function () {
|
||||
|
||||
var localurl = this.location.href;
|
||||
|
||||
//#region 電站區域Tab
|
||||
|
||||
//#endregion
|
||||
|
||||
//var url = "/PowerStation/GetSolarCitySummary";
|
||||
//$.post(url, function (rel) {
|
||||
// if (rel.code != "0000") {
|
||||
// toast_error(rel.msg);
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
// $.each(rel.data, function (index, val) {
|
||||
// alert(val.city + val.amount);
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
//}, 'json');
|
||||
|
||||
var url = "/PowerStation/GetSolarByCity";
|
||||
var ids = [1, 3];
|
||||
var send_data = {
|
||||
cityid: ids
|
||||
}
|
||||
$.post(url, send_data, function (rel) {
|
||||
var url = "/PowerStation/GetSolarCitySummary";
|
||||
var ids = new Array(0)
|
||||
$.post(url, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$.each(rel.data, function (index, val) {
|
||||
alert(val.name);
|
||||
//電站區域
|
||||
if (index == 0) {
|
||||
tablocation = val.cityId;
|
||||
}
|
||||
ids.push(val.cityId);
|
||||
$('#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('class', 'nav-link fs-lg px-4');
|
||||
$('#AreaTab' + val.cityId).find('#areaName').html(val.city)
|
||||
$('#AreaTab' + val.cityId).find('#solarCount').html(val.amount)
|
||||
//alert(val.cityId+val.city + val.amount);
|
||||
//電站區域內容
|
||||
$('#templateArea').find('.tab-pane').attr('id', 'tab-'+val.cityId).clone().appendTo($('#area'));
|
||||
$('#tab-' + val.cityId).attr('aria-labelledby', val.cityId)
|
||||
$('#tab-' + val.cityId).find('#solarCard').attr('id', 'solarCard' + val.cityId);
|
||||
$('#tab-' + val.cityId).find('#solarTable').attr('id', 'solarTable' + val.cityId);
|
||||
});
|
||||
addPowerStationCard(ids);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}, 'json');
|
||||
|
||||
//#endregion
|
||||
|
||||
function addPowerStationCard(ids) {
|
||||
|
||||
//alert(ids);
|
||||
var url = "/PowerStation/GetSolarByCity";
|
||||
var send_data = {
|
||||
cityid: ids
|
||||
}
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$.each(rel.data, function (index, val) {
|
||||
//電站卡片
|
||||
$('#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('#solarName').text(val.name);
|
||||
$('#card' + val.id).find('#today_kwh').text(val.kwh);
|
||||
$('#card' + val.id).find('#kwhkwp').text(val.inverterAmount);
|
||||
$('#card' + val.id).find('#PR').text(val.electricityMeterAt);
|
||||
|
||||
$('#solarTable' + val.id).find('tbody').append('<tr>' +
|
||||
'<td>'+val.id+'</td>' +
|
||||
'<td>' + val.name+'</td>' +
|
||||
'<td>' + val.kwh+'</td>' +
|
||||
'<td>' + val.inverterAmount+'</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></td>' +
|
||||
|
||||
'</tr>');
|
||||
});
|
||||
$('.nav-tabs a[href="#' + tablocation + '"]').tab('show');
|
||||
|
||||
$('.TableArea').hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}, 'json');
|
||||
|
||||
|
||||
}
|
||||
//電站區域
|
||||
$('#templateAreaTab').find('li').attr('id', 'AreaTabnewtaipei').clone().appendTo($('#areaTab'));
|
||||
$('#AreaTabnewtaipei').find('a').attr('href', '#tab-newtaipei');
|
||||
$('#AreaTabnewtaipei').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
$('#AreaTabnewtaipei').find('#areaName').html('新北市')
|
||||
$('#AreaTabnewtaipei').find('#solarCount').html('2')
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabnewtaipei').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabnewtaipei').find('a').attr('href', '#tab-newtaipei');
|
||||
//$('#AreaTabnewtaipei').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabnewtaipei').find('#areaName').html('新北市')
|
||||
//$('#AreaTabnewtaipei').find('#solarCount').html('2')
|
||||
|
||||
$('#templateAreaTab').find('li').attr('id', 'AreaTabHsinchu').clone().appendTo($('#areaTab'));
|
||||
$('#AreaTabHsinchu').find('a').attr('href', '#tab-Hsinchu');
|
||||
$('#AreaTabHsinchu').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
$('#AreaTabHsinchu').find('#areaName').html('新竹市')
|
||||
$('#AreaTabHsinchu').find('#solarCount').html('3')
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabHsinchu').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabHsinchu').find('a').attr('href', '#tab-Hsinchu');
|
||||
//$('#AreaTabHsinchu').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabHsinchu').find('#areaName').html('新竹市')
|
||||
//$('#AreaTabHsinchu').find('#solarCount').html('3')
|
||||
|
||||
$('#templateAreaTab').find('li').attr('id', 'AreaTabPingtung').clone().appendTo($('#areaTab'));
|
||||
$('#AreaTabPingtung').find('a').attr('href', '#tab-Pingtung');
|
||||
$('#AreaTabPingtung').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
$('#AreaTabPingtung').find('#areaName').html('屏東縣')
|
||||
$('#AreaTabPingtung').find('#solarCount').html('1')
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabPingtung').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabPingtung').find('a').attr('href', '#tab-Pingtung');
|
||||
//$('#AreaTabPingtung').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabPingtung').find('#areaName').html('屏東縣')
|
||||
//$('#AreaTabPingtung').find('#solarCount').html('1')
|
||||
|
||||
//電站區域內容
|
||||
$('#templateArea').find('.tab-pane').attr('id', 'tab-newtaipei').clone().appendTo($('#area'));
|
||||
$('#tab-newtaipei').attr('aria-labelledby', 'tab-newtaipei')
|
||||
$('#tab-newtaipei').find('#solarCard').attr('id', 'solarCardnewtaipei');
|
||||
$('#tab-newtaipei').find('#solarTable').attr('id', 'solarTablenewtaipei');
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-newtaipei').clone().appendTo($('#area'));
|
||||
//$('#tab-newtaipei').attr('aria-labelledby', 'tab-newtaipei')
|
||||
//$('#tab-newtaipei').find('#solarCard').attr('id', 'solarCardnewtaipei');
|
||||
//$('#tab-newtaipei').find('#solarTable').attr('id', 'solarTablenewtaipei');
|
||||
|
||||
$('#templateArea').find('.tab-pane').attr('id', 'tab-Hsinchu').clone().appendTo($('#area'));
|
||||
$('#tab-Hsinchu').attr('aria-labelledby', 'tab-Hsinchu')
|
||||
$('#tab-Hsinchu').find('#solarCard').attr('id', 'solarCardHsinchu');
|
||||
$('#tab-Hsinchu').find('#solarTable').attr('id', 'solarTableHsinchu');
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-Hsinchu').clone().appendTo($('#area'));
|
||||
//$('#tab-Hsinchu').attr('aria-labelledby', 'tab-Hsinchu')
|
||||
//$('#tab-Hsinchu').find('#solarCard').attr('id', 'solarCardHsinchu');
|
||||
//$('#tab-Hsinchu').find('#solarTable').attr('id', 'solarTableHsinchu');
|
||||
|
||||
$('#templateArea').find('.tab-pane').attr('id', 'tab-Pingtung').clone().appendTo($('#area'));
|
||||
$('#tab-Pingtung').attr('aria-labelledby', 'tab-Pingtung')
|
||||
$('#tab-Pingtung').find('#solarCard').attr('id', 'solarCardPingtung');
|
||||
$('#tab-Pingtung').find('#solarTable').attr('id', 'solarTablePingtung');
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-Pingtung').clone().appendTo($('#area'));
|
||||
//$('#tab-Pingtung').attr('aria-labelledby', 'tab-Pingtung')
|
||||
//$('#tab-Pingtung').find('#solarCard').attr('id', 'solarCardPingtung');
|
||||
//$('#tab-Pingtung').find('#solarTable').attr('id', 'solarTablePingtung');
|
||||
|
||||
//電站卡片
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '001').clone().appendTo($('#solarCardnewtaipei'));
|
||||
$('#001').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=1');
|
||||
$('#001').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/1/main.png');
|
||||
$('#001').find('#solarName').text('三重慈濟站');
|
||||
$('#001').find('#today_kwh').text('1000');
|
||||
$('#001').find('#kwhkwp').text('10');
|
||||
$('#001').find('#PR').text('2021-06-15');
|
||||
|
||||
$('#solarTablenewtaipei').find('tbody').append('<tr>' +
|
||||
'<td>001</td>' +
|
||||
'<td>三重慈濟站</td>' +
|
||||
'<td>1000</td>' +
|
||||
'<td>10</td>' +
|
||||
'<td>2021-06-15</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=001' + '\'">選擇</button></td>' +
|
||||
|
||||
'</tr>');
|
||||
|
||||
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '002').clone().appendTo($('#solarCardnewtaipei'));
|
||||
$('#002').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=2');
|
||||
$('#002').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/2/main.png');
|
||||
$('#002').find('#solarName').text('板橋慈濟站');
|
||||
$('#002').find('#today_kwh').text('2000');
|
||||
$('#002').find('#kwhkwp').text('110');
|
||||
$('#002').find('#PR').text('2021-06-05');
|
||||
|
||||
$('#solarTablenewtaipei').find('tbody').append('<tr>' +
|
||||
'<td>002</td>' +
|
||||
'<td>板橋慈濟站</td>' +
|
||||
'<td>2000</td>' +
|
||||
'<td>110</td>' +
|
||||
'<td>2021-06-05</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=002' + '\'">選擇</button></td>' +
|
||||
'</tr>');
|
||||
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '003').clone().appendTo($('#solarCardHsinchu'));
|
||||
$('#003').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=3');
|
||||
$('#003').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/3/main.png');
|
||||
$('#003').find('#solarName').text('新竹巨城站');
|
||||
$('#003').find('#today_kwh').text('3000');
|
||||
$('#003').find('#kwhkwp').text('166');
|
||||
$('#003').find('#PR').text('2021-06-05');
|
||||
|
||||
$('#solarTableHsinchu').find('tbody').append('<tr>' +
|
||||
'<td>003</td>' +
|
||||
'<td>新竹巨城站</td>' +
|
||||
'<td>3000</td>' +
|
||||
'<td>166</td>' +
|
||||
'<td>2021-06-05</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=003' + '\'">選擇</button></td>' +
|
||||
'</tr>');
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '004').clone().appendTo($('#solarCardHsinchu'));
|
||||
$('#004').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=4');
|
||||
$('#004').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/4/main.png');
|
||||
$('#004').find('#solarName').text('新竹交大站');
|
||||
$('#004').find('#today_kwh').text('4000');
|
||||
$('#004').find('#kwhkwp').text('205');
|
||||
$('#004').find('#PR').text('2021-06-05');
|
||||
|
||||
$('#solarTableHsinchu').find('tbody').append('<tr>' +
|
||||
'<td>004</td>' +
|
||||
'<td>新竹交大站</td>' +
|
||||
'<td>4000</td>' +
|
||||
'<td>205</td>' +
|
||||
'<td>2021-06-05</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=004' + '\'">選擇</button></td>' +
|
||||
'</tr>');
|
||||
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '005').clone().appendTo($('#solarCardHsinchu'));
|
||||
$('#005').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=5');
|
||||
$('#005').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/5/main.jpg');
|
||||
$('#005').find('#solarName').text('新竹動物園站');
|
||||
$('#005').find('#today_kwh').text('123');
|
||||
$('#005').find('#kwhkwp').text('600');
|
||||
$('#005').find('#PR').text('2021-06-09');
|
||||
|
||||
$('#solarTableHsinchu').find('tbody').append('<tr>' +
|
||||
'<td>005</td>' +
|
||||
'<td>新竹動物園站</td>' +
|
||||
'<td>123</td>' +
|
||||
'<td>600</td>' +
|
||||
'<td>2021-06-09</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=005' + '\'">選擇</button></td>' +
|
||||
'</tr>');
|
||||
|
||||
$('#templateCard').find('.col-xl-2').attr('id', '006').clone().appendTo($('#solarCardPingtung'));
|
||||
$('#006').find('#editSolarUrl').attr('href', localurl + '/edit?stationId=6');
|
||||
$('#006').find('#editSolarUrl').find('#Solarimg').attr('src', '/upload/power_station/6/main.png');
|
||||
$('#006').find('#solarName').text('屏東枋山海纜站');
|
||||
$('#006').find('#today_kwh').text('4954');
|
||||
$('#006').find('#kwhkwp').text('13');
|
||||
$('#006').find('#PR').text('2021-06-22');
|
||||
|
||||
$('#solarTableHsinchu').find('tbody').append('<tr>' +
|
||||
'<td>006</td>' +
|
||||
'<td>新竹動物園站</td>' +
|
||||
'<td>4954</td>' +
|
||||
'<td>13</td>' +
|
||||
'<td>2021-06-22</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=006' + '\'">選擇</button></td>' +
|
||||
'</tr>');
|
||||
|
||||
|
||||
$('.nav-tabs a[href="#tab-newtaipei"]').tab('show');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user