/** * 功能:应急预警报告添加及修改 * * * @author LJP * @date 2015/12/29 */ ReportInputPlanAddEdit = function() { /**定义变量**/ var _this = this; /**私有方法**/ /***新增信息***/ _this.save = function(){ if(is_overTime){ top.Dialog.alert("自定义时间应大于当前时间!"); return; } $('#requireForm input[name="classid"]').val('429'); $form = $('#requireForm'); var valid = $form.validationEngine({returnIsValid: true}); if(!valid){ /*top.Dialog.alert(CHECKREDBOX);*/ var flag = $(".tem_content").is(":hidden"); if($("#report_type").val().trim()==""){ top.Dialog.alert("请选择报表类型"); }else if($("#PROJECT_NAME_429").val().trim()==""){ top.Dialog.alert("请填写计划名称"); }else if($("input[name=REPORT_DEPT_429]").val().trim()==""){ top.Dialog.alert("请选择填报单位"); }else if($("#FILL_IN_SCHEDULE_429").val().trim()==""){ top.Dialog.alert("请选择填报周期"); } if(!flag&&$("#TEMPORARY_TIME_429").val().trim()==""){ top.Dialog.alert("请填写自定义时间"); } } if(valid){ showProgressBar("正在提交中..."); var url = $.pathname() + '/ws/crud/CRUDService/create/'; if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){ url = $.pathname() +"/ws/crud/CRUDService/update/"; } $("#REPORT_DEPT_NAME_429").val($("#REPORT_DEPT_429").attr("reltext")); var formValue = $form.serialize(); /*alert(JSON.stringify(formValue)); return;*/ $.request.add(url,formValue,function(data){ closeProgress(); top.Dialog.alert(data.Msg.info); goback(); }); } }; _this.saveAndRelease = function(){ if(is_overTime){ top.Dialog.alert("自定义时间应大于当前时间!"); return; } $('#requireForm input[name="classid"]').val('429'); $form = $('#requireForm'); var valid = $form.validationEngine({returnIsValid: true}); if(!valid){ if($("#report_type").val().trim()==""){ top.Dialog.alert("请选择报表类型"); }else if($("#PROJECT_NAME_429").val().trim()==""){ top.Dialog.alert("请填写计划名称"); }else if($("input[name=REPORT_DEPT_429]").val().trim()==""){ top.Dialog.alert("请选择填报单位"); }else if($("#FILL_IN_SCHEDULE_429").val().trim()==""){ top.Dialog.alert("请选择填报周期"); }else if(!$("#TEMPORARY_TIME_429").is(":hidden")){ if($("#TEMPORARY_TIME_429").val().trim()==""){ top.Dialog.alert("请填写自定义时间"); } } } if(valid){ showProgressBar("正在提交中..."); var url = $.pathname() + '/ws/crud/CRUDService/create/'; if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){ url = $.pathname() +"/ws/crud/CRUDService/update/"; } $("#SEND_STAT_429").val("1"); $("#REPORT_DEPT_NAME_429").val($("#REPORT_DEPT_429").attr("reltext")); var formValue = $form.serialize(); $.request.add(url,formValue,function(data){ closeProgress(); top.Dialog.alert(data.Msg.info); goback(); }); } }; return { init : function() { $('#save').bind('click',function(){ _this.save(); }); $("#saveAndRelease").bind("click",function(){ _this.saveAndRelease(); }); } }; }(); $(function() { ReportInputPlanAddEdit.init(); });