衝突合併
This commit is contained in:
commit
a1beee85fe
@ -544,6 +544,7 @@ namespace SolarPower.Controllers
|
||||
FixDo = post.FixDo,
|
||||
Status = post.Status,
|
||||
FinishTime = !string.IsNullOrEmpty(finishTime) ? finishTime : null,
|
||||
WorkPersonId = post.WorkPersonId,
|
||||
WorkTime = post.WorkTime,
|
||||
Notice = post.Notice,
|
||||
Description = post.Description,
|
||||
@ -562,6 +563,7 @@ namespace SolarPower.Controllers
|
||||
"WorkTime",
|
||||
"Notice",
|
||||
"Description",
|
||||
"WorkPersonId",
|
||||
"UpdatedBy",
|
||||
};
|
||||
|
||||
@ -753,7 +755,10 @@ namespace SolarPower.Controllers
|
||||
foreach (var file in recode.RecodeFiles)
|
||||
{
|
||||
var hyperLink = "<a href='" + baseURL + file.FileName + "'>" + file.FileName + "</a>";
|
||||
|
||||
if(recode.HyperLinks == null)
|
||||
{
|
||||
recode.HyperLinks = new List<string>();
|
||||
}
|
||||
recode.HyperLinks.Add(hyperLink);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,8 @@ namespace SolarPower.Models
|
||||
{
|
||||
public List<int> Cityid { get; set; } //都市
|
||||
public List<int> Status { get; set; } //狀態
|
||||
public int KwhOrder { get; set; }
|
||||
public int PrOrder { get; set; }
|
||||
}
|
||||
|
||||
public class StationIds
|
||||
|
||||
@ -130,6 +130,28 @@ namespace SolarPower.Repository.Implement
|
||||
try
|
||||
{
|
||||
var ids = "";
|
||||
var KWH = "";
|
||||
var PR = "";
|
||||
if(post.KwhOrder == 0)
|
||||
{
|
||||
KWH = " ORDER BY Today_kwh DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
KWH = " ORDER BY Today_kwh";
|
||||
}
|
||||
|
||||
if (post.PrOrder == 0)
|
||||
{
|
||||
PR = ",today_PR DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
PR = ",today_PR";
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var id in post.Cityid)
|
||||
{
|
||||
ids = ids + id + ",";
|
||||
@ -140,19 +162,19 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
if (User.Role.Layer == 0 || User.Role.Layer == 1)
|
||||
{
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND HealthStatus IN @Status";
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND HealthStatus IN @Status"+ KWH + PR;
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = post.Cityid, Status = post.Status})).ToList();
|
||||
trans.Commit();
|
||||
}
|
||||
else if (User.Role.Layer == 2)
|
||||
{
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND CompanyId=@CompanyId AND HealthStatus IN @Status";
|
||||
var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND CompanyId=@CompanyId AND HealthStatus IN @Status" + KWH + PR;
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = post.Cityid, CompanyId = User.CompanyId , Status = post.Status })).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 AND HealthStatus IN @Status";
|
||||
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 AND HealthStatus IN @Status" + KWH + PR;
|
||||
powerstation = (await conn.QueryAsync<PowerStation>(sql, new { IDs = post.Cityid, UserId = User.Id , Status = post.Status })).ToList();
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
<th>狀態</th>
|
||||
<th>執行人員</th>
|
||||
<th>本次作業預計</th>
|
||||
<th>照片</th>
|
||||
<th>檔案</th>
|
||||
<th>完成時間</th>
|
||||
@*<th>功能</th>*@
|
||||
</tr>
|
||||
@ -98,7 +98,7 @@
|
||||
<th>狀態</th>
|
||||
<th>執行人員</th>
|
||||
<th>本次作業預計</th>
|
||||
@*<th>照片</th>*@
|
||||
<th>檔案</th>
|
||||
<th>完成時間</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -907,9 +907,10 @@
|
||||
|
||||
str += "<td>";
|
||||
if (value.finishTime != undefined || value.finishTime != null || value.finishTime != "") {
|
||||
value.hyperLinks.forEach(function (value3, index) {
|
||||
str += value3;
|
||||
});
|
||||
//value.hyperLinks.forEach(function (value3, index) {
|
||||
// str += value3;
|
||||
//});
|
||||
str += value.finishTime ;
|
||||
}
|
||||
str += "</td>";
|
||||
|
||||
|
||||
@ -34,21 +34,21 @@
|
||||
</div>
|
||||
<div class="row mb-3 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>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="AllStatus()">全選</button>
|
||||
</div>
|
||||
<div class="col-11 p-2">
|
||||
<div class="row frame-wrap" id="CheckPowerStation">
|
||||
<div class="row frame-wrap" id="CheckStatus">
|
||||
<div class="col-2 mb-2 custom-control custom-checkbox d-flex align-content-center">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline9" checked="">
|
||||
<label class="custom-control-label" for="defaultInline9">設備正常 <i class="btn btn-success btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-check"></i></label>
|
||||
<input type="checkbox" class="custom-control-input" id="Status_1" checked="">
|
||||
<label class="custom-control-label" for="Status_1">設備正常 <i class="btn btn-success btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-check"></i></label>
|
||||
</div>
|
||||
<div class=" col-2 mb-2 custom-control custom-checkbox align-content-center">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline10" checked="">
|
||||
<label class="custom-control-label" for="defaultInline10">設備斷線 <i class="btn btn-warning btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-exclamation"></i></label>
|
||||
<input type="checkbox" class="custom-control-input" id="Status_2" checked="">
|
||||
<label class="custom-control-label" for="Status_2">設備斷線 <i class="btn btn-warning btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-exclamation"></i></label>
|
||||
</div>
|
||||
<div class="col-2 mb-2 custom-control custom-checkbox align-content-center">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline11" checked="">
|
||||
<label class="custom-control-label" for="defaultInline11">設備異常 <i class="btn btn-danger btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-horizontal-rule"></i></label>
|
||||
<input type="checkbox" class="custom-control-input" id="Status_3" checked="">
|
||||
<label class="custom-control-label" for="Status_3">設備異常 <i class="btn btn-danger btn-sm btn-icon rounded-circle waves-effect waves-themed fal fa-horizontal-rule"></i></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -58,16 +58,16 @@
|
||||
<label>排序條件</label>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<div class="frame-wrap" id="citytest">
|
||||
<select class="form-control">
|
||||
<div class="frame-wrap" >
|
||||
<select class="form-control" id="kwh_order">
|
||||
<option value="0">發電量 - 正序</option>
|
||||
<option value="1">發電量 - 倒序</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<div class="frame-wrap" id="citytest">
|
||||
<select class="form-control">
|
||||
<div class="frame-wrap" >
|
||||
<select class="form-control" id="pr_order">
|
||||
<option value="0">PR值 - 正序</option>
|
||||
<option value="1">PR值 - 倒序</option>
|
||||
</select>
|
||||
@ -210,9 +210,15 @@
|
||||
<th>編號</th>
|
||||
<th>電站名稱</th>
|
||||
<th>裝置容量(kWp)</th>
|
||||
<th>逆變器數量</th>
|
||||
<th>台電掛表日</th>
|
||||
<th></th>
|
||||
<th>累積發電量</th>
|
||||
<th>今日發電量</th>
|
||||
<th>發電小時</th>
|
||||
<th>PR</th>
|
||||
<th>日照</th>
|
||||
<th>平均日照</th>
|
||||
<th>今日收入</th>
|
||||
<th>狀況</th>
|
||||
<th>功能</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -244,9 +250,15 @@
|
||||
<th>編號</th>
|
||||
<th>電站名稱</th>
|
||||
<th>裝置容量(kWp)</th>
|
||||
<th>逆變器數量</th>
|
||||
<th>台電掛表日</th>
|
||||
<th></th>
|
||||
<th>累積發電量</th>
|
||||
<th>今日發電量</th>
|
||||
<th>發電小時</th>
|
||||
<th>PR</th>
|
||||
<th>日照</th>
|
||||
<th>平均日照</th>
|
||||
<th>今日收入</th>
|
||||
<th>狀況</th>
|
||||
<th>功能</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -264,7 +276,7 @@
|
||||
var ids = new Array(0);//當前選擇縣市
|
||||
var powerids = new Array(0);//當前選擇電站
|
||||
var Allids = new Array(0);//全部縣市
|
||||
var Allpowerids = new Array(0);//全部電站
|
||||
var status123 = new Array(0);//狀態
|
||||
//#region Array.Remove
|
||||
Array.prototype.remove = function (val) {
|
||||
var index = this.indexOf(val);
|
||||
@ -275,6 +287,8 @@
|
||||
//#endregion
|
||||
|
||||
$(function () {
|
||||
status123 = [];
|
||||
|
||||
var Nurl = "/PowerStation/GetSolarCitySummary";
|
||||
$.post(Nurl, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
@ -290,6 +304,9 @@
|
||||
ids.push(rel.data[i].cityId);
|
||||
Allids.push(rel.data[i].cityId);
|
||||
}
|
||||
status123.push(1);
|
||||
status123.push(2);
|
||||
status123.push(3);
|
||||
getStation(ids);
|
||||
}, 'json');
|
||||
|
||||
@ -299,11 +316,7 @@
|
||||
$('#citytest').on("click", "button", function () {
|
||||
var clickid = $(this).attr('id');
|
||||
var classid = clickid.split("_");
|
||||
var Newpowerids = new Array(0);
|
||||
var value = document.getElementById(clickid).className;
|
||||
ids.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
if (value == 'btn btn-outline-success waves-effect waves-themed ml-2') { //選擇
|
||||
document.getElementById(clickid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2');
|
||||
ids.push(Number(classid[1]));
|
||||
@ -317,47 +330,109 @@
|
||||
|
||||
function getStation(ids)
|
||||
{
|
||||
var status = [1,2,3];
|
||||
var kwh = $('#kwh_order').val();
|
||||
var pr = $('#pr_order').val();
|
||||
var send_data = {
|
||||
cityid: ids,
|
||||
status: status,
|
||||
status: status123,
|
||||
kwhOrder: kwh,
|
||||
prOrder: pr
|
||||
};
|
||||
//ids.sort(function (a, b) {
|
||||
// return a - b;
|
||||
//});
|
||||
//ids.sort();
|
||||
var Nurl = "/StationOverview/GetSolarByCity";
|
||||
$.post(Nurl, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
ids.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
ids.sort();
|
||||
if (ids.length == 0 || status123.length == 0) {
|
||||
$('#areaCard').empty();
|
||||
$.each(rel.data, function (index, val) {
|
||||
$('#templateCard').find('.col-xl-3').clone().attr('id', 'card_' + val.id).appendTo($('#areaCard'));
|
||||
$('#card_' + val.id).find('#solarName').html(val.name);
|
||||
$('#card_' + val.id).find('#Temp').html(val.todayWeatherTemp);
|
||||
var type = "";
|
||||
switch (val.solarType) {
|
||||
case 0: type = "自建躉售"; break;
|
||||
case 1: type = "租建躉售"; break;
|
||||
case 2: type = "自建自用"; break;
|
||||
default:
|
||||
console.log(`Sorry, we are out of ${val.solarType}.`);
|
||||
$('#solarTable').find('tbody').empty();
|
||||
$("#today_kwh").html(0);
|
||||
$("#total_kwh").html(0);
|
||||
$("#today_irradiance").html(0);
|
||||
$("#avg_irradiance").html(0);
|
||||
$("#today_PR").html(0);
|
||||
$("#avg_PR").html(0);
|
||||
$("#today_kwhkwp").html(0);
|
||||
$("#avg_kwhkwp").html(0);
|
||||
$("#today_carbon").html(0);
|
||||
$("#total_power_station_count").html(0);
|
||||
$("#total_capacity").html(0);
|
||||
$("#update_at").html(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var Nurl = "/StationOverview/GetSolarByCity";
|
||||
$.post(Nurl, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
$('#card_' + val.id).find('#stationtype').html(type);
|
||||
var time = new Date(val.createdAt);
|
||||
$('#card_' + val.id).find('#editSolarUrl').attr('href', localurl + '/Info?stationId=' + val.id);
|
||||
$('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes());
|
||||
$('#card_' + val.id).find('#Capacity').html(val.generatingCapacity);
|
||||
$('#card_' + val.id).find('#PowerRate').html(val.generatingCapacity * val.powerRate);
|
||||
$('#card_' + val.id).find('#PR').html(val.pr);
|
||||
$('#card_' + val.id).find('#aria').attr('aria-valuenow', val.pr);
|
||||
$('#card_' + val.id).find('#aria').attr('style', "width:" + val.pr + "%;");
|
||||
powerids.push(val.id);
|
||||
});
|
||||
GetStationCard();
|
||||
}, 'json');
|
||||
$('#areaCard').empty();
|
||||
$('#solarTable').find('tbody').empty();
|
||||
powerids = [];
|
||||
$.each(rel.data, function (index, val) {
|
||||
$('#templateCard').find('.col-xl-3').clone().attr('id', 'card_' + val.id).appendTo($('#areaCard'));
|
||||
var statusicon;
|
||||
switch (val.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 = 'NULL'; break;
|
||||
}
|
||||
$('#card_' + val.id).find('#solarName').html(statusicon + val.name);
|
||||
$('#card_' + val.id).find('#Temp').html(val.todayWeatherTemp);
|
||||
var type = "";
|
||||
switch (val.solarType) {
|
||||
case 0: type = "自建躉售"; break;
|
||||
case 1: type = "租建躉售"; break;
|
||||
case 2: type = "自建自用"; break;
|
||||
default:
|
||||
console.log(`Sorry, we are out of ${val.solarType}.`);
|
||||
}
|
||||
$('#card_' + val.id).find('#stationtype').html(type);
|
||||
var time = new Date(val.createdAt);
|
||||
$('#card_' + val.id).find('#editSolarUrl').attr('href', localurl + '/Info?stationId=' + val.id);
|
||||
$('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes());
|
||||
$('#card_' + val.id).find('#Capacity').html(val.today_kWh);
|
||||
$('#card_' + val.id).find('#PowerRate').html(val.today_kWh * val.powerRate);
|
||||
$('#card_' + val.id).find('#PR').html(val.today_PR);
|
||||
$('#card_' + val.id).find('#aria').attr('aria-valuenow', val.today_PR);
|
||||
$('#card_' + val.id).find('#aria').attr('style', "width:" + val.today_PR + "%;");
|
||||
powerids.push(val.id);
|
||||
var statusName;
|
||||
switch (val.healthStatus) {
|
||||
case 1:
|
||||
statusName = "設備正常";
|
||||
break;
|
||||
case 2:
|
||||
statusName = "設備斷線";
|
||||
break;
|
||||
case 3:
|
||||
statusName = "設備異常";
|
||||
break;
|
||||
default:
|
||||
statusName = "NULL";
|
||||
}
|
||||
$('#solarTable').find('tbody').append('<tr>' +
|
||||
'<td>' + val.code + '</td>' +
|
||||
'<td>' + val.name + '</td>' +
|
||||
'<td>' + val.generatingCapacity + '</td>' +
|
||||
'<td>' + val.total_kWh + '</td>' +
|
||||
'<td>' + val.today_kWh + '</td>' +
|
||||
'<td>' + val.solarHour + '</td>' +
|
||||
'<td>' + val.today_PR + '</td>' +
|
||||
'<td>' + val.today_irradiance + '</td>' +
|
||||
'<td>' + val.avg_irradiance + '</td>' +
|
||||
'<td>' + val.today_Monery + '</td>' +
|
||||
'<td>' + statusName + '</td>' +
|
||||
'<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/Info?stationId=' + val.id + '\'">選擇</button></td>' +
|
||||
|
||||
'</tr>');
|
||||
});
|
||||
GetStationCard();
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
}
|
||||
function GetStationCard()
|
||||
{
|
||||
@ -386,7 +461,52 @@
|
||||
});
|
||||
}
|
||||
|
||||
//#region 選擇狀態checkbox
|
||||
$('#CheckStatus').on("click", "input", function () {
|
||||
var clickid = $(this).attr('id');
|
||||
var classid = clickid.split("_");
|
||||
var job = document.getElementById(clickid);
|
||||
if (job.checked == true) {
|
||||
status123.push(Number(classid[1]));
|
||||
}
|
||||
else {
|
||||
status123.remove(Number(classid[1]));
|
||||
}
|
||||
getStation(ids);
|
||||
})
|
||||
//#endregion
|
||||
|
||||
$('#kwh_order').change(function () {
|
||||
getStation(ids);
|
||||
})
|
||||
|
||||
$('#pr_order').change(function () {
|
||||
getStation(ids);
|
||||
})
|
||||
|
||||
//#region 縣市全選
|
||||
function Allcity() {
|
||||
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);
|
||||
});
|
||||
getStation(ids);
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 狀態全選
|
||||
function AllStatus() {
|
||||
status123 = [];
|
||||
for (var i = 1; i <= 3; i++)
|
||||
{
|
||||
$('#Status_' + i).prop("checked", true);
|
||||
status123.push(i);
|
||||
}
|
||||
getStation(ids);
|
||||
}
|
||||
//#endregion
|
||||
|
||||
function CardDisplay() {
|
||||
|
||||
|
||||
@ -97,10 +97,14 @@
|
||||
|
||||
@section Scripts{
|
||||
<script>
|
||||
var powerids = new Array(0);//當前選擇電站
|
||||
var Type = 0; // 項目
|
||||
var stationId;
|
||||
var powerStationData;
|
||||
var stationOverview;
|
||||
|
||||
var recode;
|
||||
var selected_work_type = -1;
|
||||
$(function () {
|
||||
var url = new URL(location.href);
|
||||
stationId = url.searchParams.get('stationId');
|
||||
@ -414,9 +418,455 @@
|
||||
SetLandBuildingInfo();
|
||||
//#endregion
|
||||
|
||||
$("#power_station_select_modal").append($("<option />").val(stationId).text(powerStationData.name));
|
||||
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
|
||||
|
||||
}, 'json');
|
||||
|
||||
//#region 載入上傳資料 - 單線圖
|
||||
//#region Date Picker
|
||||
datepicker = $('#date-range-record').daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
locale: { format: 'YYYY/MM/DD' },
|
||||
opens: 'left'
|
||||
}, function (start, end, label) {
|
||||
@* console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));*@
|
||||
});
|
||||
|
||||
$('#date-range-record').on('apply.daterangepicker', function (ev, picker) {
|
||||
$(this).val(picker.startDate.format('YYYY/MM/DD') + ' - ' + picker.endDate.format('YYYY/MM/DD'));
|
||||
$(this).trigger('change');
|
||||
});
|
||||
|
||||
$('#date-range-record').on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
$(this).trigger('change');
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 運維作業記錄 DataTable
|
||||
powerids.push(stationId);
|
||||
operationRecodeTable = $("#operation_recode_table").DataTable({
|
||||
"pageLength": 20,
|
||||
"paging": true,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": false,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"responsive": true,
|
||||
"columns": [{
|
||||
"data": "powerStationName"
|
||||
}, {
|
||||
"data": "formId"
|
||||
}, {
|
||||
"data": "workTypeText"
|
||||
}, {
|
||||
"data": "fixDo"
|
||||
}, {
|
||||
"data": "statusText"
|
||||
}, {
|
||||
"data": "workPersonName"
|
||||
}, {
|
||||
"data": "operationPredict"
|
||||
}, {
|
||||
"data": "recodeFiles"
|
||||
}, {
|
||||
"data": "finishTime"
|
||||
}],
|
||||
"columnDefs": [{
|
||||
'targets': 7,
|
||||
'searchable': false,
|
||||
'orderable': false,
|
||||
'className': 'dt-body-center img-zoom-div',
|
||||
'createdCell': function (td, cellData, rowData, row, col) {
|
||||
$(td).empty();
|
||||
$(td).append('<div class="row"></div>');
|
||||
|
||||
if (cellData != null) {
|
||||
cellData.forEach(function (value, index) {
|
||||
CreateRecodeFileBox($(td).children(".row"), value, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}],
|
||||
"language": {
|
||||
"emptyTable": "無資料...",
|
||||
"processing": "處理中...",
|
||||
"loadingRecords": "載入中...",
|
||||
"lengthMenu": "顯示 _MENU_ 項結果",
|
||||
"zeroRecords": "沒有符合的結果",
|
||||
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
|
||||
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
|
||||
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
|
||||
"infoPostFix": "",
|
||||
"search": "搜尋:",
|
||||
"paginate": {
|
||||
"first": "第一頁",
|
||||
"previous": "上一頁",
|
||||
"next": "下一頁",
|
||||
"last": "最後一頁"
|
||||
},
|
||||
"aria": {
|
||||
"sortAscending": ": 升冪排列",
|
||||
"sortDescending": ": 降冪排列"
|
||||
}
|
||||
},
|
||||
'createdRow': function (row, data, dataIndex) {
|
||||
$(row).attr('data-id', data.id);
|
||||
$(row).attr('data-work-type', data.workType);
|
||||
},
|
||||
"ajax": {
|
||||
"url": "/Operation/OperationRecodeList",
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
d.PowerStationIds = powerids;
|
||||
d.WorkType = Type;
|
||||
d.Range = $('#date-range').val();
|
||||
},
|
||||
"dataSrc": function (rel) {
|
||||
if (rel.data.code == "9999") {
|
||||
toast_error(rel.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
data = rel.data.data;
|
||||
|
||||
if (data == null || data.length == 0) {
|
||||
this.data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 切換電站時,載入該電站運維人員
|
||||
$("#power_station_select_modal").change(function () {
|
||||
|
||||
//查詢該電站的運維人員
|
||||
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
|
||||
|
||||
send_data = {
|
||||
PowerStationId: stationId
|
||||
}
|
||||
|
||||
$.post(url_power_station_operation_personnel, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
$("#work_person_select_modal").empty();
|
||||
if (rel.data.length > 0) {
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#work_person_select_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
if (recode != null || recode != undefined) {
|
||||
$("#work_person_select_modal").val(recode.workPersonId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
});
|
||||
|
||||
//#region 改變日期
|
||||
$('#date-range-record').on('change', function () {
|
||||
operationRecodeTable.ajax.reload();
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 改變項目
|
||||
function ChangeType(type) {
|
||||
Type = type;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var name = "button" + i;
|
||||
document.getElementById(name).setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||
}
|
||||
document.getElementById("button" + type).setAttribute("class", "btn btn-success waves-effect waves-themed");
|
||||
operationRecodeTable.ajax.reload();
|
||||
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 產生檔案html
|
||||
function CreateRecodeFileBox(dom, value, show_del_btn) {
|
||||
var str = "";
|
||||
str += '<div class="col-auto px-0 py-2 mx-2">';
|
||||
var split = value.fileName.split(".");
|
||||
var excel_format = ["xls", "xlsx"];
|
||||
var word_format = ["doc", "docx"];
|
||||
if (split[split.length - 1].toLowerCase() == "pdf") {
|
||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-pdf" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||
} else if (excel_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-excel" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||
} else if (word_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-word" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||
} else {
|
||||
str += '<img src="' + value.fileName + '" class="img-zoom" width="100%" />';
|
||||
}
|
||||
|
||||
if (show_del_btn) {
|
||||
str += '<a href="javascript:;" class="del-operation-recode-file-btn" data-id="' + value.id + '">';
|
||||
str += '<span class="badge border border-light rounded-pill bg-danger-500 position-absolute pos-top pos-right"><i class="fal fa-times"></i></span>';
|
||||
str += '</a>';
|
||||
}
|
||||
|
||||
str += '</div>';
|
||||
dom.append(str);
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 編輯表單內容
|
||||
$('#operation_recode_table').on("click", "a.edit-btn", function () {
|
||||
|
||||
work_type = $(this).parents('tr').attr('data-work-type');
|
||||
|
||||
if (work_type == 0) {
|
||||
$("#recode-form-modal .modal-title .main-title").html("清洗單 - ");
|
||||
} else if (work_type == 1) {
|
||||
$("#recode-form-modal .modal-title .main-title").html("巡檢單 - ");
|
||||
} else {
|
||||
$("#recode-form-modal .modal-title .main-title").html("維修單 - ");
|
||||
}
|
||||
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
|
||||
//取得單一記錄表單
|
||||
var url = "/Operation/GetOneOperationRecode/";
|
||||
|
||||
var send_data = {
|
||||
id: selected_id
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
recode = rel.data;
|
||||
|
||||
countOperationRecodeFile = recode.recodeFiles.length;
|
||||
|
||||
$("#recode-form-modal .modal-title .sub-title").html(recode.powerStationName);
|
||||
|
||||
$("#power_station_select_modal").val(recode.powerStationId);
|
||||
$("#power_station_select_modal").attr("disabled", true);
|
||||
|
||||
$("#work_time_modal").val(recode.workTime);
|
||||
var status = -1;
|
||||
if (recode.status == 0 || recode.status == 2) {
|
||||
status = 0;
|
||||
} else if (recode.status == 1 || recode.status == 3) {
|
||||
status = 1;
|
||||
}
|
||||
$("input[name=status_modal][value='" + status + "']").prop('checked', true); //狀態
|
||||
$('#work_person_select_modal').val(recode.workPersonId);
|
||||
if (work_type != 2) {
|
||||
$(".fix-div").hide();
|
||||
} else {
|
||||
$(".fix-div").show();
|
||||
$("#error_code_modal").val(recode.errorCode);
|
||||
$("#fix_do_modal").val(recode.fixDo);
|
||||
}
|
||||
$("#notice_textarea_modal").val(recode.notice);
|
||||
$("#description_textarea_modal").val(recode.description);
|
||||
|
||||
var str = "";
|
||||
|
||||
RecodeFileBox = $("#recode_files_div > .row");
|
||||
RecodeFileBox.empty();
|
||||
recode.recodeFiles.forEach(function (value, index) {
|
||||
CreateRecodeFileBox(RecodeFileBox, value, true);
|
||||
});
|
||||
|
||||
$("#recode-form-modal").modal();
|
||||
}, 'json');
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 表單檔案資料
|
||||
Dropzone.autoDiscover = false;
|
||||
recodeFileDropzone = new Dropzone("#recode-file-form", {
|
||||
url: "/Operation/SaveOperationRecodeFile",
|
||||
acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx",
|
||||
autoProcessQueue: false,
|
||||
parallelUploads: 5,
|
||||
maxFiles: 5,
|
||||
addRemoveLinks: true,
|
||||
uploadMultiple: true,
|
||||
dictRemoveFile: "移除",
|
||||
init: function (e) {
|
||||
|
||||
var myDropzone = this;
|
||||
|
||||
myDropzone.on("sending", function (file, xhr, data) {
|
||||
if ((countOperationRecodeFile + myDropzone.files.length) > 5) {
|
||||
toast_warning("檔案總數量不可超過 5 張");
|
||||
myDropzone.removeFile(file);
|
||||
return;
|
||||
} else {
|
||||
|
||||
data.append("Id", selected_id);
|
||||
data.append("RecodeFiles", file);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 查詢近30天
|
||||
function ChangeDate30() {
|
||||
var today = new Date();
|
||||
var dateLimit = new Date(new Date().setDate(today.getDate() - 30));
|
||||
|
||||
var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/");
|
||||
var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/");
|
||||
|
||||
datepicker.data('daterangepicker').setStartDate(dateLimit_format);
|
||||
datepicker.data('daterangepicker').setEndDate(today_format);
|
||||
|
||||
$('#date-range-record').val(dateLimit_format + ' - ' + today_format);
|
||||
$('#date-range-record').trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 儲存表單資料
|
||||
function SaveRecode() {
|
||||
|
||||
if ($("#recode-form").valid()) {
|
||||
var url = "/Operation/SaveOperationRecode";
|
||||
|
||||
var formData = new FormData();
|
||||
|
||||
formData.append("Id", selected_id);
|
||||
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
||||
formData.append("WorkType", selected_work_type);
|
||||
formData.append("ErrorCode", $("#error_code_modal").val());
|
||||
formData.append("FixDo", $("#fix_do_modal").val());
|
||||
formData.append("Status", $("input[name=status_modal]:checked").val());
|
||||
formData.append("WorkPersonId", $("#work_person_select_modal").val());
|
||||
formData.append("WorkTime", $("#work_time_modal").val());
|
||||
formData.append("Notice", $("#notice_textarea_modal").val());
|
||||
formData.append("Description", $("#description_textarea_modal").val());
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: formData,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
var myDropzone = Dropzone.forElement("#recode-file-form");
|
||||
|
||||
if (myDropzone.files.length > 0) {
|
||||
|
||||
myDropzone.processQueue();
|
||||
|
||||
myDropzone.on("successmultiple", function (file, rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
toast_ok(rel.msg);
|
||||
$('#recode-form-modal').modal('hide');
|
||||
recodeFileDropzone.removeAllFiles();
|
||||
|
||||
operationRecodeTable.ajax.reload();
|
||||
});
|
||||
} else {
|
||||
$('#recode-form-modal').modal('hide');
|
||||
myDropzone.removeAllFiles();
|
||||
|
||||
operationRecodeTable.ajax.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 點擊圖片放大
|
||||
$('#operation_recode_table').on("click", "img.img-zoom", function () {
|
||||
var _this = $(this);//將當前的pimg元素作為_this傳入函式
|
||||
imgShow("#img-zoom-outer-div", "#innerdiv", "#bigimg", _this);
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 匯出excel
|
||||
function ExportExcel() {
|
||||
var url = "/Operation/ExportOperationRecodeExcel";
|
||||
var send_data = {
|
||||
CityIds: [3],
|
||||
PowerStationIds: powerids
|
||||
};
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
$('#NoViewbody').empty();
|
||||
|
||||
var str = "";
|
||||
rel.data.forEach(function (value, index) {
|
||||
str += "<tr>" +
|
||||
"<td>" + value.powerStationName + "</td>" +
|
||||
"<td>" + value.formId + "</td>" +
|
||||
"<td>" + value.workTypeText + "</td>" +
|
||||
"<td>" + value.fixDo + "</td>" +
|
||||
"<td>" + value.statusText + "</td>" +
|
||||
"<td>" + value.workPersonName + "</td>" +
|
||||
"<td>" + value.operationPredict + "</td>";
|
||||
|
||||
str += "<td>";
|
||||
if (value.hyperLinks != undefined || value.hyperLinks != null) {
|
||||
value.hyperLinks.forEach(function (value2, index) {
|
||||
str += value2 + "<br>";
|
||||
});
|
||||
}
|
||||
str += "</td>";
|
||||
|
||||
str += "<td>";
|
||||
if (value.finishTime != undefined || value.finishTime != null || value.finishTime != "") {
|
||||
//value.hyperLinks.forEach(function (value3, index) {
|
||||
// str += value3;
|
||||
//});
|
||||
str += value.finishTime;
|
||||
}
|
||||
str += "</td>";
|
||||
|
||||
str += "</tr>";
|
||||
});
|
||||
|
||||
$('#NoViewbody').append(str);
|
||||
|
||||
$("#NoView").table2excel({
|
||||
// 匯出的Excel文件的名稱
|
||||
name: "abc",
|
||||
// Excel檔案的名稱
|
||||
filename: "test",
|
||||
//檔案字尾名
|
||||
fileext: ".xls",
|
||||
});
|
||||
}, 'json');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 載入上傳資料 - 單線圖
|
||||
var url_image = "/PowerStation/GetAllPowerStationSingleLine";
|
||||
var send_data = {
|
||||
powerStationId: stationId
|
||||
@ -650,5 +1100,6 @@
|
||||
dom.find(".carousel-inner").append(carousel_item);
|
||||
}
|
||||
//#endregion
|
||||
})
|
||||
</script>
|
||||
}
|
||||
@ -1 +1,185 @@
|
||||
<p>5</p>
|
||||
<div class="row mb-5 d-flex justify-content-start">
|
||||
<div class="pr-3">
|
||||
<div class="btn-group btn-group-md">
|
||||
<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">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeDate30()">近30天</button>
|
||||
</div>
|
||||
<div class="pr-6">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="date-range-record" type="text" name="date" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-success waves-effect waves-themed mb-3" onclick="ExportExcel()">
|
||||
<span class="fal fa-file-excel mr-1"></span>
|
||||
匯出
|
||||
</button>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="w-100">
|
||||
<table class="table table-bordered table-hover m-0 text-center" id="operation_recode_table">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>電廠</th>
|
||||
<th>表單號</th>
|
||||
<th>項目</th>
|
||||
<th>類型</th>
|
||||
<th>狀態</th>
|
||||
<th>處理人員</th>
|
||||
<th>本次作業預計</th>
|
||||
<th>照片</th>
|
||||
<th>完成時間</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="NoView" style="display:none">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>電廠</th>
|
||||
<th>表單號</th>
|
||||
<th>項目</th>
|
||||
<th>維修項目</th>
|
||||
<th>狀態</th>
|
||||
<th>執行人員</th>
|
||||
<th>本次作業預計</th>
|
||||
<th>照片</th>
|
||||
<th>完成時間</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="NoViewbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="recode-form-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
<span class="main-title"></span><span class="sub-title"></span>
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="recode-form">
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="power_station_select_modal">電站</label>
|
||||
@*<input class="form-control" id="power_station_select_modal" type="text" name="power_station_select_modal" />*@
|
||||
<select class="form-control" id="power_station_select_modal">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="work_time_modal">作業日期</label>
|
||||
<input class="form-control" id="work_time_modal" type="date" name="work_time_modal" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="example-select">狀態</label>
|
||||
<div>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal" value="0" />
|
||||
<label class="custom-control-label" for="status_none_complete">未完成</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input type="radio" class="custom-control-input ml-auto" id="status_complete" name="status_modal" value="1" />
|
||||
<label class="custom-control-label" for="status_complete">完成</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="work_person_select_modal">執行人員</label>
|
||||
<select class="form-control" id="work_person_select_modal">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3 fix-div">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="error_code_modal">異常編號</label>
|
||||
<input class="form-control" id="error_code_modal" type="text" name="error_code_modal" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="fix_do_modal">維修項目</label>
|
||||
<input class="form-control" id="fix_do_modal" type="text" name="fix_do_modal" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="notice_textarea_modal">巡檢注意事項</label>
|
||||
<textarea class="form-control" id="notice_textarea_modal" rows="5"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="description_textarea_modal">結果描述</label>
|
||||
<textarea class="form-control" id="description_textarea_modal" rows="5"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-2">
|
||||
<p>檔案上傳</p>
|
||||
</div>
|
||||
<div id="recode_files_div" class="col-10">
|
||||
<div class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row px-3">
|
||||
<form id="recode-file-form" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;">
|
||||
@*<div class="fallback">
|
||||
<input type="file" multiple />
|
||||
</div>*@
|
||||
<div class="dz-message needsclick">
|
||||
<i class="fal fa-cloud-upload text-muted mb-3"></i> <br>
|
||||
<span class="text-uppercase">將圖片拖曳至這裡或點擊選擇圖片.</span>
|
||||
<br>
|
||||
<span class="fs-sm text-muted">僅供預覽,並未實際上傳。</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" id="save-recode-btn" onclick="SaveRecode()">確定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Loading…
Reference in New Issue
Block a user