/** * 功能:应急预警报告添加及修改 * * * @author HXB * @date 2015/09/25 */ WarningAddEditAdjust = function() { /**定义变量**/ var _this = this; var nowTime =""; /**私有方法**/ _this.DateTime = function(){ $.ajax({//后台获取系统当前时间 url:$.pathname()+ '/ws/response/responseService/getNowTime', // data : {}, type : 'post', dataType : 'text', async : false, timeout : 6000, success : function(result){ nowTime=result; },error : function(e){ top.Dialog.alert("获取后台时间失败!"); return; } }); }; var isCheckAndIssue = 0;//判断是否是点击审核并签发按钮 0》》不是 1》》是 var isPass = ""; /***新增信息***/ _this.save = function(diag,fd_id,isCheckAndIssue){ _this.DateTime(); var is_audit = $("#is_audit").val(); var nextManId = "";//代办处理会用到这个变量,主要用于保存下一节点处理人ID if(diag){ isPass = diag.innerFrame.contentWindow.$("input:radio[name='aa']:checked").val();//判断是否同意 } if(isCheckAndIssue == 0){//不是“审核并签发” if(is_audit==0){ /********** 弹框start **********/ var valid = diag.innerFrame.contentWindow.$("#ideaForm").validationEngine({returnIsValid: true});//弹框页面的非空验证 if(!valid){ top.Dialog.alert("请检查红色输入框!"); return; }; var a = diag.innerFrame.contentWindow.$("#EXPLAIN_37800").val();//弹框页面的回退说明的值 $("#EXPLAIN_378").val(a);//给主页面的回退说明标签赋值 var b = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id nextManId = b; $("#PERSON_ID_378").val(b);//给主页面的下一节点人id赋值 var isChecked1 = diag.innerFrame.contentWindow.$("#yAgree").attr("checked"); var isChecked2 = diag.innerFrame.contentWindow.$("#nAgree").attr("checked"); if(isChecked1 == 'checked' && b == undefined){ top.Dialog.alert("请选择下一处理人!"); diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=0&pageType=1&level2='+level2; return; } if(isChecked2 == 'checked' && a == ""){ top.Dialog.alert("请填写回退说明!"); return; } // if(a=='' && b == undefined){ // top.Dialog.alert("请选择下一处理人!!"); // return; // } var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME $("#PERSON_NAME_378").val(c); var d = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话 var e = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选 var f = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选 isPass = diag.innerFrame.contentWindow.$(".aa[checked='checked']").val();//判断是否同意 if(isChecked1 == 'checked'){ isPass = "同意"; }else{ isPass = "回退"; } var g = '您有新的通知单任务,请及时处理!';//短信内容 //var h = nowTime;//系统时间 var h ="nidaye"; if(e=='checked'){//短信被勾选 //alert("短信提醒"); if(b == undefined){ top.Dialog.alert("请选择短信接收人!"); return; } var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage'; var params = { realName : realName,//发送人真实姓名 smsRecTel : d,//接收电话 smsTime : h,//系统时间 smsContent : g,//短信内容 smsSendId : realName_ID,//发送人Id smsPeople : b,//接收人员id?还是name? type:"短信发送" }; $.ajax({ type : 'post', url : url0, data : params, async:false, dataType : 'json', success : function (data){ //alert(JSON.stringify(data)); }, error : function(e){ $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } if(f=='checked'){ alert("应急app提醒!"); } diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框 $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】 url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen', data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名 fdId : fd_id , //id nextPeopId : b , //下一处理人ID userId : realName_ID//处理人ID }, type : 'post', dataType : 'json', async:false, success : function (data){ },error : function(e){ top.Dialog.alert("系统提示信息!"); } }); /********** 弹框end **********/ }else{//签发通过,保存下一节点人信息于378表中 if(isPass == "回退"){ var isChecked2 = diag.innerFrame.contentWindow.$("#nAgree").attr("checked"); var a = diag.innerFrame.contentWindow.$("#EXPLAIN_37800").val();//弹框页面的回退说明的值 if(isChecked2 == 'checked' && a == ""){ top.Dialog.alert("请填写回退说明!"); return; } }else{ $("#AGREE_ISSUE_LEADER_ID_365").val(realName_ID); $("#AGREE_ISSUE_LEADER_NAME_365").val(realName); } var url = $.pathname() + '/ws/crud/CRUDService/getDataById/'; var params = { classid : '365', objectID : fd_id }; $.ajax({ url : url, data : params, type : 'post', dataType : 'json', async : false, timeout : 1500 , success : function(result){ var params1 = { classid:"378", PERSON_ID_378: result.WRITER_ID_365, PERSON_NAME_378: result.WRITER_365, BUSINESS_ID_378:fd_id, STATUES_378:"4", DISPOSE_378:"0" }; $.ajax({ url : $.pathname() + '/ws/crud/CRUDService/create/', type : 'post', timeout : 15000, data : params1, dataType : 'json', async : false, success : function(data) { },error:function(e){ top.Dialog.alert("系统错误!1"); } }); $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】 url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen', data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名 fdId : fd_id , //id nextPeopId : result.WRITER_ID_365 , //下一处理人ID userId : realName_ID//处理人ID }, type : 'post', dataType : 'json', async:false, success : function (data){ },error : function(e){ top.Dialog.alert("系统提示信息!"); } }); },error:function(e){ top.Dialog.alert("系统错误!2"); } }); } }else{//【审核并签发】 isPass="同意"; $("#AGREE_ISSUE_LEADER_ID_365").val(realName_ID); $("#AGREE_ISSUE_LEADER_NAME_365").val(realName); $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】 url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen', data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名 fdId : fd_id , //id nextPeopId : $("#WRITER_ID_365").val() , //下一处理人ID userId : realName_ID//处理人ID }, type : 'post', dataType : 'json', async:false, success : function (data){ },error : function(e){ top.Dialog.alert("系统提示信息!"); } }); } $form1 = $('#editForm1'); $form = $('#editForm'); var is_audit = $("#is_audit").val(); $('#classid').val('365'); if(is_audit == "0"){//is_audit 等于0为审核 等于1为签发 if(isPass == '同意'){//审核通过 if(isCheckAndIssue == 1){//审核并签发 $("#PERSON_ID_378").val(realName_ID);//审核人为系统登录人ID $("#PERSON_NAME_378").val(realName);//审核人为系统登录人NAME $("#STATUES_378").val(3); $("#IS_SEND_365").val(4); //3 设置成待签发 }else{ $("#STATUES_378").val(3); $("#IS_SEND_365").val(3); } var url = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDispose'; var params = { personId_378 : $("#lastWriterID").val(), businessId_378 : $("#lastBusinessID").val(), statues_378 : '1' }; $.request.query(url,params,function(data){ //alert(data); }); }else{ $("#IS_SEND_365").val(0);//变为未发送状态 $("#STATUES_378").val(2); var url0 = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDisDel'; var params0 = { businessId_378 : $("#lastBusinessID").val() ,STATUES_378 : 2 ,EXPAIN_378 : $("#EXPLAIN_378").val()}; $.request.query(url0,params0,function(data){ }); var url1 = $.pathname() +'/ws/crud/CRUDService/create/'; var $editForm1 = $("#editForm1"); var params1 = $editForm1.serialize(); // alert(JSON.stringify(params1)) $.request.query(url1,params1,function(data){ }); } }else if(is_audit == "1"){//签发 is_audit 等于0为审核 等于1为签发 if(isPass == "回退"){ $("#IS_SEND_365").val(0);//变为未发送状态 $("#STATUES_378").val(2); var url0 = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDisDel'; var params0 = { businessId_378 : $("#lastBusinessID").val() }; $.request.query(url0,params0,function(data){ //alert(data); }); diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框 }else{ $("#STATUES_378").val(4); $("#IS_SEND_365").val(4); //4 设置成待发布 var url = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDispose'; var params = { personId_378 : $("#lastWriterID").val(), businessId_378 : $("#lastBusinessID").val(), statues_378 : '3' }; $.request.query(url,params,function(data){ //alert(data); }); //===================================================================================================== } } $("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME $("#RELEASE_UNIT_365").val($("#WRITE_DEPT_365").val());//发布单位 var valid = $form.validationEngine({returnIsValid: true}); var valid1 = $form1.validationEngine({returnIsValid: true}); $("#DB_TYPE").val("1"); var formValue = $form.serialize(); var formValue1 = $form1.serialize(); if(valid && valid1){ updateAlert(formValue,formValue1,is_audit,isPass,nextManId,fd_id);//is_audit(0代表审核 1代表签发) }else{ top.Dialog.alert(CHECKREDBOX); } }; function updateAlert(formValue,formValue1,is_audit,isPass,nextManId,fd_id){ var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad"; $.request.add(url,formValue,function(data){ if(is_audit==0 && isPass == '同意'){//审核同意走这里,新增下一节点人信息 url = $.pathname() +'/ws/crud/CRUDService/create/'; if(isCheckAndIssue == 1){ $("#DISPOSE_378").val(1); formValue1 = $form1.serialize(); } $.request.add(url,formValue1,function(data){ // if(is_audit==0 && isPass == '同意'){ if(isPass == '同意'){ if(isCheckAndIssue == 1){ var writerId = $("#WRITER_ID_365").val(); var writerName = $("#WRITER_365").val(); $("#PERSON_ID_378").val(writerId);//发布人(这里应该保存该条通知单的填报人id,为了让填报人的代办中有一条待分发的代办) $("#PERSON_NAME_378").val(writerName);//发布人(这里应该保存该条通知单的填报人NAME) $("#STATUES_378").val(4); $("#DISPOSE_378").val(0); formValue1 = $form1.serialize(); url = $.pathname() +'/ws/crud/CRUDService/create/'; $.request.add(url,formValue1,function(data){ top.Dialog.alert("审核并签发成功!"); if(isWaitDo == 1){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html"); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp"); } }); }else{ top.Dialog.alert("审核通过!"); if(isWaitDo == 1){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html"); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp"); } } } // $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp"); }); }else{ //回退在前面已经删除过操作节点人了 if(isPass == '回退'){ top.Dialog.alert("回退成功!"); }else{//签发不需要再选择下一节点人 top.Dialog.alert("签发通过!"); } if(isWaitDo == 1){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html"); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp"); } } }); /** 代办右上角红色圈里面数字的改变 **/ var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var params=""; if(is_audit=="0"){//审核 if(isPass == '回退'){//退回 params = { userId : user_id//,//处理人ID(系统登录人) //netx_id : nextManId//,//下一节点处理人ID }; }else{//审核通过 params = {userId : user_id,netx_id : nextManId}; } }else if(is_audit=="1"){//签发 if(isPass == '回退'){//退回 params = {userId : user_id/*,netx_id : b*/}; }else{//签发通过 $.ajax({ url : $.pathname() + '/ws/response/responseService/getWriterIdByFdid', data : { FD_OBJECTID : fd_id} , type : 'post', dataType : 'text', timeout : 15000, async : false, success : function(relust){ params = {userId : user_id,netx_id : relust}; },error : function (e){ top.Dialog.alert('系统错误!3'); } }); } } $.ajax({ url : $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask', data : params, type : 'post', dataType : 'text', timeout : 15000, // async : false, success : function(data){ // top.Dialog.alert('发送成功!', null, null, null, -1); }/*,error : function (e){ top.Dialog.alert('系统错误!4'); }*/ }); } return { init : function() { /********** 弹框start **********/ $("#pass00").bind("click",function(){ if(is_audit == "1"){//签发 isCheckAndIssue = 0; $(".person").hide(); $("#PERSON_NAME_378").attr("class",""); _this.save(null,fd_id,isCheckAndIssue); }else{ var level2 = $("#CURRENT_ER_LEVEL_365").val();//响应级别 29 I级 30 II级 31 III级 32 IV级 var pageType = 1;//pageType的值 0为发送页面 1为审核页面 var isPass=0;//同意 dialogDemo(isPass,level2,pageType,null); } }); $("#rock00").bind("click",function(){ var level2 = $("#CURRENT_ER_LEVEL_365").val();//响应级别 29 I级 30 II级 31 III级 32 IV级 var pageType = 1;//pageType的值 0为发送页面 1为审核页面 var isPass=1;//回退 dialogDemo(isPass,level2,pageType,null); }); function dialogDemo(isPass,level2,pageType,isCheckAndIssue){ //var ifmHeight = $(top.document.body).find("#frmright").height(); var diag = new top.Dialog(); if (is_audit == 0){//审核 diag.Title = '审核意见'; }else if(is_audit == 1){//签发 diag.Title = '签发页面'; } if(isPass==0){//同意 diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=0&pageType=1&level2='+level2; //修改对应的路径的编辑界面 }else if(isPass==1){//退回 if(is_audit == 1){ diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=1&pageType=1&isBack=1&level2='+level2; //修改对应的路径的编辑界面 }else{ diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=1&pageType=1&level2='+level2; //修改对应的路径的编辑界面 } } diag.OkButtonText = '提交'; diag.OKEvent = function(){ isCheckAndIssue = 0; _this.save(diag,fd_id,isCheckAndIssue); diag.close(); //_this.saveMenuRole(diag,fd_id); }; diag.Width = 500; //宽度 // diag.Height = 200; //高度 diag.ButtonAlign = 'center'; diag.show(); }; /********** 弹框end **********/ $('#back').bind('click',function(){ if(isWaitDo == 1){ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html"); }else{ $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp"); } }); $('#checkAndIssue').bind('click',function(){ isCheckAndIssue = 1; _this.save(null,fd_id,isCheckAndIssue); }); } }; }(); $(function() { WarningAddEditAdjust.init(); });