buildFN.js 8.5 KB

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