/** * 功能:应急预警报告添加及修改 * * * @author HXB * @date 2015/12/9 */ TeamDemandInfo = function() { /**定义变量**/ var _this = this; _this.listGrid = null;// 预警数据列表 var flag=false; var isNew=false; //是否是新增记录 var editingRow; // 双击的当前编辑行 var index = 0; /**新增方法**/ _this.save = function(diag,fd_id){ /********** 弹框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 $("#PERSON_ID_378").val(b);//给主页面的下一节点人id赋值 //alert(b); if(b=='' && 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);//给主页面的下一节点人NAME赋值 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是否被勾选 var isPass = diag.innerFrame.contentWindow.$(".aa[checked='checked']").val();//判断是否同意 var g = '有新报审的队伍需求,请您及时处理!';//短信内容 var h = getDateTime();//系统时间 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)); //addMsg(data.list.split("|")[0],data.list.split("|")[1],"新报审了一个队伍需求,请及时审核!"); }, error : function(e){ $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } if(f=='checked'){ alert("应急app提醒!"); } diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框 /********** 弹框end **********/ $form = $('#editForm1'); var valid = $form.validationEngine({returnIsValid: true}); if(valid){ var params = { classid : "391", FD_OBJECTID391 : $("#FD_OBJECTID391").val(), STATE_391 : "132" }; $.ajax({ url : $.pathname() + '/ws/crud/CRUDService/update/', type : 'post', timeout : 15000, data : params, dataType : 'json', success : function(data) { // $("#PERSON_NAME_378").val($("#PERSON_ID_378").attr("relText")); $("#PERSON_NAME_378").val($("#PERSON_NAME_378").val()); var url = $.pathname() + '/ws/crud/CRUDService/create/'; var formValue = $form.serialize(); $.request.add(url,formValue,function(data){ closeProgress(); /*top.Dialog.confirm("报审成功!是否发送短信通知?", function() { $.ajax({ url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg', type : 'post', data : { 'fd_id' : fd_id, 'userId':userId, 'comp_id':deptId }, async:false, dataType : 'json', success : function(data) { addMsg(data.list.split("|")[0],data.list.split("|")[1],"新报审了一个队伍需求,请及时审核!"); }, error : function(e) { $.messager.alert('访问服务失败!', 'error'); } }); });*/ top.Dialog.alert('报审成功!', null, null, null, -1); $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber='); }); }, error : function(e) { $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); }else{ top.Dialog.alert('请选择下一节点处理人', null, null, null, -1); } }; return { init : function() { var temp = {"pager.pageNo":0,"pager.totalRows":0,"rows":[]}; /** grid载入数据* */ _this.listGrid = $("#maingrid").quiGrid( { //title : "预警接收管理数据列表", columns : [ { display: '队伍类型', name: 'ANSWER_CODE_331', align: 'center', width: "35%",editor: { type: 'text' }}, { display: '需求人数', name: 'THIS_ANSWER_GRADE_331', align: 'center', width: "35%",editor: { type: 'text' }} ], //url : $.pathname() + '/ws/crud/CRUDService/queryQui', data:temp, height : "200", width : "100%", rownumbers:true, percentWidthMode : true, usePager:false, enabledEdit: true, clickToEdit: false, onDblClickRow:function(rowdata, rowindex){ _this.listGrid.endEdit(editingRow); _this.listGrid.beginEdit(rowindex); editingRow = rowindex; } }); var fd_id = (window.location.href).split('?')[1];//获取记录id var ids = fd_id.split("="); $.post($.pathname() + '/ws/crud/CRUDService/getDataById/',{classid : '391',objectID : ids[1]},function(data){ var test = {"pager.pageNo":1,"pager.totalRows":3,"rows":JSON.parse(data.TROOPS_391)}; _this.listGrid.loadData(test); }); /********** 弹框start **********/ $("#pass00").bind("click",function(){ var isPass=2;//报审 dialogDemo(isPass); }); function dialogDemo(isPass){ var fdid = (window.location.href).split('=')[1];//获取记录id(1) var fd_id = fdid.split('&')[0];//获取记录id(2) // alert(fd_id) //var ifmHeight = $(top.document.body).find("#frmright").height(); var diag = new top.Dialog(); diag.Title = '报审'; diag.URL = $.pathname() + '/page/business/em/response/team/TeamNextRole.jsp?fd_id='+fd_id+'&isPass=2&deptId='+deptId; //修改对应的路径的编辑界面 diag.OkButtonText = '提交'; diag.OKEvent = function(){ _this.save(diag,fd_id); }; diag.Width = 500; //宽度 diag.Height = 240; //高度 diag.ButtonAlign = 'center'; diag.show(); }; /********** 弹框end **********/ $('#save').bind('click',function(){ _this.save(); }); /*$('#close').bind('click',function(){ alert("123"); $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber='); });*/ $('#back').bind('click',function(){ $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber='); }); } }; }(); $(function() { TeamDemandInfo.init(); });