123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- 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 = $("<li title='勾选状态为给该手机号发送短信,反之不给该手机号发送短信'><label for=default_phone'"+i+"'>"+default_phone+"<input type='checkbox' disabled='disabled' checked='checked' name='phone' id='"+default_phone+"' value='"+default_phone+"' />默认</label></li>");
- $ul.append($li);
- }
- if(receive_phones!=""&&receive_phones!=undefined&&receive_phones!=null){
- for(var i=0;i<receive_phone.length;i++){
- if(receive_phone[i]==default_phone){
- continue;
- }
- var $li = $("<li title='勾选状态为给该手机号发送短信,反之不给该手机号发送短信'><label for=receive_phone'"+i+"'>"+receive_phone[i]+"<input type='checkbox' disabled='disabled' checked='checked' name='phone' id='"+receive_phone[i]+"' value='"+receive_phone[i]+"' /></label></li>");
- $ul.append($li);
- }
- }
- if(all_phones!=""&&all_phones!=undefined&&all_phones!=null){
- for(var i=0;i<all_phone.length;i++){
- if(receive_phones.indexOf(all_phone[i])>-1){
- continue;
- }
- var $li = $("<li title='勾选状态为给该手机号发送短信,反之不给该手机号发送短信'><label for=all_phone'"+i+"'>"+all_phone[i]+"<input type='checkbox' disabled='disabled' name='phone' id='"+all_phone[i]+"' value='"+all_phone[i]+"' /></label></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 "<a href='javascript:;' style='height:100%,width:100%,display:block,title ='"+value+"'' onclick =' getDetailByTask("+rowindex+",1"+")'>"+value+"</a>";
- }
- },
- //{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 "<div style='color:red'>"+value+"</div>";
- }
- }
- },
- {display:'发送内容', name:'msg_content', align:'center',width:'10%',
- render:function(rowdata, rowindex, value, column){
- value = value.replace(/引号/g,"\"").replace(/<br>/g,"\n").replace(/斜杠/g,"\\");
- return "<div title = '"+value+"'>"+value+"</div>";
- }
- }
- ],
- 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 "<a href='javascript:;' style='height:100%,width:100%,display:block,title ='"+value+"'' onclick = 'getDetailByTask("+rowindex+",2"+")'>"+value+"</a>";
- }
- },
- //{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(/<br>/g,"\n").replace(/斜杠/g,"\\");
- return "<div title = '"+value+"'>"+value+"</div>";
- }
- }
- ],
- 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);
- });
- }
|