diff --git a/Frontend/_alert.html b/Frontend/_alert.html index 45414fa..f4ef502 100644 --- a/Frontend/_alert.html +++ b/Frontend/_alert.html @@ -79,7 +79,7 @@
@@ -277,6 +277,10 @@ }); onEvent('click', '#alertTable a[id=alr_recModal]', function () { + $('#alr_forImage').html(''); + $('#alr_forFile').html(''); + $('#inpNotice').val(''); + $('#inpDescription').val(''); let alr_table = $('#alertTable').DataTable(); let alr_elem = $(this).parent().parent(); let alr_tableData = alr_table.row(alr_elem).data(); @@ -298,6 +302,80 @@ let alr_fixDoCode = $($('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']')[0]).val(); $('#inpFixDoCode').val(alr_fixDoCode); }); + + onEvent('click', '#OpeRecSendBtn', function () { + let form = $("#opeRecForm"); + $(form).validate({ + rules: { + inpWorTyp: { required: true }, + inpFixDo: { required: true }, + inpFixDoCode: { required: true }, + inpFixFirm: { required: true }, + inpStatus: { required: true }, + inpWorPerId: { required: true }, + } + }); + + if ($(form).valid()) { + let url = baseApiUrl + "/operation/SavOpeRecord"; + + let fd = new FormData(); + $.each(pageAct.imageFile, function (i, v) { + fd.append("lorf[" + i + "].id", v.id); + fd.append("lorf[" + i + "].file", v.file); + fd.append("lorf[" + i + "].save_file_name", v.save_file_name); + fd.append("lorf[" + i + "].ori_file_name", v.ori_file_name); + }); + + fd.append("error_code", $('#inpErrCode').val()); + fd.append("location", "台北" + $('#buiActDrop').text() + pageAct.floor); + fd.append("location_code", pageAct.AreaTag + pageAct.buiTag + pageAct.floor); + fd.append("device_system_category_layer2", pageAct.selSysMain); + fd.append("device_system_category_layer3", pageAct.selSysSub); + fd.append("work_type", parseInt($('#inpWorTyp').val())); + fd.append("fix_do", $('#inpFixDo').val()); + fd.append("fix_do_code", $('#inpFixDoCode').val()); + fd.append("fix_firm", parseInt($('#inpFixFirm').val())); + fd.append("status", parseInt($('#inpStatus').val())); + fd.append("work_person_id", $('#inpWorPerId').val()); + fd.append("start_time", ($('#inpStaTime').val() || null) == null ? null : new Date($('#inpStaTime').val()).toISOString()); + fd.append("notice", $('#inpNotice').val() || null); + fd.append("description", $('#inpDescription').val() || null); + + objSendData.Data = sendData; + $.ajax({ + url: url, + type: "POST", + data: fd, + async: false, + cache: false, + contentType: false, + processData: false, + beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', "Bearer " + localStorage.getItem("JWT-Authorization")) }, + success: function (res) { + if (!res || res.code != "0000" || !res.data) { + + } else { + //toast_ok(common.AddSuc); + //$("#opeFirmModal").modal("hide"); + $("#OpeRecCanBtn").click(); + getData(); + } + } + }); + + //ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { + // if (!res || res.code != "0000" || !res.data) { + + // } else { + // //toast_ok(common.AddSuc); + // //$("#opeFirmModal").modal("hide"); + // $("#OpeRecCanBtn").click(); + // refTable(); + // } + //}, null, "POST").send(); + } + }); } function setReturn(bool) { diff --git a/Frontend/_operation.html b/Frontend/_operation.html index 7b6e747..32f2d26 100644 --- a/Frontend/_operation.html +++ b/Frontend/_operation.html @@ -301,7 +301,6 @@