curingFN.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /**
  2. * 分页列表--刷新用户列表
  3. * @param parameter
  4. * @param currentPage
  5. * @returns
  6. */
  7. function refreshCuringPagination(parameter, currentPage) {
  8. $.ajax({
  9. cache: false,
  10. type: 'get',
  11. url: '/cloud/curing/ajax/getCuringPage/' + currentPage + parameter,
  12. dataType: 'json',
  13. success: function (data) {
  14. if (data.status == 1) {
  15. fnStructureCuringUser(data.curingList);
  16. fnPage(data.pageData);
  17. refreshColumn(columnLength);
  18. } else {
  19. alert(data.msg);
  20. }
  21. }
  22. })
  23. }
  24. /**
  25. * 筛选-统一请求--刷新用户列表
  26. * @returns
  27. */
  28. function refreshCuringPage(compilation, latestCompilation, sortField, sort, wd) {
  29. $.ajax({
  30. cache: false,
  31. type: 'get',
  32. url: '/cloud/curing/ajax/refreshCuringPage?sortField=' + sortField + '&sort=' + sort + '&compilation=' + compilation + '&latestCompilation=' + latestCompilation +
  33. '&wd=' + wd,
  34. dataType: 'json',
  35. success: function (data) {
  36. if (data.status == 1) {
  37. fnStructureCuringUser(data.curingList);
  38. fnPage(data.pageData);
  39. refreshColumn(columnLength);
  40. } else {
  41. alert(data.msg);
  42. }
  43. }
  44. })
  45. }
  46. /**
  47. * 通行证账号检索用户--刷新列表和分页
  48. * @returns
  49. */
  50. function fnMobile2Info() {
  51. mobile2InfoTimeout = null;
  52. //if((/^1[34578]\d{9}$/.test(mobile))) {
  53. refreshCuringPage('', '', '', '', mobile);
  54. //}
  55. }
  56. /**
  57. * 刷新用户详情页
  58. * @param ssoid
  59. * @param client_id
  60. * @returns
  61. */
  62. function refreshCuringPageDetail(ssoid, client_id) {
  63. $.ajax({
  64. cache: false,
  65. type: 'GET',
  66. url: '/cloud/curing/ajax/getCuringBySsoid',
  67. data: { ssoid: encodeURI(ssoid), client_id: encodeURI(client_id) },
  68. dataType: 'json',
  69. success: function (data) {
  70. if (data.status == 1 || data.status == 2) {
  71. //设置 养护用户信息
  72. var objHtml = buildCuringInfo(data.detail.userInfo);
  73. $('div[curingInfo] curing').html(objHtml);
  74. $('div[curingInfo] curingClient').html('');
  75. //设置CLD客户信息
  76. //if(data.detail.curingInfo.updateTotal!=0){
  77. //$("#id").val(id);
  78. var clientHtml = relevanceClient(data.detail.clientInfo);
  79. $('div[curingInfo] curingClient').html(clientHtml);
  80. //}
  81. //设置养护详情页里产品升级信息
  82. var upMajorBoxHtml = buildCuringCompilation(data);
  83. $('tbody[upMajorBox]').html(upMajorBoxHtml);
  84. //更新在线时长
  85. var onlineTimesHtml = buildCuringOnlineTimes(data.detail.userInfo.online_list);
  86. $('tbody[onlineTimes]').html(onlineTimesHtml);
  87. //设置参数
  88. $('#curingSsoid').val(data.detail.userInfo.ssoIdKey);
  89. $('#curingMobile').val(data.detail.userInfo.mobile);
  90. $('#client_id').val(data.detail.clientInfo.cidKey);
  91. //设置养护日志
  92. var operateLogHtml = buildCuringOperateLog(data.detail.operateLog);
  93. $('div[operateLog] curingOperate').html(operateLogHtml);
  94. setTimeout(autoHeight, 400);
  95. //autoHeight();
  96. $('#detail').modal('show');
  97. } else if (data.status == 3) {
  98. alert(data.msg);
  99. }
  100. },
  101. error: function (xhr, type) {
  102. console.log('Ajax error!')
  103. }
  104. })
  105. }
  106. /**
  107. * DOM加载完毕后初始化
  108. * @returns
  109. */
  110. function init() {
  111. refreshColumn(columnLength);
  112. }
  113. /**
  114. * 用户升级专业版 弹框提示--用户详情界面
  115. * @param name
  116. * @param _id
  117. * @param username
  118. * @returns
  119. */
  120. function upCuring(name, _id, username) {
  121. $('#name').val(name);
  122. $('#_id').val(_id);
  123. var curingMobile = $('#curingMobile').val();
  124. var html = '<p>为用户 <b>' + curingMobile + ',' + username + '</b> 升级 <b>' + name + '</b></p>';
  125. html += `<div class="form-group">
  126. <div class="custom-control custom-switch">
  127. <input type="checkbox" class="custom-control-input" deadline id="customSwitch2" >
  128. <label class="custom-control-label" deadlineLabel for="customSwitch2">限期</label>
  129. </div>
  130. </div>`;
  131. html += `<div class="form-group">
  132. <label class="form-label" for="example-date">到期时间</label>
  133. <input class="form-control" id="deadline" type="date" name="deadline" disabled value="">
  134. </div>`;
  135. html += `<div class="form-group">
  136. <div class="custom-control custom-switch">
  137. <input type="checkbox" class="custom-control-input" smssend id="customSwitch22" >
  138. <label class="custom-control-label" for="customSwitch22">给客户发送短信通知</label>
  139. </div>
  140. </div>`;
  141. $('div[upCuring] span').html(html);
  142. }
  143. /**
  144. * 养护产品降级
  145. * @param {} name
  146. * @param {*} _id
  147. * @param {*} username
  148. */
  149. function downCuring(name, _id, username) {
  150. $('#name').val(name);
  151. $('#_id').val(_id);
  152. var curingMobile = $('#curingMobile').val();
  153. let html = `<p>为用户 <b>${curingMobile},${username}</b> <span class="text-danger">降级</span> <b>${name}免费版</b></p>
  154. <div class="form-group">
  155. <div class="custom-control custom-switch">
  156. <input type="checkbox" class="custom-control-input" downSmssend id="customSwitch23" >
  157. <label class="custom-control-label" for="customSwitch23">给客户发送短信通知</label>
  158. </div>
  159. </div>`;
  160. $('div[downCuring] span').html(html);
  161. }
  162. function deadlineCuring(name, _id, username,deadline){
  163. $('#name').val(name);
  164. $('#_id').val(_id);
  165. var curingMobile = $('#curingMobile').val();
  166. let html = `<p>为用户 <b>${curingMobile},${username}</b> <b>${name}</b> 设置延期</p>
  167. <p>当前限期为:${deadline}</p>
  168. <div class="form-group">
  169. <label class="form-label" for="example-date">到期时间</label>
  170. <input class="form-control" id="deadlineInput" type="date" name="date" value="">
  171. </div>
  172. <div class="form-group">
  173. <div class="custom-control custom-switch">
  174. <input type="checkbox" class="custom-control-input" deadlineSmssend id="customSwitch222" >
  175. <label class="custom-control-label" for="customSwitch222">给客户发送短信通知</label>
  176. </div>
  177. </div>`;
  178. $('div[deadlineCuring] span').html(html);
  179. }
  180. function curingDo(compilationId, name, curingSsoid, status, mobile, client_id, deadline, smssend) {
  181. if (curingSsoid != '' && compilationId != '') {
  182. $.ajax({
  183. cache: false,
  184. type: 'post',
  185. url: '/cloud/curing/ajax/upCuringDo',
  186. data: { ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name, deadline: deadline, smssend: smssend, status: status },
  187. dataType: 'json',
  188. success: function (data) {
  189. if (data.status == 1) {
  190. refreshCuringPageDetail(curingSsoid, client_id);
  191. } else {
  192. alert(data.msg);
  193. }
  194. }
  195. })
  196. } else {
  197. alert('请选择需要升级的版本');
  198. }
  199. }
  200. $(function () {
  201. $('div[upcuring]').delegate('label[deadlineLabel]', 'click', function () {
  202. $('#deadline').attr('disabled', 'disabled');
  203. if($('input[deadline]').prop('checked')){
  204. $('input[deadline]').prop("checked",false);
  205. }else{
  206. $('input[deadline]').prop("checked",true);
  207. }
  208. if ($('input[deadline]').get(0).checked) {
  209. $('#deadline').removeAttr('disabled');
  210. }
  211. });
  212. })