/** * 非同期/排他制御チェック * @param {string} inRegistType 処理種別 [insert, update, delete] * @param {string} inExDate 排他制御日時 * @param {string} inTable 排他対象テーブル * @param {Array[string]} inKeys 排他対象レコードキー * @param {Array[string]} inVals 排他対象レコード値 * @param {string} inRedirectReload リダイレクト先(ページ更新) * @param {string} inRedirectExit リダイレクト先(ページ脱出) * @param {string} inButtonID 制御対象ボタンID * @param {string} inFormID 制御対象フォームID * @returns {undefined} */ function ajax_check_exclusion(inRegistType, inExDate, inTable, inKeys, inVals, inRedirectReload, inRedirectExit , inButtonID, inFormID) { // チェック情報 var chkFlg = true; var chkTtl = ""; var chkMsg = ""; var chkRct = ""; BlockUI_transparent(); $.ajax({ url: "../common/ajax/ajax_comCheckExclusion.php", type: "POST", dataType: 'json', data: {ajax_query_type : inRegistType, exclusiondate : inExDate, tablename : inTable, key : inKeys, val : inVals}, success: function(returnValue){ //成功した場合 if(returnValue['result'] != "OK") { chkFlg = false; chkTtl = returnValue['title']; chkMsg = returnValue['message']; chkRct = returnValue['redirect']; } }, error: function( jqXHR, textStatus, errorThrown ){ //エラーが発生した場合 chkFlg = false; }, complete: function( jqXHR, textStatus ){ //「error」を含め、処理が完了した場合に必ず起動されます。 UnblockUI(); if(!chkFlg) { UnblockUI(); if(inButtonID) { $("#" + inButtonID).button({disabled : false}); } if(chkRct == 'exit') { ShowAlertDialogReDirect(chkTtl, chkMsg, inRedirectExit); } else { ShowAlertDialogReDirect(chkTtl, chkMsg, inRedirectReload); } } else { switch(inRegistType) { case 'insert': document.getElementById(inFormID).act.value=inRegistType; document.getElementById(inFormID).submit(); break; case 'update': document.getElementById(inFormID).act.value=inRegistType; document.getElementById(inFormID).submit(); break; case 'delete': UnblockUI(); if(inButtonID) { $("#" + inButtonID).button({disabled : false}); } //削除情報設定 var strTitle = "削除確認"; var strMessage = "削除してよいですか?

"; strMessage += "
"; strMessage += "

"; strMessage += "削除したデータは復元できません。"; strMessage += "

"; // ダイアログのメッセージを設定 $("#confirm_dialog").html(strMessage); // ダイアログを作成 $("#confirm_dialog").dialog({ modal: true, title: strTitle, width: 500, buttons: { "OK": function() { $( this ).dialog( "close" ); document.getElementById(inFormID).act.value=inRegistType; document.getElementById(inFormID).submit(); }, "キャンセル": function() { $(this).dialog( "close" ); } } }); break; default: break; } } } }); }