9ca25300dfa7514c31f71daa8a85aa4c8cbf1866.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. var user_id=top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  2. var login_name=top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  3. var real_name=top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  4. var user_corp=top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  5. var user_dept=top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  6. var user_deptId=top.com.sinosoft.lz.system.user.LoginInfo.getDept_id();
  7. var sendGrid = null;
  8. var receiveGrid = null;
  9. //var gridData = {"pager.pageNo":2,"pager.totalRows":0,"rows" : []};//用于表格初始化
  10. //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":"是打发"}]};
  11. /*
  12. * 初始化
  13. */
  14. $(function(){
  15. //监听
  16. $("#sendMsg").live("click",function(){
  17. $("#frmright",window.parent.document).attr("src","/nwyj/page/system/newsms/sendMsg.html");
  18. });
  19. $("#contact").live("click",showContact);
  20. $("#updateUserInfo").live("click",updateUserInfo);
  21. //获取部门
  22. var org=getDeptName(user_deptId);
  23. //手机号码赋值
  24. getPhone(user_id);
  25. //获取表格数据
  26. var sendData = getSendData();
  27. var receiveData = getReceiveData();
  28. //加载表格
  29. initGrid(sendData,receiveData);
  30. //获取任务及短信数量
  31. var numData = getNum();
  32. /*
  33. * 页面赋值
  34. */
  35. $("#user_name").html(real_name);
  36. $("#login_name").html(login_name);
  37. $("#org").html(user_corp+"/"+org);
  38. $("#sTaskNum").text(numData.sTaskNum);
  39. $("#rTaskNum").text(numData.rTaskNum);
  40. $("#sMsgNum").text(numData.sMsgNum);
  41. $("#rMsgNum").text(numData.rMsgNum);
  42. });
  43. /*
  44. * 获取组织
  45. */
  46. function getDeptName(id) {
  47. var rsl = "";
  48. $.ajax({
  49. url : "/nwyj/ws/InDepartmentService/InDepartmentService/getDeptById/",
  50. type : 'post',
  51. timeout : 60000,
  52. data : {
  53. id : id
  54. },
  55. dataType : 'json',
  56. async : false,
  57. success : function(data) {
  58. rsl = data.DEPT_NAME;
  59. }
  60. });
  61. return rsl;
  62. }
  63. /*
  64. * 获取手机号
  65. */
  66. function getPhone(user_id){
  67. $.ajax({
  68. data:{
  69. "user_id":user_id
  70. },
  71. type:'post',
  72. timeout:60000,
  73. dataType:'json',
  74. url:"/nwyj/ws/newsendsms/NewSendSmsService/getPhone",
  75. success:function(data){
  76. setPhone(data);
  77. },
  78. error:function(){
  79. top.Dialog.alert("获取手机号失败!");
  80. }
  81. });
  82. }
  83. /*
  84. * 设置手机号
  85. */
  86. function setPhone(data){
  87. var $ul = $(".user_phone").find("ul");
  88. var default_phone = data.default_phone;
  89. var receive_phones = data.receive_phone;
  90. var all_phones = data.all_phone;
  91. var receive_phone = receive_phones.split(",");
  92. var all_phone = all_phones.split(",");
  93. if(default_phone!=""&&default_phone!=undefined&&default_phone!=null){
  94. 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>");
  95. $ul.append($li);
  96. }
  97. if(receive_phones!=""&&receive_phones!=undefined&&receive_phones!=null){
  98. for(var i=0;i<receive_phone.length;i++){
  99. if(receive_phone[i]==default_phone){
  100. continue;
  101. }
  102. 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>");
  103. $ul.append($li);
  104. }
  105. }
  106. if(all_phones!=""&&all_phones!=undefined&&all_phones!=null){
  107. for(var i=0;i<all_phone.length;i++){
  108. if(receive_phones.indexOf(all_phone[i])>-1){
  109. continue;
  110. }
  111. 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>");
  112. $ul.append($li);
  113. }
  114. }
  115. }
  116. /*
  117. * 初始化表格
  118. */
  119. function initGrid(sendData,receiveData){
  120. //短信发送情况表
  121. sendGrid =$("#msgSend").quiGrid({
  122. columns:[
  123. {display:'任务id',name:'fd_objectId',hide:true},
  124. {display:'任务名称', name:'task_name', align:'center',width:'20%',
  125. render:function(rowdata, rowindex, value, column){
  126. value = value.replace(/引号/g,"\"");
  127. return "<a href='javascript:;' style='height:100%,width:100%,display:block,title ='"+value+"'' onclick =' getDetailByTask("+rowindex+",1"+")'>"+value+"</a>";
  128. }
  129. },
  130. //{display:'突发事件名称', name:'event_id', align:'center',width:'20%'},
  131. {display:'模块名称', name:'module', align:'center',width:'25%'},
  132. {display:'发送方式', name:'send_type', align:'center',width:'15%'},
  133. {display:'发送时间', name:'send_time', align:'center',width:'20%'},
  134. {display:'发送结果', name:'send_result', align:'center',width:'10%',
  135. render:function(rowdata, rowindex, value, column){
  136. var a = value.split("/")[0];
  137. var b = value.split("/")[1];
  138. if(a==b){
  139. return value;
  140. }else{
  141. return "<div style='color:red'>"+value+"</div>";
  142. }
  143. }
  144. },
  145. {display:'发送内容', name:'msg_content', align:'center',width:'10%',
  146. render:function(rowdata, rowindex, value, column){
  147. value = value.replace(/引号/g,"\"").replace(/<br>/g,"\n").replace(/斜杠/g,"\\");
  148. return "<div title = '"+value+"'>"+value+"</div>";
  149. }
  150. }
  151. ],
  152. height:'276px',
  153. //width:'1003px',
  154. toolbar:false,
  155. data:sendData,
  156. pageSize:5,
  157. rownumbers:true,
  158. percentWidthMode:true,
  159. });
  160. //短信接收情况表
  161. receiveGrid = $("#msgReceive").quiGrid({
  162. columns:[
  163. {display:'任务id',name:'fd_objectId',hide:true},
  164. {display:'任务名称', name:'task_name', align:'center',width:'20%',
  165. render:function(rowdata, rowindex, value, column){
  166. value = value.replace(/引号/g,"\"");
  167. return "<a href='javascript:;' style='height:100%,width:100%,display:block,title ='"+value+"'' onclick = 'getDetailByTask("+rowindex+",2"+")'>"+value+"</a>";
  168. }
  169. },
  170. //{display:'突发事件名称', name:'event_id', align:'center',width:'20%'},
  171. {display:'模块名称', name:'module', align:'center',width:'25%'},
  172. {display:'发送方式', name:'send_type', align:'center',width:'15%'},
  173. {display:'发送时间', name:'send_time', align:'center',width:'20%'},
  174. {display:'发送人', name:'recorder_name', align:'center',width:'10%'},
  175. {display:'发送内容', name:'msg_content', align:'center',width:'10%',
  176. render:function(rowdata, rowindex, value, column){
  177. value = value.replace(/引号/g,"\"").replace(/<br>/g,"\n").replace(/斜杠/g,"\\");
  178. return "<div title = '"+value+"'>"+value+"</div>";
  179. }
  180. }
  181. ],
  182. height:'276px',
  183. //width:'1003px',
  184. toolbar:false,
  185. data:receiveData,
  186. pageSize:5,
  187. rownumbers:true,
  188. percentWidthMode:true,
  189. });
  190. }
  191. /*
  192. * 获取短信发送数据
  193. */
  194. function getSendData(){
  195. var data = null ;
  196. $.ajax({
  197. data:{"user_id":user_id},
  198. type:'post',
  199. timeout:60000,
  200. dataType:'json',
  201. url:"/nwyj/ws/newsendsms/NewSendSmsService/getSendData",
  202. async:false,
  203. success:function(result){
  204. data = result;
  205. console.log(JSON.stringify(data));
  206. },
  207. error:function(result){
  208. console.log(JSON.stringify(result));
  209. top.Dialog.alert("获取短信发送数据失败");
  210. }
  211. });
  212. return data;
  213. }
  214. /*
  215. * 获取短信接收数据
  216. */
  217. function getReceiveData(){
  218. var data = null ;
  219. $.ajax({
  220. data:{"user_id":user_id},
  221. type:'post',
  222. timeout:60000,
  223. dataType:'json',
  224. url:"/nwyj/ws/newsendsms/NewSendSmsService/getReceiveData",
  225. async:false,
  226. success:function(result){
  227. data = result;
  228. },
  229. error:function(result){
  230. console.log(JSON.stringify(result));
  231. top.Dialog.alert("获取短信接收数据失败");
  232. }
  233. });
  234. return data;
  235. }
  236. /*
  237. * 根据任务名钻取
  238. */
  239. function getDetailByTask(rowindex,type){//发送
  240. var task_id="";
  241. var send_type = "";
  242. if(type=="1"){
  243. task_id = sendGrid.getRow(rowindex).fd_objectId;
  244. send_type = sendGrid.getRow(rowindex).send_type;
  245. }else{
  246. task_id = receiveGrid.getRow(rowindex).fd_objectId;
  247. send_type = receiveGrid.getRow(rowindex).send_type;
  248. }
  249. if(send_type=="人工手动发送"){
  250. send_type=1;
  251. }else{
  252. send_type=2;
  253. }
  254. $("#frmright",window.parent.document).attr("src","/nwyj/page/system/newsms/msg_detail.html?"+task_id+"?"+send_type);
  255. }
  256. /*
  257. * 根据user_id钻取
  258. */
  259. function getDetailByUser(user_id,type){//发送
  260. $("#frmright",window.parent.document).attr("src","?"+user_id+"?"+type);
  261. }
  262. /*
  263. * 获取任务及短信数量
  264. */
  265. function getNum(){
  266. var numData = null;
  267. $.ajax({
  268. data:{
  269. "user_id":user_id
  270. },
  271. type:'post',
  272. timeout:60000,
  273. dataType:'json',
  274. url:"/nwyj/ws/newsendsms/NewSendSmsService/getNumData",
  275. async:false,
  276. success:function(data){
  277. numData = data;
  278. },
  279. error:function(){
  280. top.Dialog.alert("获取任务及短数量失败");
  281. }
  282. });
  283. return numData;
  284. }
  285. /*
  286. * 显示通讯录
  287. */
  288. function showContact(user_id){
  289. var iframeHeight = $(window.document.body).height();
  290. $(top.document.body).find("#frmright").height(iframeHeight+30);
  291. var diag = new parent.Dialog();
  292. //短信管理按新增按钮时跳转地址
  293. var url = '/nwyj/page/system/newsms/contactNew.html';
  294. diag.Title = "通讯录";
  295. diag.URL = encodeURI(url);
  296. // diag.Width =650;
  297. diag.Top = "30%";
  298. diag.ID="addPeople";
  299. diag.Height = 520;
  300. diag.Width = 1150;
  301. /* diag.Top = "80%";*/
  302. diag.Left = "50%";
  303. diag.ShowOkButton=false;// 不显示确认按钮
  304. diag.ShowCancelButton=false;// 不显示取消按钮
  305. diag.ButtonAlign = 'center';
  306. diag.show();
  307. }
  308. function updateUserInfo(){
  309. var iframeHeight = $(window.document.body).height();
  310. $(top.document.body).find("#frmright").height(iframeHeight+30);
  311. var diag = new parent.Dialog();
  312. //短信管理按新增按钮时跳转地址
  313. var url = '/nwyj/page/system/newsms/updateUserInfo.html?'+user_id;
  314. diag.Title = "用户信息修改页面";
  315. diag.URL = encodeURI(url);
  316. // diag.Width =650;
  317. diag.Top = "35%";
  318. diag.ID="updateUserInfo";
  319. diag.Height = 450;
  320. diag.Width = 800;
  321. diag.Left = "50%";
  322. diag.ShowOkButton=false;// 不显示确认按钮
  323. diag.ShowCancelButton=false;// 不显示取消按钮
  324. diag.ButtonAlign = 'center';
  325. diag.show();
  326. diag.addButton("cancle","取消",function(){
  327. diag.innerFrame.contentWindow.cancle();
  328. $(top.document.body).find("#frmright").height(iframeHeight+30);
  329. });
  330. diag.addButton("save","保存",function(){
  331. diag.innerFrame.contentWindow.save();
  332. $(top.document.body).find("#frmright").height(iframeHeight+30);
  333. });
  334. diag.addButton("reset","重置",function(){
  335. diag.innerFrame.contentWindow.reset();
  336. $(top.document.body).find("#frmright").height(iframeHeight+30);
  337. });
  338. }
  339. function showSendData(type){
  340. var iframeHeight = $(window.document.body).height();
  341. $(top.document.body).find("#frmright").height(iframeHeight+30);
  342. var diag = new parent.Dialog();
  343. //短信管理按新增按钮时跳转地址
  344. var url = '/nwyj/page/system/newsms/showMsgInfo.html?'+user_id+"?"+type;
  345. diag.Title = "短信发送情况";
  346. diag.URL = encodeURI(url);
  347. // diag.Width =650;
  348. diag.Top = "35%";
  349. diag.ID="updateUserInfo";
  350. diag.Height = 493;
  351. diag.Width = 1030;
  352. diag.Left = "50%";
  353. diag.ShowOkButton=false;// 不显示确认按钮
  354. diag.ShowCancelButton=false;// 不显示取消按钮
  355. diag.ButtonAlign = 'center';
  356. diag.show();
  357. diag.addButton("cancle","确定",function(){
  358. diag.close();
  359. $(top.document.body).find("#frmright").height(iframeHeight+30);
  360. });
  361. }
  362. function showReceiveData(type){
  363. var iframeHeight = $(window.document.body).height();
  364. $(top.document.body).find("#frmright").height(iframeHeight+30);
  365. var diag = new parent.Dialog();
  366. //短信管理按新增按钮时跳转地址
  367. var url = '/nwyj/page/system/newsms/showMsgInfo.html?'+user_id+"?"+type;
  368. diag.Title = "短信接收情况";
  369. diag.URL = encodeURI(url);
  370. // diag.Width =650;
  371. diag.Top = "35%";
  372. diag.ID="updateUserInfo";
  373. diag.Height = 493;
  374. diag.Width = 1030;
  375. diag.Left = "50%";
  376. diag.ShowOkButton=false;// 不显示确认按钮
  377. diag.ShowCancelButton=false;// 不显示取消按钮
  378. diag.ButtonAlign = 'center';
  379. diag.show();
  380. diag.addButton("cancle","确定",function(){
  381. diag.close();
  382. $(top.document.body).find("#frmright").height(iframeHeight+30);
  383. });
  384. }