異常紀錄
This commit is contained in:
parent
4c51608c99
commit
b605ebe3af
@ -14,11 +14,14 @@ namespace SolarPower.Controllers
|
||||
public class StationOverviewController : MyBaseController<StationOverviewController>
|
||||
{
|
||||
private readonly IOverviewRepository overviewRepository;
|
||||
private readonly IPowerStationRepository powerStationRepository;
|
||||
private string stationImageFilePath = "/upload/power_station/";
|
||||
public StationOverviewController(
|
||||
IOverviewRepository overviewRepository) : base()
|
||||
IOverviewRepository overviewRepository,
|
||||
IPowerStationRepository powerStationRepository) : base()
|
||||
{
|
||||
this.overviewRepository = overviewRepository;
|
||||
this.powerStationRepository = powerStationRepository;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -224,5 +227,47 @@ namespace SolarPower.Controllers
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public async Task<ActionResult> GetExceptionTable(ExceptionSent post)
|
||||
{
|
||||
List<ExceptionDataTable> exceptionDataTable = new List<ExceptionDataTable>();
|
||||
ApiResult<List<ExceptionDataTable>> apiResult = new ApiResult<List<ExceptionDataTable>>();
|
||||
|
||||
PowerStation powerStation = null;
|
||||
|
||||
try
|
||||
{
|
||||
powerStation = await powerStationRepository.GetOneAsync(post.Id);
|
||||
exceptionDataTable = await overviewRepository.GetExceptionTable(post);
|
||||
|
||||
foreach (ExceptionDataTable a in exceptionDataTable)
|
||||
{
|
||||
if (string.IsNullOrEmpty(a.FormId))
|
||||
{
|
||||
a.Function = @$"<a href='javascript:;' class='btn btn-success waves-effect waves-themed mb-3 mr-2 add-btn'>填寫表單</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
a.Function = @$"<a href='javascript:;' class='waves-effect waves-themed mb-3 mr-2 edit-btn'>{a.FormId}</a>";
|
||||
}
|
||||
}
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = exceptionDataTable;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】");
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
var result = Json(new
|
||||
{
|
||||
data = apiResult
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,4 +77,30 @@ namespace SolarPower.Models
|
||||
public List<double> PowerDatas { get; set; }
|
||||
public List<double> IrradianceDatas { get; set; }
|
||||
}
|
||||
|
||||
public class ExceptionSent
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Status { get; set; }
|
||||
public string Range { get; set; }
|
||||
public string StartTime { get; set; } //起始日期
|
||||
public string EndTime { get; set; } //結束日期
|
||||
}
|
||||
public class ExceptionInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Site_id { get; set; }
|
||||
public string Dev_time { get; set; }
|
||||
public string AlarmClassName { get; set; }
|
||||
public string ErrDevice { get; set; }
|
||||
public string ErrMsg { get; set; }
|
||||
public int Err_status { get; set; }
|
||||
}
|
||||
public class ExceptionDataTable:ExceptionInfo
|
||||
{
|
||||
public string Function { get; set; }
|
||||
public string PowerStationName { get; set; }
|
||||
public int ErrorID { get; set; }
|
||||
public string FormId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,5 +287,56 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<ExceptionDataTable>> GetExceptionTable(ExceptionSent post)
|
||||
{
|
||||
|
||||
|
||||
List<ExceptionDataTable> result;
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
||||
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,
|
||||
errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate,
|
||||
case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg
|
||||
from err_main a
|
||||
join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
||||
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
||||
left join ref_err_inv d on lower(b.alarmClass) = d.deviceType
|
||||
and case when lower(b.alarmClass) = 'inverter' and err_valuekind = 'e' then errvalue else '' end = d.errCode
|
||||
left join power_station ps on ps.Code = site_id
|
||||
left join operation_record pr on pr.ErrorCode = a.id
|
||||
WHERE a.sourceState = @Status AND ps.Id = @PowerStationId";
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(post.Range))
|
||||
{
|
||||
post.StartTime = post.Range.Split('-')[0];
|
||||
post.EndTime = post.Range.Split('-')[1];
|
||||
start = Convert.ToDateTime(post.StartTime);
|
||||
end = Convert.ToDateTime(post.EndTime);
|
||||
var startime = (Int64)(start.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||
var endtime = (Int64)(end.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||
sql += @$" AND `timestamp` BETWEEN {startime*1000} AND {endtime*1000}";
|
||||
}
|
||||
|
||||
result = (await conn.QueryAsync<ExceptionDataTable>(sql,
|
||||
new
|
||||
{
|
||||
PowerStationId = post.Id,
|
||||
Status = post.Status,
|
||||
})).ToList();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,5 +20,6 @@ namespace SolarPower.Repository.Interface
|
||||
Task<List<PowerIrradiance>> GetListPowerIrradiance7dayByPowerStationId(int powerStationId, string nowDay);
|
||||
Task<List<PowerIrradiance>> GetListPowerIrradianceMonthByPowerStationId(int powerStationId, string nowDay);
|
||||
Task<List<PowerIrradiance>> GetListPowerIrradianceYearByPowerStationId(int powerStationId, string nowDay);
|
||||
Task<List<ExceptionDataTable>> GetExceptionTable(ExceptionSent post);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,10 +100,12 @@
|
||||
var powerids = new Array(0);//當前選擇電站
|
||||
var Type = 0; // 項目
|
||||
var stationId;
|
||||
var errortoID;
|
||||
var powerStationData;
|
||||
var stationOverview;
|
||||
var recode;
|
||||
var selected_work_type = -1;
|
||||
var err_status = 0;//異常紀錄,0:為解決 1:已解決
|
||||
|
||||
$(function () {
|
||||
var url = new URL(location.href);
|
||||
@ -473,7 +475,7 @@
|
||||
//#endregion
|
||||
//#endregion
|
||||
|
||||
//#region Date Picker
|
||||
//#region Date Picker record
|
||||
datepicker = $('#date-range-record').daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
locale: { format: 'YYYY/MM/DD' },
|
||||
@ -493,6 +495,26 @@
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region Date Picker exception
|
||||
datepicker = $('#date-range-exception').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-exception').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-exception').on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
$(this).trigger('change');
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 運維作業記錄 DataTable
|
||||
powerids.push(stationId);
|
||||
operationRecodeTable = $("#operation_recode_table").DataTable({
|
||||
@ -608,19 +630,156 @@
|
||||
}
|
||||
|
||||
$("#work_person_select_modal").empty();
|
||||
$("#work_person_select_modal_exc").empty();
|
||||
|
||||
if (rel.data.length > 0) {
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#work_person_select_modal").append($("<option />").val(val.value).text(val.text));
|
||||
$("#work_person_select_modal_exc").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
if (recode != null || recode != undefined) {
|
||||
$("#work_person_select_modal").val(recode.workPersonId);
|
||||
$("#work_person_select_modal_exc").val(recode.workPersonId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//#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();
|
||||
$("#work_person_select_modal_exc").empty();
|
||||
|
||||
if (rel.data.length > 0) {
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#work_person_select_modal").append($("<option />").val(val.value).text(val.text));
|
||||
$("#work_person_select_modal_exc").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
if (recode != null || recode != undefined) {
|
||||
$("#work_person_select_modal").val(recode.workPersonId);
|
||||
$("#work_person_select_modal_exc").val(recode.workPersonId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
|
||||
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_exc").empty();
|
||||
|
||||
if (rel.data.length > 0) {
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#work_person_select_modal_exc").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
if (recode != null || recode != undefined) {
|
||||
$("#work_person_select_modal_exc").val(recode.workPersonId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//#region 異常table
|
||||
ExceptionTable = $("#Exception_Table").DataTable({
|
||||
"pageLength": 20,
|
||||
"paging": true,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"responsive": true,
|
||||
"order": [[6, "desc"]],
|
||||
"columns": [{
|
||||
"data": "powerStationName"
|
||||
}, {
|
||||
"data": "id"
|
||||
}, {
|
||||
"data": "dev_time"
|
||||
}, {
|
||||
"data": "alarmClassName"
|
||||
}, {
|
||||
"data": "errDevice"
|
||||
}, {
|
||||
"data": "errMsg"
|
||||
}, {
|
||||
"data": "function"
|
||||
}],
|
||||
"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-error', data.errorID);
|
||||
},
|
||||
"ajax": {
|
||||
"url": "/StationOverview/GetExceptionTable",
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
d.id = stationId,
|
||||
d.status = err_status,
|
||||
d.range = $('#date-range-exception').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 改變日期
|
||||
@ -629,9 +788,15 @@
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 改變日期
|
||||
$('#date-range-exception').on('change', function () {
|
||||
ExceptionTable.ajax.reload();
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 改變項目
|
||||
function ChangeType(type) {
|
||||
Type = type;
|
||||
err_status = type;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var name = "button" + i;
|
||||
document.getElementById(name).setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||
@ -642,6 +807,24 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 改變異常紀錄狀態
|
||||
function ChangeStatus(type) {
|
||||
err_status = type;
|
||||
var name;
|
||||
var name2;
|
||||
if (type == 0) {
|
||||
name = "errbutton" + "0";
|
||||
name2 = "errbutton" + "1";
|
||||
} else {
|
||||
name = "errbutton" + "1";
|
||||
name2 = "errbutton" + "0";
|
||||
}
|
||||
document.getElementById(name).setAttribute("class", "btn btn-success waves-effect waves-themed");
|
||||
document.getElementById(name2).setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||
ExceptionTable.ajax.reload();
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 產生檔案html
|
||||
function CreateRecodeFileBox(dom, value, show_del_btn) {
|
||||
var str = "";
|
||||
@ -670,7 +853,228 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 編輯表單內容
|
||||
//#region 匯出excel(異常)
|
||||
function ExportExcelToExc() {
|
||||
var url = "/StationOverview/GetExceptionTable";
|
||||
var send_data = {
|
||||
id: stationId,
|
||||
status: err_status,
|
||||
range: $('#date-range-exception').val()
|
||||
};
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.data.code != "0000") {
|
||||
toast_error(rel.data.msg);
|
||||
return;
|
||||
}
|
||||
$('#NOSEEBODY').empty();
|
||||
var str = "";
|
||||
rel.data.data.forEach(function (value, index) {
|
||||
str += "<tr>" +
|
||||
"<td>" + value.powerStationName + "</td>" +
|
||||
"<td>" + value.id + "</td>" +
|
||||
"<td>" + value.dev_time + "</td>" +
|
||||
"<td>" + value.alarmClassName + "</td>" +
|
||||
"<td>" + value.errDevice + "</td>" +
|
||||
"<td>" + value.errMsg + "</td>";
|
||||
});
|
||||
|
||||
$('#NOSEEBODY').append(str);
|
||||
|
||||
$("#NOSEE").table2excel({
|
||||
// 匯出的Excel文件的名稱
|
||||
name: "檔案",
|
||||
// Excel檔案的名稱
|
||||
filename: "test",
|
||||
//檔案字尾名
|
||||
fileext: ".xls",
|
||||
});
|
||||
}, 'json');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 編輯異常表單內容(異常)
|
||||
$('#Exception_Table').on("click", "a.edit-btn", function () {
|
||||
$("#exception-form-modal .modal-title .main-title").html("維修單 - ");
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
errortoID = $(this).parents('tr').attr('data-error');
|
||||
//取得單一記錄表單
|
||||
var url = "/Operation/GetOneOperationRecode/";
|
||||
|
||||
var send_data = {
|
||||
id: errortoID
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
recode = rel.data;
|
||||
|
||||
countOperationRecodeFile = recode.recodeFiles.length;
|
||||
|
||||
$("#exception-form-modal .modal-title .sub-title").html(powerStationData.name);
|
||||
$("#power_station_select_modal_exc").val(powerStationData.name);
|
||||
$("#power_station_select_modal_exc").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_exc').val(recode.workPersonId);
|
||||
$(".fix-div").show();
|
||||
$("#error_code_modal_exc").val(recode.errorCode);
|
||||
$("#error_code_modal_exc").attr("disabled", true);
|
||||
$("#fix_do_modal_exc").val(recode.fixDo);
|
||||
$("#notice_textarea_modal_exc").val(recode.notice);
|
||||
$("#description_textarea_modal_exc").val(recode.description);
|
||||
|
||||
var str = "";
|
||||
|
||||
RecodeFileBox = $("#recode_files_div_exc > .row");
|
||||
RecodeFileBox.empty();
|
||||
recode.recodeFiles.forEach(function (value, index) {
|
||||
CreateRecodeFileBox(RecodeFileBox, value, true);
|
||||
});
|
||||
|
||||
$("#exception-form-modal").modal();
|
||||
}, 'json');
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 派工新增表單(異常)
|
||||
$('#Exception_Table').on("click", "a.add-btn", function () {
|
||||
$("#exception-form-modal .modal-title .main-title").html("維修單 - ");
|
||||
$("#exception-form-modal .modal-title .sub-title").html(powerStationData.name);
|
||||
$("#recode-form-exc").trigger("reset");
|
||||
$("#power_station_select_modal_exc").val(powerStationData.name);
|
||||
$("#power_station_select_modal_exc").attr("disabled", true);
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
errortoID = $(this).parents('tr').attr('data-error');
|
||||
$("#error_code_modal_exc").val(selected_id);
|
||||
$("#error_code_modal_exc").attr("disabled", true);
|
||||
$("#exception-form-modal").modal();
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 查詢近30天(異常)
|
||||
function ChangeDate30exception() {
|
||||
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-exception').val(dateLimit_format + ' - ' + today_format);
|
||||
$('#date-range-exception').trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 儲存表單資料(異常)
|
||||
function SaveException() {
|
||||
|
||||
if ($("#recode-form-exc").valid()) {
|
||||
var url = "/Operation/SaveOperationRecode";
|
||||
|
||||
var formData = new FormData();
|
||||
|
||||
formData.append("Id", errortoID);
|
||||
formData.append("PowerStationId", stationId);
|
||||
formData.append("WorkType", 2);
|
||||
formData.append("ErrorCode", $("#error_code_modal_exc").val());
|
||||
formData.append("FixDo", $("#fix_do_modal_exc").val());
|
||||
formData.append("Status", $("input[name=status_modal]:checked").val());
|
||||
formData.append("WorkPersonId", $("#work_person_select_modal_exc").val());
|
||||
formData.append("WorkTime", $("#work_time_modal_exc").val());
|
||||
formData.append("Notice", $("#notice_textarea_modal_exc").val());
|
||||
formData.append("Description", $("#description_textarea_modal_exc").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_exc");
|
||||
|
||||
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);
|
||||
$('#exception-form-modal').modal('hide');
|
||||
recodeFileDropzone.removeAllFiles();
|
||||
|
||||
ExceptionTable.ajax.reload();
|
||||
});
|
||||
} else {
|
||||
$('#exception-form-modal').modal('hide');
|
||||
myDropzone.removeAllFiles();
|
||||
|
||||
ExceptionTable.ajax.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 表單檔案資料(異常)
|
||||
Dropzone.autoDiscover = false;
|
||||
recodeFileDropzone = new Dropzone("#recode-file-form_exc", {
|
||||
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 運維
|
||||
|
||||
//#region 編輯表單內容(運維)
|
||||
$('#operation_recode_table').on("click", "a.edit-btn", function () {
|
||||
|
||||
work_type = $(this).parents('tr').attr('data-work-type');
|
||||
@ -739,7 +1143,7 @@
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 表單檔案資料
|
||||
//#region 表單檔案資料(運維)
|
||||
Dropzone.autoDiscover = false;
|
||||
recodeFileDropzone = new Dropzone("#recode-file-form", {
|
||||
url: "/Operation/SaveOperationRecodeFile",
|
||||
@ -771,7 +1175,7 @@
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 查詢近30天
|
||||
//#region 查詢近30天(運維)
|
||||
function ChangeDate30() {
|
||||
var today = new Date();
|
||||
var dateLimit = new Date(new Date().setDate(today.getDate() - 30));
|
||||
@ -787,7 +1191,7 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 儲存表單資料
|
||||
//#region 儲存表單資料(運維)
|
||||
function SaveRecode() {
|
||||
|
||||
if ($("#recode-form").valid()) {
|
||||
@ -849,14 +1253,14 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 點擊圖片放大
|
||||
//#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
|
||||
//#region 匯出excel(運維)
|
||||
function ExportExcel() {
|
||||
var url = "/Operation/ExportOperationRecodeExcel";
|
||||
var send_data = {
|
||||
@ -915,6 +1319,10 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
//#region 設定電站基本資料
|
||||
function SetStationInfo() {
|
||||
|
||||
@ -1098,5 +1506,10 @@
|
||||
dom.find(".carousel-inner").append(carousel_item);
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
}
|
||||
@ -1 +1,177 @@
|
||||
<p>1</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="ChangeStatus(0)" id="errbutton0">未解決</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeStatus(1)" id="errbutton1">己解決</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeDate30exception()">近30天</button>
|
||||
</div>
|
||||
<div class="pr-6">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="date-range-exception" 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="ExportExcelToExc()">
|
||||
<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="Exception_Table">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>電站名稱</th>
|
||||
<th>異常ID</th>
|
||||
<th>發生時間</th>
|
||||
<th>異常類別</th>
|
||||
<th>設備編號</th>
|
||||
<th>異常原因</th>
|
||||
<th>派工/維運單號</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-bordered table-hover m-0 text-center" id="NOSEE" style="display:none">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>電站名稱</th>
|
||||
<th>異常ID</th>
|
||||
<th>發生時間</th>
|
||||
<th>異常類別</th>
|
||||
<th>設備編號</th>
|
||||
<th>異常原因</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="NOSEEBODY">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="exception-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-exc">
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="power_station_select_modal_exc">電站</label>
|
||||
<input class="form-control" id="power_station_select_modal_exc" type="text" name="power_station_select_modal_exc" />
|
||||
@*<select class="form-control" id="power_station_select_modal_exc">
|
||||
</select>*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="work_time_modal_exc">作業日期</label>
|
||||
<input class="form-control" id="work_time_modal_exc" type="date" name="work_time_modal_exc" />
|
||||
</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_exc" name="status_modal" value="0" />
|
||||
<label class="custom-control-label" for="status_none_complete_exc">未完成</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input type="radio" class="custom-control-input ml-auto" id="status_complete_exc" name="status_modal" value="1" />
|
||||
<label class="custom-control-label" for="status_complete_exc">完成</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="work_person_select_modal_exc">執行人員</label>
|
||||
<select class="form-control" id="work_person_select_modal_exc">
|
||||
</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_exc">異常編號</label>
|
||||
<input class="form-control" id="error_code_modal_exc" type="text" name="error_code_modal_exc" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="fix_do_modal_exc">維修項目</label>
|
||||
<input class="form-control" id="fix_do_modal_exc" type="text" name="fix_do_modal_exc" />
|
||||
</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_exc">巡檢注意事項</label>
|
||||
<textarea class="form-control" id="notice_textarea_modal_exc" 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_exc">結果描述</label>
|
||||
<textarea class="form-control" id="description_textarea_modal_exc" 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_exc" 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_exc" 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="SaveException()">確定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Loading…
Reference in New Issue
Block a user