123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var checkPage ="";
- function initComplete(){
-
- //绑定选项卡点击事件
- $("#basicTab1").bind("actived", function(e, i) {
- $("#checkPage").val("");
- $("#checkPage").val(i);
- checkPage = i;
- if(i==0){
- $("#queryInput3").val("");
- $("#cylxz").hide();
- $("#cylxz").find("ul").empty();
- $("#org_inner3").show();
- initTree2();
-
- }
- if(i==1){
- $("#queryInput1").val("");
- $("#cylxr").hide();
- $("#cylxr").find("ul").empty();
- $("#org_inner1").show();
- initTree();
- //常用联系组
- $("#queryInput3").on("keyup",function(){
- var val = $("#queryInput3").val().trim();
- //var patt=/^(13|14|15|18)\d+$/i;
- if(val.length==0){
- $("#cylxz").hide();
- $("#org_inner3").show();
- }
-
- var pattern = new RegExp("[`~!@#$^&*()=|{}:;,\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“。,、?]");
- if(val==""||val==null||val=="null"){
- return;
- }
-
- /*if(!isNaN(val)&&val=="1"||!isNaN(val)&&!patt.test(val)){
- return;
- }*/
- else if(isNaN(val)&&pattern.test(val)){
- top.Dialog.alert("不能输入非法字符");
- return;
- }else{
- $.ajax({
- url : $.pathname()+'/ws/ContactTree/ContactTreeService/getGroupPeole/',
- type : 'post',
- data : {
- con:val,
- userId:user_id
- },
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- $("#cylxz").find("ul").empty();
- var getPep = data.treeNodes;
- if(getPep.length>0){
- for(var i=0;i<getPep.length;i++){
- $("#cylxz").find("ul").append("<li class=_lis id="+getPep[i].value+"_"+i+" title="+getPep[i].value+">"+getPep[i].key+"</li>");
- }
- }else{
- $("#cylxz").find("ul").append("<li class=_lis>没有符合查询条件的人员</li>");
- }
- $("#cylxz").show();
- $("#org_inner3").hide();
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- });
- }
- });
-
-
- //初始化时显示常用联系人树
- initTree2();
-
- //常用联系人
- $("#queryInput1").on("keyup",function(){
- var val = $("#queryInput1").val().trim();
- // var patt=/^(13|14|15|18)\d+$/i;
- if(val.length==0){
- $("#cylxr").hide();
- $("#org_inner1").show();
- }
- var pattern = new RegExp("[`~!@#$^&*()=|{}:;,\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“。,、?]");
- if(val==""||val==null||val=="null"){
- return;
- }
-
- /*if(!isNaN(val)&&val=="1"||!isNaN(val)&&!patt.test(val)){
- return;
- }*/
- else if(isNaN(val)&&pattern.test(val)){
- top.Dialog.alert("不能输入非法字符");
- return;
- }else{
- $.ajax({
- url : $.pathname()+'/ws/ContactTree/ContactTreeService/getContactPeople/',
- type : 'post',
- data : {
- con:val,
- userId:user_id
-
- },
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- $("#cylxr").find("ul").empty();
- var getPep = data.treeNodes;
- if(getPep.length>0){
- for(var i=0;i<getPep.length;i++){
- $("#cylxr").find("ul").append("<li class=_lis id="+getPep[i].value+"_"+i+" title="+getPep[i].value+">"+getPep[i].key+"</li>");
- }
- }else{
- $("#cylxr").find("ul").append("<li class=_lis>没有符合查询条件的人员</li>");
- }
- $("#cylxr").show();
- $("#org_inner1").hide();
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- });
-
-
- }
-
- function initTree(){
- var setting3 = {
- async : {
- enable : true,
- dataType : 'JSON',
- contentType : "application/json",
- dataName : 'treeNodes',
- url : $.pathname()+'/ws/ContactTree/ContactTreeService/getContactGroupTree/',
- autoParam : [ "id" ],
- otherParam : [ "userId", user_id]
- }
-
- };
- $.fn.zTree.init($("#myTree3"), setting3);
- }
- function initTree2(){
- var setting1 = {
- async : {
- enable : true,
- dataType : 'JSON',
- contentType : "application/json",
- dataName : 'treeNodes',
- url : $.pathname()+'/ws/ContactTree/ContactTreeService/getCyPeopleTree/',
- autoParam : [ "id" ],
- otherParam : [ "userId", user_id]
- }
-
- };
- $.fn.zTree.init($("#myTree1"), setting1);
- }
- function addCommonOrg(){
- var text = /^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/i;
- var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
- var tel="";
- var name ="";
- var contactpep="";
- $('#groupname').val("");
- $('#grouppeople').val("");
- $("#contactpep").val("");
- if(arguments.length!=0){
- if(checkPage==1){
- //常用联系组
- for(var i=0;i<arguments.length;i++){
- if(text.test(arguments[i])){
- tel +=arguments[i]+";";
- }else{
- name = arguments[i];
- }
- }
- tel = tel.substring(0, tel.lastIndexOf(";"));
- $('#groupname').val(name);
- $('#grouppeople').val(tel);
- }else{
- //常用联系人
- for(var k=0;k<arguments.length;k++){
- contactpep +=arguments[k]+";";
- }
- contactpep = contactpep.substring(0, contactpep.lastIndexOf(";"));
- $("#contactpep").val(contactpep);
- }
- }else{
- $('#grouppeople').val("");
- $("#contactpep").val("");
- if(checkPage==1){
- var newName = top.document.getElementById("_DialogFrame_addName").contentWindow.document.getElementById('newName').value;
- if(newName.trim()==""){
- top.Dialog.alert("请输入新增的组名");
- return;
- }else if(pattern.test(newName)){
- top.Dialog.alert("组名不能含有特殊字符");
- return;
- }
-
- else{
- $('#groupname').val(newName);
- $(parent.document.body).find("#_ButtonClose_addName").click();
- }
- }
-
- }
-
- var url = "/nwyj/page/system/sms/AddContactPeople.html";
- var diag = new top.Dialog();
- diag.Title = "添加常用联系人";
- diag.URL = encodeURI(url);
- diag.ID="ContactPeople";
- diag.Height = 500;
- diag.Width = 650;
- diag.Left = "50%";
- diag.Top = "20%";
- diag.ShowOkButton=false;// 不显示确认按钮
- diag.ShowCancelButton=false;// 不显示取消按钮
- diag.ButtonAlign = 'center';
- diag.show();
- diag.addButton("no","关闭",function(){
- top.document.getElementById("_DialogFrame_ContactPeople").contentWindow.cancle();
- });
- diag.addButton("yes","确定",function(){
- top.document.getElementById("_DialogFrame_ContactPeople").contentWindow.savePeople();
- });
- return false;
-
- }
- function addName(val){
- var url = "/nwyj/page/system/sms/addName.html";
- var diag = new top.Dialog();
- diag.Title = "新增常用组";
- diag.URL = encodeURI(url);
- diag.ID="addName";
- diag.Height =80;
- diag.Width = 500;
- diag.Left = "50%";
- diag.Top = "50%";
- diag.ShowOkButton=false;// 不显示确认按钮
- diag.ShowCancelButton=false;// 不显示取消按钮
- diag.ButtonAlign = 'center';
- diag.show();
- diag.addButton("noadd","取消",function(){
- top.Dialog.confirm("确定取消?|取消",function(){
- $(parent.document.body).find("#_ButtonClose_addName").click();
- });
- });
- diag.addButton("yesadd","确定",function(){
- var newName = top.document.getElementById("_DialogFrame_addName").contentWindow.document.getElementById('newName').value;
- if(val!=""){
- var namesArr = val.split(",");
- for(var i=0;i<namesArr.length;i++){
- if(namesArr[i]==newName){
- top.Dialog.alert("该组名已存在,请另起组名");
- return;
- }
- }
- }
- /* $(parent.document.body).find("#_ButtonClose_addName").click();*/
- top.document.getElementById("_DialogFrame_addContactPeople").contentWindow.addCommonOrg();
- });
- return false;
- }
|