7d84b3f634c797edec564f99e920984cf02fa660.svn-base 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  2. var checkPage ="";
  3. function initComplete(){
  4. //绑定选项卡点击事件
  5. $("#basicTab1").bind("actived", function(e, i) {
  6. $("#checkPage").val("");
  7. $("#checkPage").val(i);
  8. checkPage = i;
  9. if(i==0){
  10. $("#queryInput3").val("");
  11. $("#cylxz").hide();
  12. $("#cylxz").find("ul").empty();
  13. $("#org_inner3").show();
  14. initTree2();
  15. }
  16. if(i==1){
  17. $("#queryInput1").val("");
  18. $("#cylxr").hide();
  19. $("#cylxr").find("ul").empty();
  20. $("#org_inner1").show();
  21. initTree();
  22. //常用联系组
  23. $("#queryInput3").on("keyup",function(){
  24. var val = $("#queryInput3").val().trim();
  25. //var patt=/^(13|14|15|18)\d+$/i;
  26. if(val.length==0){
  27. $("#cylxz").hide();
  28. $("#org_inner3").show();
  29. }
  30. var pattern = new RegExp("[`~!@#$^&*()=|{}:;,\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“。,、?]");
  31. if(val==""||val==null||val=="null"){
  32. return;
  33. }
  34. /*if(!isNaN(val)&&val=="1"||!isNaN(val)&&!patt.test(val)){
  35. return;
  36. }*/
  37. else if(isNaN(val)&&pattern.test(val)){
  38. top.Dialog.alert("不能输入非法字符");
  39. return;
  40. }else{
  41. $.ajax({
  42. url : $.pathname()+'/ws/ContactTree/ContactTreeService/getGroupPeole/',
  43. type : 'post',
  44. data : {
  45. con:val,
  46. userId:user_id
  47. },
  48. dataType : 'json',
  49. timeout : 60000,
  50. success : function(data){
  51. $("#cylxz").find("ul").empty();
  52. var getPep = data.treeNodes;
  53. if(getPep.length>0){
  54. for(var i=0;i<getPep.length;i++){
  55. $("#cylxz").find("ul").append("<li class=_lis id="+getPep[i].value+"_"+i+" title="+getPep[i].value+">"+getPep[i].key+"</li>");
  56. }
  57. }else{
  58. $("#cylxz").find("ul").append("<li class=_lis>没有符合查询条件的人员</li>");
  59. }
  60. $("#cylxz").show();
  61. $("#org_inner3").hide();
  62. },
  63. error : function(){
  64. top.Dialog.alert('操作失败');
  65. }
  66. });
  67. }
  68. });
  69. }
  70. });
  71. //初始化时显示常用联系人树
  72. initTree2();
  73. //常用联系人
  74. $("#queryInput1").on("keyup",function(){
  75. var val = $("#queryInput1").val().trim();
  76. // var patt=/^(13|14|15|18)\d+$/i;
  77. if(val.length==0){
  78. $("#cylxr").hide();
  79. $("#org_inner1").show();
  80. }
  81. var pattern = new RegExp("[`~!@#$^&*()=|{}:;,\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“。,、?]");
  82. if(val==""||val==null||val=="null"){
  83. return;
  84. }
  85. /*if(!isNaN(val)&&val=="1"||!isNaN(val)&&!patt.test(val)){
  86. return;
  87. }*/
  88. else if(isNaN(val)&&pattern.test(val)){
  89. top.Dialog.alert("不能输入非法字符");
  90. return;
  91. }else{
  92. $.ajax({
  93. url : $.pathname()+'/ws/ContactTree/ContactTreeService/getContactPeople/',
  94. type : 'post',
  95. data : {
  96. con:val,
  97. userId:user_id
  98. },
  99. dataType : 'json',
  100. timeout : 60000,
  101. success : function(data){
  102. $("#cylxr").find("ul").empty();
  103. var getPep = data.treeNodes;
  104. if(getPep.length>0){
  105. for(var i=0;i<getPep.length;i++){
  106. $("#cylxr").find("ul").append("<li class=_lis id="+getPep[i].value+"_"+i+" title="+getPep[i].value+">"+getPep[i].key+"</li>");
  107. }
  108. }else{
  109. $("#cylxr").find("ul").append("<li class=_lis>没有符合查询条件的人员</li>");
  110. }
  111. $("#cylxr").show();
  112. $("#org_inner1").hide();
  113. },
  114. error : function(){
  115. top.Dialog.alert('操作失败');
  116. }
  117. });
  118. }
  119. });
  120. }
  121. function initTree(){
  122. var setting3 = {
  123. async : {
  124. enable : true,
  125. dataType : 'JSON',
  126. contentType : "application/json",
  127. dataName : 'treeNodes',
  128. url : $.pathname()+'/ws/ContactTree/ContactTreeService/getContactGroupTree/',
  129. autoParam : [ "id" ],
  130. otherParam : [ "userId", user_id]
  131. }
  132. };
  133. $.fn.zTree.init($("#myTree3"), setting3);
  134. }
  135. function initTree2(){
  136. var setting1 = {
  137. async : {
  138. enable : true,
  139. dataType : 'JSON',
  140. contentType : "application/json",
  141. dataName : 'treeNodes',
  142. url : $.pathname()+'/ws/ContactTree/ContactTreeService/getCyPeopleTree/',
  143. autoParam : [ "id" ],
  144. otherParam : [ "userId", user_id]
  145. }
  146. };
  147. $.fn.zTree.init($("#myTree1"), setting1);
  148. }
  149. function addCommonOrg(){
  150. var text = /^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/i;
  151. var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
  152. var tel="";
  153. var name ="";
  154. var contactpep="";
  155. $('#groupname').val("");
  156. $('#grouppeople').val("");
  157. $("#contactpep").val("");
  158. if(arguments.length!=0){
  159. if(checkPage==1){
  160. //常用联系组
  161. for(var i=0;i<arguments.length;i++){
  162. if(text.test(arguments[i])){
  163. tel +=arguments[i]+";";
  164. }else{
  165. name = arguments[i];
  166. }
  167. }
  168. tel = tel.substring(0, tel.lastIndexOf(";"));
  169. $('#groupname').val(name);
  170. $('#grouppeople').val(tel);
  171. }else{
  172. //常用联系人
  173. for(var k=0;k<arguments.length;k++){
  174. contactpep +=arguments[k]+";";
  175. }
  176. contactpep = contactpep.substring(0, contactpep.lastIndexOf(";"));
  177. $("#contactpep").val(contactpep);
  178. }
  179. }else{
  180. $('#grouppeople').val("");
  181. $("#contactpep").val("");
  182. if(checkPage==1){
  183. var newName = top.document.getElementById("_DialogFrame_addName").contentWindow.document.getElementById('newName').value;
  184. if(newName.trim()==""){
  185. top.Dialog.alert("请输入新增的组名");
  186. return;
  187. }else if(pattern.test(newName)){
  188. top.Dialog.alert("组名不能含有特殊字符");
  189. return;
  190. }
  191. else{
  192. $('#groupname').val(newName);
  193. $(parent.document.body).find("#_ButtonClose_addName").click();
  194. }
  195. }
  196. }
  197. var url = "/nwyj/page/system/sms/AddContactPeople.html";
  198. var diag = new top.Dialog();
  199. diag.Title = "添加常用联系人";
  200. diag.URL = encodeURI(url);
  201. diag.ID="ContactPeople";
  202. diag.Height = 500;
  203. diag.Width = 650;
  204. diag.Left = "50%";
  205. diag.Top = "20%";
  206. diag.ShowOkButton=false;// 不显示确认按钮
  207. diag.ShowCancelButton=false;// 不显示取消按钮
  208. diag.ButtonAlign = 'center';
  209. diag.show();
  210. diag.addButton("no","关闭",function(){
  211. top.document.getElementById("_DialogFrame_ContactPeople").contentWindow.cancle();
  212. });
  213. diag.addButton("yes","确定",function(){
  214. top.document.getElementById("_DialogFrame_ContactPeople").contentWindow.savePeople();
  215. });
  216. return false;
  217. }
  218. function addName(val){
  219. var url = "/nwyj/page/system/sms/addName.html";
  220. var diag = new top.Dialog();
  221. diag.Title = "新增常用组";
  222. diag.URL = encodeURI(url);
  223. diag.ID="addName";
  224. diag.Height =80;
  225. diag.Width = 500;
  226. diag.Left = "50%";
  227. diag.Top = "50%";
  228. diag.ShowOkButton=false;// 不显示确认按钮
  229. diag.ShowCancelButton=false;// 不显示取消按钮
  230. diag.ButtonAlign = 'center';
  231. diag.show();
  232. diag.addButton("noadd","取消",function(){
  233. top.Dialog.confirm("确定取消?|取消",function(){
  234. $(parent.document.body).find("#_ButtonClose_addName").click();
  235. });
  236. });
  237. diag.addButton("yesadd","确定",function(){
  238. var newName = top.document.getElementById("_DialogFrame_addName").contentWindow.document.getElementById('newName').value;
  239. if(val!=""){
  240. var namesArr = val.split(",");
  241. for(var i=0;i<namesArr.length;i++){
  242. if(namesArr[i]==newName){
  243. top.Dialog.alert("该组名已存在,请另起组名");
  244. return;
  245. }
  246. }
  247. }
  248. /* $(parent.document.body).find("#_ButtonClose_addName").click();*/
  249. top.document.getElementById("_DialogFrame_addContactPeople").contentWindow.addCommonOrg();
  250. });
  251. return false;
  252. }