build.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /**
  2. * Created by MyPC on 2019/11/11.
  3. */
  4. var mobile2InfoTimeout = null;
  5. var searchCuringTimeout = null;
  6. var mobile='';
  7. var getClentListTimeout = null;
  8. var clientname='';
  9. var columnLength=8;
  10. //获得CLD客户list数据
  11. function getClentList(){
  12. if(!isExistence(clientname)){
  13. console.log('参数错误');
  14. return ;
  15. }
  16. $.ajax({
  17. cache :false,
  18. type: 'GET',
  19. url: '/contacts/client/ajax/getClentList',
  20. data: { clientname: encodeURI(clientname) },
  21. dataType: 'json',
  22. success: function(data){
  23. if(data.status==1){
  24. var html=buildClientBySearch(data.list);
  25. $('div[searchClient] curingClient').html(html);
  26. }else {
  27. console.log(data.msg);
  28. }
  29. },
  30. error: function(xhr, type){
  31. console.log('Ajax error!')
  32. }
  33. })
  34. }
  35. /**
  36. * 用户升级专业版 弹框提示--用户详情界面
  37. * @param name
  38. * @param _id
  39. * @param username
  40. * @returns
  41. */
  42. function upCuring(name,_id,username){
  43. $('#name').val(name);
  44. $('#_id').val(_id);
  45. var curingMobile=$('#curingMobile').val();
  46. var html='为用户 <b>'+curingMobile+','+username+'</b> 升级 <b>'+name+'</b>';
  47. $('div[upCuring] span').html(html);
  48. }
  49. $(document).ready(function(){
  50. init();
  51. })
  52. $(function() {
  53. //------用户列表界面相关----------
  54. /**
  55. * 绑定分页-点击事件-刷新用户列表和分页列表
  56. * parameter 传递参数
  57. * currentPage
  58. */
  59. $('div[pageDetail]').delegate( 'a','click', function(){
  60. // 只获取第一个选中的值
  61. var parameter = $(this).attr('parameter');
  62. var currentPage = $(this).attr('currentPage');
  63. $('button[closeRefresh]').attr('currentPage',currentPage);
  64. $('button[closeRefresh]').attr('parameter',parameter);
  65. refreshCuringPagination(parameter,currentPage);
  66. });
  67. /**
  68. * 编办下拉选择
  69. */
  70. $('select[curingByCompilation]').on('change', function(e){
  71. var compilation=$(this).val();
  72. var latestCompilation=$('select[curingByLatestCompilation]').val();
  73. refreshCuringPage(compilation,latestCompilation);
  74. });
  75. $('select[curingByLatestCompilation]').on('change', function(e){
  76. var latestCompilation=$(this).val();
  77. var compilation=$('select[curingByCompilation]').val();
  78. refreshCuringPage(compilation,latestCompilation);
  79. });
  80. /**
  81. * 用户列表排序相关
  82. */
  83. $('input[type=radio][name=sortField]').on('change', function(e){
  84. var sortField=$(this).attr('data');
  85. var latestCompilation=$('select[curingByLatestCompilation]').val();
  86. var compilation=$('select[curingByCompilation]').val();
  87. refreshCuringPage(compilation,latestCompilation,sortField);
  88. });
  89. $('input[type=radio][name=sort]').on('change', function(e){
  90. var sort=$(this).attr('data');
  91. var latestCompilation=$('select[curingByLatestCompilation]').val();
  92. var compilation=$('select[curingByCompilation]').val();
  93. refreshCuringPage(compilation,latestCompilation,'',sort);
  94. });
  95. /**
  96. * 通行证账号检索养护用户--缓冲300
  97. */
  98. $('input[mobile2Info]').on('keyup', function(e){
  99. if(mobile2InfoTimeout != null){
  100. clearTimeout(mobile2InfoTimeout);
  101. }
  102. mobile = $(this).val();
  103. if((/^1[34578]\d{9}$/.test(mobile))) {
  104. mobile2InfoTimeout = setTimeout(fnMobile2Info, 300);
  105. }
  106. });
  107. //--------------用户详情界面相关---------
  108. /**
  109. * 动态绑定养护用户列表 打开用户详情页面事件
  110. * ssoid
  111. * id
  112. * client_id
  113. */
  114. var coordinate = {};
  115. var ssoid='',client_id='';
  116. $('tbody[curingUser]').delegate( 'tr','mousedown', function(e){
  117. coordinate.x= e.pageX;
  118. coordinate.y= e.pageY;
  119. ssoid = $(this).attr('data');
  120. client_id=$(this).attr('dataCid');
  121. }).click(function(e){
  122. if(coordinate.x==e.pageX&&coordinate.y==e.pageY){
  123. $(this).attr('data-toggle',' ');
  124. refreshCuringPageDetail(ssoid,client_id);
  125. }
  126. });
  127. /**
  128. * 确定升级专业版--用户详情界面
  129. */
  130. $('button[upCuringDo]').on('click', function(e){
  131. // 只获取第一个选中的值
  132. var compilationId = $('#_id').val();
  133. var name = $('#name').val();
  134. var curingSsoid = $('#curingSsoid').val();
  135. var mobile = $('#curingMobile').val();
  136. var client_id = $('#client_id').val();
  137. if (curingSsoid != '' && compilationId != '') {
  138. $.ajax({
  139. cache :false,
  140. type: 'post',
  141. url: '/cloud/curing/ajax/upCuringDo',
  142. data: {ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name},
  143. dataType: 'json',
  144. success: function(data) {
  145. if (data.status == 1) {
  146. refreshCuringPageDetail(curingSsoid,client_id);
  147. } else {
  148. alert(data.msg);
  149. }
  150. }
  151. })
  152. } else {
  153. alert('请选择需要升级的版本');
  154. }
  155. });
  156. /**
  157. * 用户绑定CLD客户--用户详情页
  158. */
  159. $('div[relevanceClientDo]').delegate( 'span','click', function(){
  160. // 只获取第一个选中的值
  161. var cidKey = $(this).attr('data');
  162. var ssoId = $('#curingSsoid').val();
  163. //var id=$('#id').val();
  164. $.ajax({
  165. cache :false,
  166. type: 'POST',
  167. url: '/cloud/curing/ajax/relevanceClientDo',
  168. data: {cidKey: encodeURI(cidKey),ssoId:encodeURI(ssoId)},
  169. dataType: 'json',
  170. success: function(data){
  171. if(data.status==1){
  172. refreshCuringPageDetail(ssoId,cidKey);
  173. $('#linkcld').modal('hide');
  174. }else{
  175. alert(data.msg);
  176. }
  177. },
  178. error: function(xhr, type){
  179. console.log('Ajax error!')
  180. }
  181. })
  182. });
  183. /**
  184. * 用户取消关联CLD客户--用户详情页
  185. */
  186. $('button[relieveClientDo]').on('click', function(e){
  187. // 只获取第一个选中的值
  188. var cid = $(this).attr('data');
  189. var ssoId = $('#curingSsoid').val();
  190. $('#unlinkcld').modal('hide');
  191. $.ajax({
  192. cache :false,
  193. type: 'POST',
  194. url: '/cloud/curing/ajax/relieveClientDo',
  195. data: {cid: encodeURI(cid),ssoId:encodeURI(ssoId)},
  196. dataType: 'json',
  197. success: function(data){
  198. if(data.status==1){
  199. refreshCuringPageDetail(ssoId,cid);
  200. }else{
  201. alert(data.msg);
  202. }
  203. },
  204. error: function(xhr, type){
  205. console.log('Ajax error!')
  206. }
  207. })
  208. });
  209. /**
  210. * 关闭详情页--刷新用户列表
  211. */
  212. $('button[closeRefresh]').on('click', function(e){
  213. // 只获取第一个选中的值
  214. var parameter=$('button[closeRefresh]').attr('parameter');
  215. if(parameter!=''){
  216. var currentPage=$('button[closeRefresh]').attr('currentPage');
  217. refreshCuringPagination(parameter,currentPage);
  218. }else{
  219. var latestCompilation=$('select[curingByLatestCompilation]').val();
  220. var compilation=$('select[curingByCompilation]').val();
  221. refreshCuringPage(compilation,latestCompilation,'','',mobile);
  222. }
  223. });
  224. //
  225. /**
  226. * 检索cld用户
  227. */
  228. $('input[getClentList]').on('keyup', function(e){
  229. if(getClentListTimeout != null){
  230. clearTimeout(getClentListTimeout);
  231. }
  232. clientname = $(this).val();
  233. if(isExistence(clientname)){
  234. getClentListTimeout = setTimeout(getClentList, 500);
  235. }
  236. });
  237. //列表 号码检索事件绑定
  238. $('div[mobile2Info]').on('click', function(e){
  239. mobile=$('input[mobile2Info]').val();
  240. if(mobile==''){
  241. location.reload()
  242. }
  243. fnMobile2Info();
  244. });
  245. })