curing.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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. /*function fnSearchCuring(){
  11. searchCuringTimeout = null;
  12. if((/^1[34578]\d{9}$/.test(mobile))){
  13. $.ajax({
  14. cache :false,
  15. type: 'GET',
  16. url: '/cloud/curing/ajax/checkMobile/'+mobile,
  17. //data: { mobile: mobile },
  18. dataType: 'json',
  19. context: $('body'),
  20. success: function(data){
  21. if(data.status==1||data.status==2){
  22. fnGetCuringDetail(data.data.id,data.data.client_id);
  23. }else if(data.status==3){
  24. $('div[upCuringBox]').hide();
  25. $('p[upCuringBox]').show();
  26. }
  27. },
  28. error: function(xhr, type){
  29. console.log('Ajax error!')
  30. }
  31. })
  32. }
  33. }*/
  34. //获得CLD客户list数据
  35. function getClentList(){
  36. if(!isExistence(clientname)){
  37. console.log('参数错误');
  38. return ;
  39. }
  40. $.ajax({
  41. cache :false,
  42. type: 'GET',
  43. url: '/contacts/client/ajax/getClentList',
  44. data: { clientname: encodeURI(clientname) },
  45. dataType: 'json',
  46. async:false,
  47. success: function(data){
  48. if(data.status==1){
  49. var html=buildClientBySearch(data.list);
  50. $('div[searchClient] curingClient').html(html);
  51. }else {
  52. console.log(data.msg);
  53. }
  54. },
  55. error: function(xhr, type){
  56. console.log('Ajax error!')
  57. }
  58. })
  59. }
  60. /**
  61. * 用户升级专业版 弹框提示--用户详情界面
  62. * @param name
  63. * @param _id
  64. * @param username
  65. * @returns
  66. */
  67. function upCuring(name,_id,username){
  68. $('#name').val(name);
  69. $('#_id').val(_id);
  70. var curingMobile=$('#curingMobile').val();
  71. var html='为用户 <b>'+curingMobile+','+username+'</b> 升级 <b>'+name+'</b>';
  72. $('div[upCuring] span').html(html);
  73. }
  74. $(document).ready(function(){
  75. init();
  76. })
  77. $(function() {
  78. //------用户列表界面相关----------
  79. /**
  80. * 绑定分页-点击事件-刷新用户列表和分页列表
  81. * parameter 传递参数
  82. * currentPage
  83. */
  84. $('div[pageDetail]').delegate( 'a','click', function(){
  85. // 只获取第一个选中的值
  86. var parameter = $(this).attr('parameter');
  87. var currentPage = $(this).attr('currentPage');
  88. $('button[closeRefresh]').attr('currentPage',currentPage);
  89. $('button[closeRefresh]').attr('parameter',parameter);
  90. refreshCuringPagination(parameter,currentPage);
  91. });
  92. /**
  93. * 编办下拉选择
  94. */
  95. $('select[curingByCompilation]').on('change', function(e){
  96. var compilation=$(this).val();
  97. var latestCompilation=$('select[curingByLatestCompilation]').val();
  98. refreshCuringPage(compilation,latestCompilation);
  99. });
  100. $('select[curingByLatestCompilation]').on('change', function(e){
  101. var latestCompilation=$(this).val();
  102. var compilation=$('select[curingByCompilation]').val();
  103. refreshCuringPage(compilation,latestCompilation);
  104. });
  105. /**
  106. * 用户列表排序相关
  107. */
  108. $('input[type=radio][name=sortField]').on('change', function(e){
  109. var sortField=$(this).attr('data');
  110. var latestCompilation=$('select[curingByLatestCompilation]').val();
  111. var compilation=$('select[curingByCompilation]').val();
  112. refreshCuringPage(compilation,latestCompilation,sortField);
  113. });
  114. $('input[type=radio][name=sort]').on('change', function(e){
  115. var sort=$(this).attr('data');
  116. var latestCompilation=$('select[curingByLatestCompilation]').val();
  117. var compilation=$('select[curingByCompilation]').val();
  118. refreshCuringPage(compilation,latestCompilation,'',sort);
  119. });
  120. /**
  121. * 通行证账号检索养护用户--缓冲300
  122. */
  123. $('input[mobile2Info]').on('keyup', function(e){
  124. if(mobile2InfoTimeout != null){
  125. clearTimeout(mobile2InfoTimeout);
  126. }
  127. mobile = $(this).val();
  128. console.log(mobile);
  129. //if((/^1[34578]\d{9}$/.test(mobile))) {
  130. mobile2InfoTimeout = setTimeout(fnMobile2Info, 300);
  131. //}
  132. });
  133. //--------------用户详情界面相关---------
  134. /**
  135. * 动态绑定养护用户列表 打开用户详情页面事件
  136. * ssoid
  137. * id
  138. * client_id
  139. */
  140. var coordinate = {};
  141. var ssoid='',client_id='';
  142. $('tbody[curingUser]').delegate( 'tr','mousedown', function(e){
  143. coordinate.x= e.pageX;
  144. coordinate.y= e.pageY;
  145. ssoid = $(this).attr('data');
  146. client_id=$(this).attr('dataCid');
  147. }).click(function(e){
  148. if(coordinate.x==e.pageX&&coordinate.y==e.pageY){
  149. $(this).attr('data-toggle',' ');
  150. refreshCuringPageDetail(ssoid,client_id);
  151. }
  152. });
  153. // $('tbody[curingUser]').delegate( 'tr','mouseup', function(){
  154. // // 只获取第一个选中的值
  155. // var ssoid = $(this).attr('data');
  156. // var client_id=$(this).attr('dataCid')
  157. // $(this).attr('data-toggle',' ');
  158. //
  159. // refreshCuringPageDetail(ssoid,client_id);
  160. //
  161. // });
  162. /**
  163. * 确定升级专业版--用户详情界面
  164. */
  165. $('button[upCuringDo]').on('click', function(e){
  166. // 只获取第一个选中的值
  167. var compilationId = $('#_id').val();
  168. var name = $('#name').val();
  169. var curingSsoid = $('#curingSsoid').val();
  170. var mobile = $('#curingMobile').val();
  171. var client_id = $('#client_id').val();
  172. if (curingSsoid != '' && compilationId != '') {
  173. $.ajax({
  174. cache :false,
  175. type: 'post',
  176. url: '/cloud/curing/ajax/upCuringDo',
  177. data: {ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name},
  178. dataType: 'json',
  179. success: function(data) {
  180. if (data.status == 1) {
  181. refreshCuringPageDetail(curingSsoid,client_id);
  182. } else {
  183. alert(data.msg);
  184. }
  185. }
  186. })
  187. } else {
  188. alert('请选择需要升级的版本');
  189. }
  190. });
  191. /**
  192. * 用户绑定CLD客户--用户详情页
  193. */
  194. $('div[relevanceClientDo]').delegate( 'span','click', function(){
  195. // 只获取第一个选中的值
  196. var cidKey = $(this).attr('data');
  197. var ssoId = $('#curingSsoid').val();
  198. //var id=$('#id').val();
  199. $.ajax({
  200. cache :false,
  201. type: 'POST',
  202. url: '/cloud/curing/ajax/relevanceClientDo',
  203. data: {cidKey: encodeURI(cidKey),ssoId:encodeURI(ssoId)},
  204. dataType: 'json',
  205. success: function(data){
  206. if(data.status==1){
  207. refreshCuringPageDetail(ssoId,cidKey);
  208. $('#linkcld').modal('hide');
  209. }else{
  210. alert(data.msg);
  211. }
  212. },
  213. error: function(xhr, type){
  214. console.log('Ajax error!')
  215. }
  216. })
  217. });
  218. /**
  219. * 用户取消关联CLD客户--用户详情页
  220. */
  221. $('button[relieveClientDo]').on('click', function(e){
  222. // 只获取第一个选中的值
  223. var cid = $(this).attr('data');
  224. var ssoId = $('#curingSsoid').val();
  225. $('#unlinkcld').modal('hide');
  226. $.ajax({
  227. cache :false,
  228. type: 'POST',
  229. url: '/cloud/curing/ajax/relieveClientDo',
  230. data: {cid: encodeURI(cid),ssoId:encodeURI(ssoId)},
  231. dataType: 'json',
  232. success: function(data){
  233. if(data.status==1){
  234. refreshCuringPageDetail(ssoId,cid);
  235. }else{
  236. alert(data.msg);
  237. }
  238. },
  239. error: function(xhr, type){
  240. console.log('Ajax error!')
  241. }
  242. })
  243. });
  244. /**
  245. * 关闭详情页--刷新用户列表
  246. */
  247. $('button[closeRefresh]').on('click', function(e){
  248. // 只获取第一个选中的值
  249. var parameter=$('button[closeRefresh]').attr('parameter');
  250. if(parameter!=''){
  251. var currentPage=$('button[closeRefresh]').attr('currentPage');
  252. refreshCuringPagination(parameter,currentPage);
  253. }else{
  254. var latestCompilation=$('select[curingByLatestCompilation]').val();
  255. var compilation=$('select[curingByCompilation]').val();
  256. refreshCuringPage(compilation,latestCompilation,'','',mobile);
  257. }
  258. });
  259. //
  260. /**
  261. * 检索cld用户
  262. */
  263. $('input[getClentList]').on('keyup', function(e){
  264. if(getClentListTimeout != null){
  265. clearTimeout(getClentListTimeout);
  266. }
  267. clientname = $(this).val();
  268. if(isExistence(clientname)){
  269. getClentListTimeout = setTimeout(getClentList, 500);
  270. }
  271. });
  272. //列表 号码检索事件绑定
  273. $('div[mobile2Info]').on('click', function(e){
  274. mobile=$('input[mobile2Info]').val();
  275. if(mobile==''){
  276. location.reload()
  277. }
  278. fnMobile2Info();
  279. });
  280. /*
  281. $('a[upNewClient]').on('click', function(e){
  282. $('input[fnsearchcuring]').val('');
  283. $('div[upCuringBox]').hide();
  284. $('p[upCuringBox]').hide();
  285. });
  286. $('input[fnSearchCuring]').on('keyup', function(e){
  287. if(searchCuringTimeout != null){
  288. clearTimeout(searchCuringTimeout);
  289. }
  290. mobile=$(this).val();
  291. if((/^1[34578]\d{9}$/.test(mobile))) {
  292. searchCuringTimeout = setTimeout(fnSearchCuring, 500);
  293. }
  294. });
  295. $('a[upClient]').on('click', function(e){
  296. var mobile=$('b[curingMobile]').html();
  297. if(mobile==''){
  298. alert('参数错误');
  299. }
  300. $.ajax({
  301. cache :false,
  302. type: 'GET',
  303. url: '/cloud/curing/ajax/checkMobile/'+mobile,
  304. //data: { mobile: mobile },
  305. dataType: 'json',
  306. success: function(data){
  307. if(data.status==1||data.status==2){
  308. $('input[fnsearchcuring]').val(mobile);
  309. fnGetCuringDetail(data.data.id,data.data.client_id);
  310. }else if(data.status==3){
  311. $('div[upCuringBox]').hide();
  312. $('p[upCuringBox]').show();
  313. }
  314. },
  315. error: function(xhr, type){
  316. console.log('Ajax error!')
  317. }
  318. })
  319. });*/
  320. })
  321. //构建升级用户信息--预计废弃
  322. /*function fnGetCuringDetail(ssoid,client_id){
  323. $('tbody[upMajorBox]').html('');
  324. $('#curingSsoid').val('');
  325. $('#curingMobile').val('');
  326. $('#client_id').val('');
  327. $('#name').val('');
  328. $('#_id').val('');
  329. $.ajax({
  330. cache :false,
  331. type: 'GET',
  332. url: '/cloud/curing/ajax/getCuringBySsoid',
  333. data: {ssoid: ssoid, client_id: client_id},
  334. dataType: 'json',
  335. context: $('body'),
  336. success: function(data){
  337. if(data.status==1||data.status==2){
  338. $('div[upCuringBox]').show();
  339. $('p[upCuringBox]').hide();
  340. var objHtml=buildCuringInfo(data.detail.userInfo);
  341. $('div[curingInfo] curing').html(objHtml);
  342. var upMajorBoxHtml=buildCuringCompilation(data);
  343. $('tbody[upMajorBox]').html(upMajorBoxHtml);
  344. var operateLogHtml=buildCuringOperateLog(data.detail.operateLog);
  345. $('div[operateLog] curingOperate').html(operateLogHtml);
  346. }else if(data.status==3){
  347. $('div[upCuringBox]').hide();
  348. $('p[upCuringBox]').show();
  349. }
  350. },
  351. error: function(xhr, type){
  352. console.log('Ajax error!')
  353. }
  354. })
  355. }*/