弹出对话框,在对话框里编辑完成后保存
var editUltRecordFormId="editUltRecordForm";
var $ultRecordDialog;
jQuery(document).ready(function($){
$("#addUltRecord").on("click",function(e){
$clickBut = $(this);
addUltRecord();
});
});
/**
* 添加超出系统填报时间的原因说明
* @returns
*/
function addUltRecord(){
//出访任务ID
var taskId=$("#visitCountryListForm #id").val();
var sendParam = {"taskId":taskId,"countryType":$("#countryTypeINT").val()};
var dlgTitle = "超出系统填报时间的原因说明";
modelAjax({
data:sendParam,
url:SYS_CONTEXT+'/foreignAffairs/abroad/visitCountry/'+typePath+'/editUltRecord',
cache:false,
dataType:'html',
success:function(html){
$ultRecordDialog=BootstrapDialog.show({
size: BootstrapDialog.SIZE_WIDE,
title:dlgTitle,
message: function(dialog) {
$message=$(html);
return $message;
},
closable: true,
closeByBackdrop: false,
closeByKeyboard: false,
onshown:initUltRecordForm,
onhidden:null,
buttons: [
{
label: '保存并关闭',
id: 'saveVisitCountry',
icon: 'glyphicon glyphicon-floppy-save',
cssClass: 'btn_dark_success',
action: function(){
$clickBut=$(this);
$("#"+editUltRecordFormId).data('formValidation').validate();
}
},
{
icon: 'glyphicon glyphicon-remove',
label:'关闭',
cssClass: 'btn_danger',
action: function(dialogItself){
dialogItself.close();
}
}]
});
}
});
}
function initUltRecordForm(){
var $v_ultRecordForm=initFormValidation(editUltRecordFormId,ultRecordFormValidateOption,function($form){
$submitForm($("#"+editUltRecordFormId),$clickBut,{
url:SYS_CONTEXT+'/foreignAffairs/abroad/visitCountry/'+typePath+'/saveUltRecord',
dataType:'json',
success:function(data){
notyOptions.text=data.message;
if(data.result==SUCCESS){//保存成功
notyOptions.type=NOTY_SUCCESS;
$ultRecordDialog.close();
}else{//保存失败
notyOptions.type=NOTY_ERROR;
}
noty(notyOptions);
}
});
});
}
/**
* 开通权限表单验证
*/
var ultRecordFormValidateOption=initValidOption({
"country":{
validators: {
notEmpty: {
}
}
},
"startDateStr":{
validators: {
notEmpty: {
}
}
},
"endDateStr":{
validators: {
notEmpty: {
}
}
}
});