/** * 功能: * * * @author * @date 2015/09/14 */ EventAddEdit = function() { /**定义变量**/ var _this = this; /**私有方法**/ /***新增信息***/ _this.save = function(){ $('#editForm input[name="classid"]').val('397'); $form = $('#editForm'); var valid = $form.validationEngine({returnIsValid: true}); if(!valid){ top.Dialog.alert(CHECKREDBOX); return; } if(valid){ showProgressBar("正在提交中..."); $("body").eq(0).showLoading(); var formValue = $form.serialize(); var url = $.pathname() + '/ws/crud/CRUDService/create/'; if(fd_id!=undefined&&fd_id!=""){ url = $.pathname() +"/ws/crud/CRUDService/update/"; } $.request.add(url,formValue,function(data){ $("body").eq(0).hideLoading(); top.Dialog.alert(data.Msg.info); $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp"); }); } }; /***保存发布***/ _this.saveAndRelease = function(){ $('#editForm input[name="classid"]').val('397'); $form = $('#editForm'); var valid = $form.validationEngine({returnIsValid: true}); if(!valid){ top.Dialog.alert(CHECKREDBOX); return; } 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/"; } $("#RELEASE_STATE_397").val("1"); var formValue = $form.serialize(); $.request.add(url,formValue,function(data){ closeProgress(); //top.Dialog.alert(data.Msg.info); top.Dialog.confirm("发布成功!是否发送短信通知?", function() { $.ajax({ url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg', type : 'post', data : { 'comp_id':$("#EVENT_UNIT_397").val() }, async:false, dataType : 'json', success : function(data) { alert(JSON.stringify(data)); addMsg(data.list.split("|")[0],data.list.split("|")[1],"新发布了一个响应报告填报要求,请及时填报!",1); }, error : function(e) { $.messager.alert('访问服务失败!', 'error'); } }); },function(){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp"); }); }); } }; _this.formReset = function(){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.jsp?fd_id="+fd_id); }; return { init : function() { $('#save').bind('click',function(){ _this.save(); }); $("#saveAndRelease").bind("click",function(){ _this.saveAndRelease(); }); $('#back').bind('click',function(){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp"); }); } }; }(); $(function() { EventAddEdit.init(); });