$(function(){
	$(".occurDate").datetimepicker({
	    language:  "zh-CN",
	    weekStart: 1,
	    todayBtn:  1,
	    autoclose: 1,
	    todayHighlight: 1,
	    startView: 2,
	    minView: 2,
	    forceParse: 0,
	    format: "yyyymmdd"
	});
	//填值---开始
	if( JSON.stringify(custEventData[operationRowNum]) != "{}" ){//判断是否保存过值
		$("#borrowerEventForm .eventNo").val(custEventData[operationRowNum].eventNo);//大事记录流水号
		$("#borrowerEventForm .occurDate").val(custEventData[operationRowNum].occurDate);//大事记录日期
		$("#borrowerEventForm .borrowerName").val(custEventData[operationRowNum].borrowerName);//借款人名称
		$("#borrowerEventForm .eventDesc").val(custEventData[operationRowNum].eventDesc);//大事描述
	}
	$(".borrowerEventDialog .addSure").removeClass("loadingCircle");
	
	$(".borrowerEventDialog .addSure").click(function(){
		$("#borrowerEventForm").submit();
	})
	$("#borrowerEventForm").validate({
		promptPosition : "bottomLeft",
		submitHandler : function(form) {
			$(".borrowerEventDialog .addSure").addClass("loadingCircle");
			$(".borrowerEventDialog").modal("hide");
			$(".borrowerEventDialog").on('hidden.zui.modal', function(){
				custEventData[operationRowNum].eventNo=$("#borrowerEventForm .eventNo").val();//大事记录流水号
				custEventData[operationRowNum].occurDate=$("#borrowerEventForm .occurDate").val();//大事记录日期
				custEventData[operationRowNum].borrowerName=$("#borrowerEventForm .borrowerName").val();//借款人名称
				custEventData[operationRowNum].eventDesc=$("#borrowerEventForm .eventDesc").val();//大事描述
				//console.log(custEventData);
				updateListData('custEventList',custEventData[operationRowNum],operationRowNum);
			});
		},
		rules : {
			'eventNo':{
				required:true
			},
			'occurDate':{
				required:true
			},
			'borrowerName':{
				required:true
			},
			'eventDesc':{
				required:true
			}
		},
		messages : {
			'eventNo':{
				required:'请填写大事记录流水号'
			},
			'occurDate':{
				required:'请选择大事记录日期'
			},
			'borrowerName':{
				required:'请填写借款人名称'
			},
			'eventDesc':{
				required:'请填写大事描述'
			}
		}
	})
})