var user_id=top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var login_name=top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name(); var real_name=top.com.sinosoft.lz.system.user.LoginInfo.getReal_name(); var user_corp=top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names(); var user_dept=top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames(); var user_deptId=top.com.sinosoft.lz.system.user.LoginInfo.getDept_id(); var sendGrid = null; var receiveGrid = null; //var gridData = {"pager.pageNo":2,"pager.totalRows":0,"rows" : []};//用于表格初始化 //var data3 ={"rows":[{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 20:38:56","send_result":"1","msg_content":"是打发"},{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 20:38:56","send_result":"1","msg_content":"是打发"},{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 20:38:56","send_result":"1","msg_content":"是打发"},{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 15:38:56","send_result":"1","msg_content":"是打发"},{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 15:38:56","send_result":"1","msg_content":"是打发"},{"task_name":"是打发","event_id":"防风防汛","module":"系统管理","send_type":"2","send_time":"2017-12-15 15:38:56","send_result":"1","msg_content":"是打发"}]}; /* * 初始化 */ $(function(){ //监听 $("#sendMsg").live("click",function(){ $("#frmright",window.parent.document).attr("src","/nwyj/page/system/newsms/sendMsg.html"); }); $("#contact").live("click",showContact); $("#updateUserInfo").live("click",updateUserInfo); //获取部门 var org=getDeptName(user_deptId); //手机号码赋值 getPhone(user_id); //获取表格数据 var sendData = getSendData(); var receiveData = getReceiveData(); //加载表格 initGrid(sendData,receiveData); //获取任务及短信数量 var numData = getNum(); /* * 页面赋值 */ $("#user_name").html(real_name); $("#login_name").html(login_name); $("#org").html(user_corp+"/"+org); $("#sTaskNum").text(numData.sTaskNum); $("#rTaskNum").text(numData.rTaskNum); $("#sMsgNum").text(numData.sMsgNum); $("#rMsgNum").text(numData.rMsgNum); }); /* * 获取组织 */ function getDeptName(id) { var rsl = ""; $.ajax({ url : "/nwyj/ws/InDepartmentService/InDepartmentService/getDeptById/", type : 'post', timeout : 60000, data : { id : id }, dataType : 'json', async : false, success : function(data) { rsl = data.DEPT_NAME; } }); return rsl; } /* * 获取手机号 */ function getPhone(user_id){ $.ajax({ data:{ "user_id":user_id }, type:'post', timeout:60000, dataType:'json', url:"/nwyj/ws/newsendsms/NewSendSmsService/getPhone", success:function(data){ setPhone(data); }, error:function(){ top.Dialog.alert("获取手机号失败!"); } }); } /* * 设置手机号 */ function setPhone(data){ var $ul = $(".user_phone").find("ul"); var default_phone = data.default_phone; var receive_phones = data.receive_phone; var all_phones = data.all_phone; var receive_phone = receive_phones.split(","); var all_phone = all_phones.split(","); if(default_phone!=""&&default_phone!=undefined&&default_phone!=null){ var $li = $("
  • "); $ul.append($li); } if(receive_phones!=""&&receive_phones!=undefined&&receive_phones!=null){ for(var i=0;i"); $ul.append($li); } } if(all_phones!=""&&all_phones!=undefined&&all_phones!=null){ for(var i=0;i-1){ continue; } var $li = $("
  • "); $ul.append($li); } } } /* * 初始化表格 */ function initGrid(sendData,receiveData){ //短信发送情况表 sendGrid =$("#msgSend").quiGrid({ columns:[ {display:'任务id',name:'fd_objectId',hide:true}, {display:'任务名称', name:'task_name', align:'center',width:'20%', render:function(rowdata, rowindex, value, column){ value = value.replace(/引号/g,"\""); return ""+value+""; } }, //{display:'突发事件名称', name:'event_id', align:'center',width:'20%'}, {display:'模块名称', name:'module', align:'center',width:'25%'}, {display:'发送方式', name:'send_type', align:'center',width:'15%'}, {display:'发送时间', name:'send_time', align:'center',width:'20%'}, {display:'发送结果', name:'send_result', align:'center',width:'10%', render:function(rowdata, rowindex, value, column){ var a = value.split("/")[0]; var b = value.split("/")[1]; if(a==b){ return value; }else{ return "
    "+value+"
    "; } } }, {display:'发送内容', name:'msg_content', align:'center',width:'10%', render:function(rowdata, rowindex, value, column){ value = value.replace(/引号/g,"\"").replace(/
    /g,"\n").replace(/斜杠/g,"\\"); return "
    "+value+"
    "; } } ], height:'276px', //width:'1003px', toolbar:false, data:sendData, pageSize:5, rownumbers:true, percentWidthMode:true, }); //短信接收情况表 receiveGrid = $("#msgReceive").quiGrid({ columns:[ {display:'任务id',name:'fd_objectId',hide:true}, {display:'任务名称', name:'task_name', align:'center',width:'20%', render:function(rowdata, rowindex, value, column){ value = value.replace(/引号/g,"\""); return ""+value+""; } }, //{display:'突发事件名称', name:'event_id', align:'center',width:'20%'}, {display:'模块名称', name:'module', align:'center',width:'25%'}, {display:'发送方式', name:'send_type', align:'center',width:'15%'}, {display:'发送时间', name:'send_time', align:'center',width:'20%'}, {display:'发送人', name:'recorder_name', align:'center',width:'10%'}, {display:'发送内容', name:'msg_content', align:'center',width:'10%', render:function(rowdata, rowindex, value, column){ value = value.replace(/引号/g,"\"").replace(/
    /g,"\n").replace(/斜杠/g,"\\"); return "
    "+value+"
    "; } } ], height:'276px', //width:'1003px', toolbar:false, data:receiveData, pageSize:5, rownumbers:true, percentWidthMode:true, }); } /* * 获取短信发送数据 */ function getSendData(){ var data = null ; $.ajax({ data:{"user_id":user_id}, type:'post', timeout:60000, dataType:'json', url:"/nwyj/ws/newsendsms/NewSendSmsService/getSendData", async:false, success:function(result){ data = result; console.log(JSON.stringify(data)); }, error:function(result){ console.log(JSON.stringify(result)); top.Dialog.alert("获取短信发送数据失败"); } }); return data; } /* * 获取短信接收数据 */ function getReceiveData(){ var data = null ; $.ajax({ data:{"user_id":user_id}, type:'post', timeout:60000, dataType:'json', url:"/nwyj/ws/newsendsms/NewSendSmsService/getReceiveData", async:false, success:function(result){ data = result; }, error:function(result){ console.log(JSON.stringify(result)); top.Dialog.alert("获取短信接收数据失败"); } }); return data; } /* * 根据任务名钻取 */ function getDetailByTask(rowindex,type){//发送 var task_id=""; var send_type = ""; if(type=="1"){ task_id = sendGrid.getRow(rowindex).fd_objectId; send_type = sendGrid.getRow(rowindex).send_type; }else{ task_id = receiveGrid.getRow(rowindex).fd_objectId; send_type = receiveGrid.getRow(rowindex).send_type; } if(send_type=="人工手动发送"){ send_type=1; }else{ send_type=2; } $("#frmright",window.parent.document).attr("src","/nwyj/page/system/newsms/msg_detail.html?"+task_id+"?"+send_type); } /* * 根据user_id钻取 */ function getDetailByUser(user_id,type){//发送 $("#frmright",window.parent.document).attr("src","?"+user_id+"?"+type); } /* * 获取任务及短信数量 */ function getNum(){ var numData = null; $.ajax({ data:{ "user_id":user_id }, type:'post', timeout:60000, dataType:'json', url:"/nwyj/ws/newsendsms/NewSendSmsService/getNumData", async:false, success:function(data){ numData = data; }, error:function(){ top.Dialog.alert("获取任务及短数量失败"); } }); return numData; } /* * 显示通讯录 */ function showContact(user_id){ var iframeHeight = $(window.document.body).height(); $(top.document.body).find("#frmright").height(iframeHeight+30); var diag = new parent.Dialog(); //短信管理按新增按钮时跳转地址 var url = '/nwyj/page/system/newsms/contactNew.html'; diag.Title = "通讯录"; diag.URL = encodeURI(url); // diag.Width =650; diag.Top = "30%"; diag.ID="addPeople"; diag.Height = 520; diag.Width = 1150; /* diag.Top = "80%";*/ diag.Left = "50%"; diag.ShowOkButton=false;// 不显示确认按钮 diag.ShowCancelButton=false;// 不显示取消按钮 diag.ButtonAlign = 'center'; diag.show(); } function updateUserInfo(){ var iframeHeight = $(window.document.body).height(); $(top.document.body).find("#frmright").height(iframeHeight+30); var diag = new parent.Dialog(); //短信管理按新增按钮时跳转地址 var url = '/nwyj/page/system/newsms/updateUserInfo.html?'+user_id; diag.Title = "用户信息修改页面"; diag.URL = encodeURI(url); // diag.Width =650; diag.Top = "35%"; diag.ID="updateUserInfo"; diag.Height = 450; diag.Width = 800; diag.Left = "50%"; diag.ShowOkButton=false;// 不显示确认按钮 diag.ShowCancelButton=false;// 不显示取消按钮 diag.ButtonAlign = 'center'; diag.show(); diag.addButton("cancle","取消",function(){ diag.innerFrame.contentWindow.cancle(); $(top.document.body).find("#frmright").height(iframeHeight+30); }); diag.addButton("save","保存",function(){ diag.innerFrame.contentWindow.save(); $(top.document.body).find("#frmright").height(iframeHeight+30); }); diag.addButton("reset","重置",function(){ diag.innerFrame.contentWindow.reset(); $(top.document.body).find("#frmright").height(iframeHeight+30); }); } function showSendData(type){ var iframeHeight = $(window.document.body).height(); $(top.document.body).find("#frmright").height(iframeHeight+30); var diag = new parent.Dialog(); //短信管理按新增按钮时跳转地址 var url = '/nwyj/page/system/newsms/showMsgInfo.html?'+user_id+"?"+type; diag.Title = "短信发送情况"; diag.URL = encodeURI(url); // diag.Width =650; diag.Top = "35%"; diag.ID="updateUserInfo"; diag.Height = 493; diag.Width = 1030; diag.Left = "50%"; diag.ShowOkButton=false;// 不显示确认按钮 diag.ShowCancelButton=false;// 不显示取消按钮 diag.ButtonAlign = 'center'; diag.show(); diag.addButton("cancle","确定",function(){ diag.close(); $(top.document.body).find("#frmright").height(iframeHeight+30); }); } function showReceiveData(type){ var iframeHeight = $(window.document.body).height(); $(top.document.body).find("#frmright").height(iframeHeight+30); var diag = new parent.Dialog(); //短信管理按新增按钮时跳转地址 var url = '/nwyj/page/system/newsms/showMsgInfo.html?'+user_id+"?"+type; diag.Title = "短信接收情况"; diag.URL = encodeURI(url); // diag.Width =650; diag.Top = "35%"; diag.ID="updateUserInfo"; diag.Height = 493; diag.Width = 1030; diag.Left = "50%"; diag.ShowOkButton=false;// 不显示确认按钮 diag.ShowCancelButton=false;// 不显示取消按钮 diag.ButtonAlign = 'center'; diag.show(); diag.addButton("cancle","确定",function(){ diag.close(); $(top.document.body).find("#frmright").height(iframeHeight+30); }); }