build.js 8.4 KB

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