/** * 功能:应急预警报告添加及修改 * * * @author HXB * @date 2015/09/14 */ ReportInputPlanAddEdit = function() { /**定义变量**/ var _this = this; /**私有方法**/ /***新增信息***/ _this.save = function(){ if(_is_add){ top.Dialog.alert("不能重复添加预警填报要求,请重新选择!"); return; } var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"); var obj = getTimeId(); if(!checkTime()){ return; }else if(!decideTime()){ return ; } else if(!checkTimes()){ return; }else if(!checkTimeAdd("addTime",obj,timeindex)){ return; }else if(pattern.test($("#PROGRAMME_NAME_320").val())){ top.Dialog.alert("填报要求名称不能包含特殊字符"); return; } $('#editForm input[name="classid"]').val('320'); var deptName = $("#WRITE_DEPT_ID_320_show").val(); $("#WRITE_DEPT_NAME_320").val(deptName); $form = $('#editForm'); var valid = $form.validationEngine({returnIsValid: true}); if($("#show_WRITE_DEPT_ID_320").val()==""){ $("#show_WRITE_DEPT_ID_320").addClass("error-field"); }else{ $("#show_WRITE_DEPT_ID_320").removeClass("error-field"); } if(!valid){ top.Dialog.alert(CHECKREDBOX); return; } if(valid){ showProgressBar("正在提交中..."); var url = $.pathname() + '/ws/crud/CRUDService/create/'; var _write_dept_name = $("#selectTree3_input").val(); if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){ url = $.pathname() +"/ws/crud/CRUDService/update/"; } var formValue = $form.serialize(); $.request.add(url,formValue,function(data){ closeProgress(); top.Dialog.alert(data.Msg.info); if(isAlert != null && isAlert == 0){ $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp"); } }); } }; _this.saveAndRelease = function(){ if(_is_add){ top.Dialog.alert("不能重复添加预警填报要求,请重新选择!"); return; } if(!checkTime()){ return; }else if(!decideTime()){ return ; } else if(!checkTimes()){ return; } $('#editForm input[name="classid"]').val('320'); var deptName = $("#WRITE_DEPT_ID_320_show").val(); $("#WRITE_DEPT_NAME_320").val(deptName); $form = $('#editForm'); var valid = $form.validationEngine({returnIsValid: true}); if(!valid){ top.Dialog.alert(CHECKREDBOX); } if(valid){ showProgressBar("正在提交中..."); var url = $.pathname() + '/ws/crud/CRUDService/create/'; var _write_dept_name = $("#selectTree3_input").val(); if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){ url = $.pathname() +"/ws/crud/CRUDService/update/"; } $("#IS_RELEASE_320").val("1"); var formValue = $form.serialize(); $.request.add(url,formValue,function(data){ closeProgress(); //top.Dialog.alert(data.Msg.info); top.Dialog.confirm("发布成功!是否发送短信通知?", function() { var comp_id = $("input[name=WRITE_DEPT_ID_320]").val(); $.ajax({ url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg', type : 'post', data : { /*'fd_id' : fd_id, 'userId':userId,*/ 'comp_id':comp_id }, async:false, dataType : 'json', success : function(data) { addMsg(data.list.split("|")[0],data.list.split("|")[1],"新发布了一个预警报告填报要求,请及时填报!",1); }, error : function(e) { $.messager.alert('访问服务失败!', 'error'); } }); },function(){ if(isAlert != null && isAlert == 0){ $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp"); } }); }); } }; _this.formReset = function(){ //if(fd_id!=undefined&&fd_id!=""){ $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInputPlan/ReportInputPlanAddEdit.jsp?fd_id='+fd_id); //}else{ // document.getElementById("editForm").reset(); // $("#dept_name").resetValue(); //} }; return { init : function() { $('#save').bind('click',function(){ _this.save(); }); $("#saveAndRelease").bind("click",function(){ _this.saveAndRelease(); }) $('#goback').bind('click',function(){ if(isAlert != null && isAlert == 0){ $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp"); } }); } }; }(); $(function() { ReportInputPlanAddEdit.init(); }); window.onload = function(){ $(".selectbox").attr("readonly","readonly"); };