curing.js 13 KB

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