1. bug fix

This commit is contained in:
Kai 2021-08-27 09:54:00 +08:00
parent 7b1bb0d3e0
commit ee0c004ea9
7 changed files with 129 additions and 127 deletions

View File

@ -15,7 +15,7 @@ namespace SolarPower.Controllers
public class OperationController : MyBaseController<OperationController> public class OperationController : MyBaseController<OperationController>
{ {
private readonly IOperationRepository operationRepository; private readonly IOperationRepository operationRepository;
private string operationRecordFilePath = "/upload/operation_recode/"; private string operationRecordFilePath = "/upload/operation_record/";
private string operationRecordSaveAsPath = ""; private string operationRecordSaveAsPath = "";
@ -24,7 +24,7 @@ namespace SolarPower.Controllers
{ {
this.operationRepository = operationRepository; this.operationRepository = operationRepository;
operationRecordSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "operation_recode"); operationRecordSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "operation_record");
} }
public IActionResult Index() public IActionResult Index()
@ -477,9 +477,9 @@ namespace SolarPower.Controllers
return apiResult; return apiResult;
} }
foreach (var recodeFile in operationRecord.RecordFiles) foreach (var recordFile in operationRecord.RecordFiles)
{ {
recodeFile.FileName = Path.Combine(operationRecordFilePath, operationRecord.Id.ToString()) + "/" + recodeFile.FileName; recordFile.FileName = Path.Combine(operationRecordFilePath, operationRecord.Id.ToString()) + "/" + recordFile.FileName;
} }
apiResult.Code = "0000"; apiResult.Code = "0000";

View File

@ -2164,6 +2164,8 @@ ALTER TABLE `operation_record`
ADD COLUMN `FixFirm` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '負責廠商' AFTER `FixDo`; ADD COLUMN `FixFirm` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '負責廠商' AFTER `FixDo`;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@ -101,7 +101,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="recode-form-exc"> <form id="record-form-exc">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
@ -183,14 +183,14 @@
<div class="col-2"> <div class="col-2">
<p>檔案上傳</p> <p>檔案上傳</p>
</div> </div>
<div id="recode_files_div_exc" class="col-10"> <div id="record_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 class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div">
</div> </div>
</div> </div>
</div> </div>
<div class="row px-3"> <div class="row px-3">
<form id="recode-file-form_exc" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;"> <form id="record-file-form_exc" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;">
<div class="fallback"> <div class="fallback">
<input type="file" multiple /> <input type="file" multiple />
</div> </div>
@ -205,7 +205,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <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> <button type="button" class="btn btn-primary" id="save-record-btn" onclick="SaveException()">確定</button>
</div> </div>
</div> </div>
</div> </div>
@ -226,9 +226,9 @@
var errortoID; var errortoID;
var selected_id; var selected_id;
var powerStationData_name; var powerStationData_name;
var recode; var record;
var psids; var psids;
var countOperationRecodeFile = 0; var countOperationRecordFile = 0;
//#region Array.Remove //#region Array.Remove
Array.prototype.remove = function (val) { Array.prototype.remove = function (val) {
@ -305,7 +305,7 @@
Allpowerids.push(String(val.id)); Allpowerids.push(String(val.id));
}); });
datatable(); datatable();
//operationRecodeTable.ajax.reload(); //operationRecordTable.ajax.reload();
}) })
}) })
//#endregion //#endregion
@ -555,7 +555,7 @@
powerStationData_name = $(this).parents('tr').attr('data-name'); powerStationData_name = $(this).parents('tr').attr('data-name');
$("#exception-form-modal .modal-title .main-title").html("維修單 - "); $("#exception-form-modal .modal-title .main-title").html("維修單 - ");
$("#exception-form-modal .modal-title .sub-title").html(powerStationData_name); $("#exception-form-modal .modal-title .sub-title").html(powerStationData_name);
$("#recode-form-exc").trigger("reset"); $("#record-form-exc").trigger("reset");
$("#power_station_select_modal_exc").val(powerStationData_name); $("#power_station_select_modal_exc").val(powerStationData_name);
$("#power_station_select_modal_exc").attr("disabled", true); $("#power_station_select_modal_exc").attr("disabled", true);
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
@ -582,8 +582,8 @@
$("#work_person_select_modal_exc").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) { if (record != null || record != undefined) {
$("#work_person_select_modal_exc").val(recode.workPersonId); $("#work_person_select_modal_exc").val(record.workPersonId);
} }
} }
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
@ -602,7 +602,7 @@
powerStationData_name = $(this).parents('tr').attr('data-name'); powerStationData_name = $(this).parents('tr').attr('data-name');
errortoID = $(this).parents('tr').attr('data-error'); errortoID = $(this).parents('tr').attr('data-error');
//取得單一記錄表單 //取得單一記錄表單
var url = "/Operation/GetOneOperationRecode/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
id: errortoID id: errortoID
@ -614,36 +614,36 @@
return; return;
} }
recode = rel.data; record = rel.data;
countOperationRecodeFile = recode.recodeFiles.length; countOperationRecordFile = record.recordFiles.length;
$("#exception-form-modal .modal-title .sub-title").html(powerStationData_name); $("#exception-form-modal .modal-title .sub-title").html(powerStationData_name);
$("#power_station_select_modal_exc").val(powerStationData_name); $("#power_station_select_modal_exc").val(powerStationData_name);
$("#power_station_select_modal_exc").attr("disabled", true); $("#power_station_select_modal_exc").attr("disabled", true);
$("#work_time_modal").val(recode.workTime); $("#work_time_modal").val(record.workTime);
var status = -1; var status = -1;
if (recode.status == 0 || recode.status == 2) { if (record.status == 0 || record.status == 2) {
status = 0; status = 0;
} else if (recode.status == 1 || recode.status == 3) { } else if (record.status == 1 || record.status == 3) {
status = 1; status = 1;
} }
$("input[name=status_modal][value='" + status + "']").prop('checked', true); //狀態 $("input[name=status_modal][value='" + status + "']").prop('checked', true); //狀態
$('#work_person_select_modal_exc').val(recode.workPersonId); $('#work_person_select_modal_exc').val(record.workPersonId);
$(".fix-div").show(); $(".fix-div").show();
$("#error_code_modal_exc").val(recode.errorCode); $("#error_code_modal_exc").val(record.errorCode);
$("#error_code_modal_exc").attr("disabled", true); $("#error_code_modal_exc").attr("disabled", true);
$("#fix_do_modal_exc").val(recode.fixDo); $("#fix_do_modal_exc").val(record.fixDo);
$("#notice_textarea_modal_exc").val(recode.notice); $("#notice_textarea_modal_exc").val(record.notice);
$("#description_textarea_modal_exc").val(recode.description); $("#description_textarea_modal_exc").val(record.description);
var str = ""; var str = "";
RecodeFileBox = $("#recode_files_div_exc > .row"); RecordFileBox = $("#record_files_div_exc > .row");
RecodeFileBox.empty(); RecordFileBox.empty();
recode.recodeFiles.forEach(function (value, index) { record.recordFiles.forEach(function (value, index) {
CreateRecodeFileBox(RecodeFileBox, value, true); CreateRecordFileBox(RecordFileBox, value, true);
}); });
//#region 維修單運維人員(異常紀錄) //#region 維修單運維人員(異常紀錄)
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList"; var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
@ -663,8 +663,8 @@
$("#work_person_select_modal_exc").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) { if (record != null || record != undefined) {
$("#work_person_select_modal_exc").val(recode.workPersonId); $("#work_person_select_modal_exc").val(record.workPersonId);
} }
} }
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
@ -678,8 +678,8 @@
//#region 儲存表單資料(異常) //#region 儲存表單資料(異常)
function SaveException() { function SaveException() {
if ($("#recode-form-exc").valid()) { if ($("#record-form-exc").valid()) {
var url = "/Operation/SaveOperationRecode"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -707,7 +707,7 @@
return; return;
} }
var myDropzone = Dropzone.forElement("#recode-file-form_exc"); var myDropzone = Dropzone.forElement("#record-file-form_exc");
if (myDropzone.files.length > 0) { if (myDropzone.files.length > 0) {
selected_id = rel.data; selected_id = rel.data;
@ -721,7 +721,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#exception-form-modal').modal('hide'); $('#exception-form-modal').modal('hide');
recodeFileDropzone.removeAllFiles(); recordFileDropzone.removeAllFiles();
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
}); });
@ -739,8 +739,8 @@
//#region 表單檔案資料(異常) //#region 表單檔案資料(異常)
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
recodeFileDropzone = new Dropzone("#recode-file-form_exc", { recordFileDropzone = new Dropzone("#record-file-form_exc", {
url: "/Operation/SaveOperationRecodeFile", url: "/Operation/SaveOperationRecordFile",
acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx", acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx",
autoProcessQueue: false, autoProcessQueue: false,
parallelUploads: 5, parallelUploads: 5,
@ -753,14 +753,14 @@
var myDropzone = this; var myDropzone = this;
myDropzone.on("sending", function (file, xhr, data) { myDropzone.on("sending", function (file, xhr, data) {
if ((countOperationRecodeFile + myDropzone.files.length) > 5) { if ((countOperationRecordFile + myDropzone.files.length) > 5) {
toast_warning("檔案總數量不可超過 5 張"); toast_warning("檔案總數量不可超過 5 張");
myDropzone.removeFile(file); myDropzone.removeFile(file);
return; return;
} else { } else {
data.append("Id", selected_id); data.append("Id", selected_id);
data.append("RecodeFiles", file); data.append("RecordFiles", file);
} }
}); });
@ -770,7 +770,7 @@
//#endregion //#endregion
//#region 產生檔案html //#region 產生檔案html
function CreateRecodeFileBox(dom, value, show_del_btn) { function CreateRecordFileBox(dom, value, show_del_btn) {
var str = ""; var str = "";
str += '<div class="col-auto px-0 py-2 mx-2">'; str += '<div class="col-auto px-0 py-2 mx-2">';
var split = value.fileName.split("."); var split = value.fileName.split(".");
@ -787,7 +787,7 @@
} }
if (show_del_btn) { if (show_del_btn) {
str += '<a href="javascript:;" class="del-operation-recode-file-btn" data-id="' + value.id + '">'; str += '<a href="javascript:;" class="del-operation-record-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 += '<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 += '</a>';
} }

View File

@ -160,14 +160,14 @@
var errortoID; var errortoID;
var powerStationData; var powerStationData;
var stationOverview; var stationOverview;
var recode; var record;
var selected_work_type = -1; var selected_work_type = -1;
var err_status = 1;//異常紀錄1:未解決 0:已解決 var err_status = 1;//異常紀錄1:未解決 0:已解決
var groupType = 0; //0:日 1:月 2:年 3:歷年 var groupType = 0; //0:日 1:月 2:年 3:歷年
var historyRange = ""; var historyRange = "";
var selectInverterkwhBarType = 0; var selectInverterkwhBarType = 0;
var HeapMapXAxis = []; var HeapMapXAxis = [];
var countOperationRecodeFile = 0; var countOperationRecordFile = 0;
$(function () { $(function () {
@ -818,7 +818,7 @@
//#region 運維作業記錄 DataTable //#region 運維作業記錄 DataTable
powerids.push(stationId); powerids.push(stationId);
operationRecodeTable = $("#operation_recode_table").DataTable({ operationRecordTable = $("#operation_record_table").DataTable({
"pageLength": 20, "pageLength": 20,
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -843,7 +843,7 @@
}, { }, {
"data": "operationPredict" "data": "operationPredict"
}, { }, {
"data": "recodeFiles" "data": "recordFiles"
}, { }, {
"data": "finishTime" "data": "finishTime"
}, { }, {
@ -860,7 +860,7 @@
if (cellData != null) { if (cellData != null) {
cellData.forEach(function (value, index) { cellData.forEach(function (value, index) {
CreateRecodeFileBox($(td).children(".row"), value, false); CreateRecordFileBox($(td).children(".row"), value, false);
}); });
} }
} }
@ -892,7 +892,7 @@
$(row).attr('data-work-type', data.workType); $(row).attr('data-work-type', data.workType);
}, },
"ajax": { "ajax": {
"url": "/Operation/OperationRecodeList", "url": "/Operation/OperationRecordList",
"type": "POST", "type": "POST",
"data": function (d) { "data": function (d) {
d.PowerStationIds = powerids; d.PowerStationIds = powerids;
@ -944,8 +944,8 @@
$("#work_person_select_modal").append($("<option />").val(val.value).text(val.text)); $("#work_person_select_modal").append($("<option />").val(val.value).text(val.text));
}); });
if (recode != null || recode != undefined) { if (record != null || record != undefined) {
$("#work_person_select_modal").val(recode.workPersonId); $("#work_person_select_modal").val(record.workPersonId);
} }
} }
}); });
@ -1005,8 +1005,8 @@
$("#work_person_select_modal_exc").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) { if (record != null || record != undefined) {
$("#work_person_select_modal_exc").val(recode.workPersonId); $("#work_person_select_modal_exc").val(record.workPersonId);
} }
} }
}); });
@ -1180,7 +1180,7 @@
//#region 產生檔案html //#region 產生檔案html
function CreateRecodeFileBox(dom, value, show_del_btn) { function CreateRecordFileBox(dom, value, show_del_btn) {
var str = ""; var str = "";
str += '<div class="col-auto px-0 py-2 mx-2">'; str += '<div class="col-auto px-0 py-2 mx-2">';
var split = value.fileName.split("."); var split = value.fileName.split(".");
@ -1197,7 +1197,7 @@
} }
if (show_del_btn) { if (show_del_btn) {
str += '<a href="javascript:;" class="del-operation-recode-file-btn" data-id="' + value.id + '">'; str += '<a href="javascript:;" class="del-operation-record-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 += '<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 += '</a>';
} }
@ -1261,7 +1261,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
errortoID = $(this).parents('tr').attr('data-error'); errortoID = $(this).parents('tr').attr('data-error');
//取得單一記錄表單 //取得單一記錄表單
var url = "/Operation/GetOneOperationRecode/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
id: errortoID id: errortoID
@ -1273,36 +1273,36 @@
return; return;
} }
recode = rel.data; record = rel.data;
countOperationRecodeFile = recode.recodeFiles.length; countOperationRecordFile = record.recordFiles.length;
$("#exception-form-modal .modal-title .sub-title").html(powerStationData.name); $("#exception-form-modal .modal-title .sub-title").html(powerStationData.name);
$("#power_station_select_modal_exc").val(powerStationData.name); $("#power_station_select_modal_exc").val(powerStationData.name);
$("#power_station_select_modal_exc").attr("disabled", true); $("#power_station_select_modal_exc").attr("disabled", true);
$("#work_time_modal").val(recode.workTime); $("#work_time_modal").val(record.workTime);
var status = -1; var status = -1;
if (recode.status == 0 || recode.status == 2) { if (record.status == 0 || record.status == 2) {
status = 0; status = 0;
} else if (recode.status == 1 || recode.status == 3) { } else if (record.status == 1 || record.status == 3) {
status = 1; status = 1;
} }
$("input[name=status_modal][value='" + status + "']").prop('checked', true); //狀態 $("input[name=status_modal][value='" + status + "']").prop('checked', true); //狀態
$('#work_person_select_modal_exc').val(recode.workPersonId); $('#work_person_select_modal_exc').val(record.workPersonId);
$(".fix-div").show(); $(".fix-div").show();
$("#error_code_modal_exc").val(recode.errorCode); $("#error_code_modal_exc").val(record.errorCode);
$("#error_code_modal_exc").attr("disabled", true); $("#error_code_modal_exc").attr("disabled", true);
$("#fix_do_modal_exc").val(recode.fixDo); $("#fix_do_modal_exc").val(record.fixDo);
$("#notice_textarea_modal_exc").val(recode.notice); $("#notice_textarea_modal_exc").val(record.notice);
$("#description_textarea_modal_exc").val(recode.description); $("#description_textarea_modal_exc").val(record.description);
var str = ""; var str = "";
RecodeFileBox = $("#recode_files_div_exc > .row"); RecordFileBox = $("#record_files_div_exc > .row");
RecodeFileBox.empty(); RecordFileBox.empty();
recode.recodeFiles.forEach(function (value, index) { record.recordFiles.forEach(function (value, index) {
CreateRecodeFileBox(RecodeFileBox, value, true); CreateRecordFileBox(RecordFileBox, value, true);
}); });
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
@ -1314,7 +1314,7 @@
$('#Exception_Table').on("click", "a.add-btn", function () { $('#Exception_Table').on("click", "a.add-btn", function () {
$("#exception-form-modal .modal-title .main-title").html("維修單 - "); $("#exception-form-modal .modal-title .main-title").html("維修單 - ");
$("#exception-form-modal .modal-title .sub-title").html(powerStationData.name); $("#exception-form-modal .modal-title .sub-title").html(powerStationData.name);
$("#recode-form-exc").trigger("reset"); $("#record-form-exc").trigger("reset");
$("#power_station_select_modal_exc").val(powerStationData.name); $("#power_station_select_modal_exc").val(powerStationData.name);
$("#power_station_select_modal_exc").attr("disabled", true); $("#power_station_select_modal_exc").attr("disabled", true);
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
@ -1345,8 +1345,8 @@
//#region 儲存表單資料(異常) //#region 儲存表單資料(異常)
function SaveException() { function SaveException() {
if ($("#recode-form-exc").valid()) { if ($("#record-form-exc").valid()) {
var url = "/Operation/SaveOperationRecode"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1374,7 +1374,7 @@
return; return;
} }
var myDropzone = Dropzone.forElement("#recode-file-form_exc"); var myDropzone = Dropzone.forElement("#record-file-form_exc");
if (myDropzone.files.length > 0) { if (myDropzone.files.length > 0) {
selected_id = rel.data; selected_id = rel.data;
@ -1388,7 +1388,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#exception-form-modal').modal('hide'); $('#exception-form-modal').modal('hide');
recodeFileDropzone.removeAllFiles(); recordFileDropzone.removeAllFiles();
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
}); });
@ -1406,8 +1406,8 @@
//#region 表單檔案資料(異常) //#region 表單檔案資料(異常)
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
recodeFileDropzone = new Dropzone("#recode-file-form_exc", { recordFileDropzone = new Dropzone("#record-file-form_exc", {
url: "/Operation/SaveOperationRecodeFile", url: "/Operation/SaveOperationRecordFile",
acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx", acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx",
autoProcessQueue: false, autoProcessQueue: false,
parallelUploads: 5, parallelUploads: 5,
@ -1420,14 +1420,14 @@
var myDropzone = this; var myDropzone = this;
myDropzone.on("sending", function (file, xhr, data) { myDropzone.on("sending", function (file, xhr, data) {
if ((countOperationRecodeFile + myDropzone.files.length) > 5) { if ((countOperationRecordFile + myDropzone.files.length) > 5) {
toast_warning("檔案總數量不可超過 5 張"); toast_warning("檔案總數量不可超過 5 張");
myDropzone.removeFile(file); myDropzone.removeFile(file);
return; return;
} else { } else {
data.append("Id", selected_id); data.append("Id", selected_id);
data.append("RecodeFiles", file); data.append("RecordFiles", file);
} }
}); });
@ -1459,22 +1459,22 @@
//#region 運維 //#region 運維
//#region 編輯表單內容(運維) //#region 編輯表單內容(運維)
$('#operation_recode_table').on("click", "a.edit-btn", function () { $('#operation_record_table').on("click", "a.edit-btn", function () {
work_type = $(this).parents('tr').attr('data-work-type'); work_type = $(this).parents('tr').attr('data-work-type');
if (work_type == 0) { if (work_type == 0) {
$("#recode-form-modal .modal-title .main-title").html("清洗單 - "); $("#record-form-modal .modal-title .main-title").html("清洗單 - ");
} else if (work_type == 1) { } else if (work_type == 1) {
$("#recode-form-modal .modal-title .main-title").html("巡檢單 - "); $("#record-form-modal .modal-title .main-title").html("巡檢單 - ");
} else { } else {
$("#recode-form-modal .modal-title .main-title").html("維修單 - "); $("#record-form-modal .modal-title .main-title").html("維修單 - ");
} }
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一記錄表單 //取得單一記錄表單
var url = "/Operation/GetOneOperationRecode/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
id: selected_id id: selected_id
@ -1486,51 +1486,51 @@
return; return;
} }
recode = rel.data; record = rel.data;
countOperationRecodeFile = recode.recodeFiles.length; countOperationRecordFile = record.recordFiles.length;
$("#recode-form-modal .modal-title .sub-title").html(recode.powerStationName); $("#record-form-modal .modal-title .sub-title").html(record.powerStationName);
$("#power_station_select_modal").val(recode.powerStationId); $("#power_station_select_modal").val(record.powerStationId);
$("#power_station_select_modal").attr("disabled", true); $("#power_station_select_modal").attr("disabled", true);
$("#work_time_modal").val(recode.workTime); $("#work_time_modal").val(record.workTime);
var status = -1; var status = -1;
if (recode.status == 0 || recode.status == 2) { if (record.status == 0 || record.status == 2) {
status = 0; status = 0;
} else if (recode.status == 1 || recode.status == 3) { } else if (record.status == 1 || record.status == 3) {
status = 1; status = 1;
} }
$("input[name=status_modal_opRecord][value='" + status + "']").prop('checked', true); //狀態 $("input[name=status_modal_opRecord][value='" + status + "']").prop('checked', true); //狀態
$('#work_person_select_modal').val(recode.workPersonId); $('#work_person_select_modal').val(record.workPersonId);
if (work_type != 2) { if (work_type != 2) {
$(".fix-div").hide(); $(".fix-div").hide();
} else { } else {
$(".fix-div").show(); $(".fix-div").show();
$("#error_code_modal").val(recode.errorCode); $("#error_code_modal").val(record.errorCode);
$("#fix_do_modal").val(recode.fixDo); $("#fix_do_modal").val(record.fixDo);
} }
$("#notice_textarea_modal").val(recode.notice); $("#notice_textarea_modal").val(record.notice);
$("#description_textarea_modal").val(recode.description); $("#description_textarea_modal").val(record.description);
var str = ""; var str = "";
RecodeFileBox = $("#recode_files_div > .row"); RecordFileBox = $("#record_files_div > .row");
RecodeFileBox.empty(); RecordFileBox.empty();
recode.recodeFiles.forEach(function (value, index) { record.recordFiles.forEach(function (value, index) {
CreateRecodeFileBox(RecodeFileBox, value, true); CreateRecordFileBox(RecordFileBox, value, true);
}); });
$("#recode-form-modal").modal(); $("#record-form-modal").modal();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
//#region 表單檔案資料(運維) //#region 表單檔案資料(運維)
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
recodeFileDropzone = new Dropzone("#recode-file-form", { recordFileDropzone = new Dropzone("#record-file-form", {
url: "/Operation/SaveOperationRecodeFile", url: "/Operation/SaveOperationRecordFile",
acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx", acceptedFiles: "image/*, application/pdf,.doc,.docx,.xls,.xlsx",
autoProcessQueue: false, autoProcessQueue: false,
parallelUploads: 5, parallelUploads: 5,
@ -1543,14 +1543,14 @@
var myDropzone = this; var myDropzone = this;
myDropzone.on("sending", function (file, xhr, data) { myDropzone.on("sending", function (file, xhr, data) {
if ((countOperationRecodeFile + myDropzone.files.length) > 5) { if ((countOperationRecordFile + myDropzone.files.length) > 5) {
toast_warning("檔案總數量不可超過 5 張"); toast_warning("檔案總數量不可超過 5 張");
myDropzone.removeFile(file); myDropzone.removeFile(file);
return; return;
} else { } else {
data.append("Id", selected_id); data.append("Id", selected_id);
data.append("RecodeFiles", file); data.append("RecordFiles", file);
} }
}); });
@ -1576,10 +1576,10 @@
//#endregion //#endregion
//#region 儲存表單資料(運維) //#region 儲存表單資料(運維)
function SaveRecode() { function SaveRecord() {
if ($("#recode-form").valid()) { if ($("#record-form").valid()) {
var url = "/Operation/SaveOperationRecode"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1607,7 +1607,7 @@
return; return;
} }
var myDropzone = Dropzone.forElement("#recode-file-form"); var myDropzone = Dropzone.forElement("#record-file-form");
if (myDropzone.files.length > 0) { if (myDropzone.files.length > 0) {
selected_id = rel.data; selected_id = rel.data;
@ -1620,16 +1620,16 @@
} }
toast_ok(rel.msg); toast_ok(rel.msg);
$('#recode-form-modal').modal('hide'); $('#record-form-modal').modal('hide');
recodeFileDropzone.removeAllFiles(); recordFileDropzone.removeAllFiles();
operationRecodeTable.ajax.reload(); operationRecordTable.ajax.reload();
}); });
} else { } else {
$('#recode-form-modal').modal('hide'); $('#record-form-modal').modal('hide');
myDropzone.removeAllFiles(); myDropzone.removeAllFiles();
operationRecodeTable.ajax.reload(); operationRecordTable.ajax.reload();
} }
} }
}); });
@ -1638,7 +1638,7 @@
//#endregion //#endregion
//#region 點擊圖片放大(運維) //#region 點擊圖片放大(運維)
$('#operation_recode_table').on("click", "img.img-zoom", function () { $('#operation_record_table').on("click", "img.img-zoom", function () {
var _this = $(this);//將當前的pimg元素作為_this傳入函式 var _this = $(this);//將當前的pimg元素作為_this傳入函式
imgShow("#img-zoom-outer-div", "#innerdiv", "#bigimg", _this); imgShow("#img-zoom-outer-div", "#innerdiv", "#bigimg", _this);
}); });
@ -1646,7 +1646,7 @@
//#region 匯出excel(運維) //#region 匯出excel(運維)
function ExportExcel() { function ExportExcel() {
var url = "/Operation/ExportOperationRecodeExcel"; var url = "/Operation/ExportOperationRecordExcel";
var send_data = { var send_data = {
CityIds: [3], CityIds: [3],
PowerStationIds: powerids PowerStationIds: powerids
@ -1705,7 +1705,7 @@
//#region 改變日期(運維) //#region 改變日期(運維)
$('#date-range-record').on('change', function () { $('#date-range-record').on('change', function () {
operationRecodeTable.ajax.reload(); operationRecordTable.ajax.reload();
}); });
//#endregion //#endregion
@ -1717,7 +1717,7 @@
document.getElementById(name).setAttribute("class", "btn btn-secondary waves-effect waves-themed"); 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"); document.getElementById("button" + type).setAttribute("class", "btn btn-success waves-effect waves-themed");
operationRecodeTable.ajax.reload(); operationRecordTable.ajax.reload();
} }
//#endregion //#endregion

View File

@ -68,7 +68,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="recode-form-exc"> <form id="record-form-exc">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
@ -150,14 +150,14 @@
<div class="col-2"> <div class="col-2">
<p>檔案上傳</p> <p>檔案上傳</p>
</div> </div>
<div id="recode_files_div_exc" class="col-10"> <div id="record_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 class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div">
</div> </div>
</div> </div>
</div> </div>
<div class="row px-3"> <div class="row px-3">
<form id="recode-file-form_exc" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;"> <form id="record-file-form_exc" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;">
<div class="fallback"> <div class="fallback">
<input type="file" multiple /> <input type="file" multiple />
</div> </div>
@ -172,7 +172,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <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> <button type="button" class="btn btn-primary" id="save-record-btn" onclick="SaveException()">確定</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -24,7 +24,7 @@
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="w-100"> <div class="w-100">
<table class="table table-bordered table-hover m-0 text-center" id="operation_recode_table"> <table class="table table-bordered table-hover m-0 text-center" id="operation_record_table">
<thead class="thead-themed"> <thead class="thead-themed">
<tr> <tr>
<th>電廠</th> <th>電廠</th>
@ -63,7 +63,7 @@
</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 fade" id="record-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-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -75,7 +75,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="recode-form"> <form id="record-form">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
@ -157,14 +157,14 @@
<div class="col-2"> <div class="col-2">
<p>檔案上傳</p> <p>檔案上傳</p>
</div> </div>
<div id="recode_files_div" class="col-10"> <div id="record_files_div" class="col-10">
<div class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div"> <div class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div">
</div> </div>
</div> </div>
</div> </div>
<div class="row px-3"> <div class="row px-3">
<form id="recode-file-form" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;"> <form id="record-file-form" class="dropzone needsclick dz-clickable col-12" style="min-height: 7rem;">
@*<div class="fallback"> @*<div class="fallback">
<input type="file" multiple /> <input type="file" multiple />
</div>*@ </div>*@
@ -179,7 +179,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <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> <button type="button" class="btn btn-primary" id="save-record-btn" onclick="SaveRecord()">確定</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,7 +21,7 @@ label.error {
#power-station-images-form .dz-preview .dz-progress, #power-station-images-form .dz-preview .dz-progress,
#power-station-single-line-form .dz-preview .dz-progress, #power-station-single-line-form .dz-preview .dz-progress,
#recode-file-div .dz-preview .dz-progress #record-file-div .dz-preview .dz-progress
{ {
display: none; display: none;
} }