新手操作指南Demo - 使用双汇UI代码

Work-listClass.js 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. window.onload = function() {
  2. mui.plusReady(function() {
  3. //var isdeal=helper.request.queryString("isdeal");
  4. var token = localStorage.getItem("token");
  5. var page = 1; //页数
  6. var pageSize = 10; //每页显示条目
  7. var total; //数据总条数
  8. var wv = plus.webview.currentWebview();
  9. var importClass = wv.importClass; //工单等级
  10. var keyw="";
  11. var index=0;
  12. plus.nativeUI.closeWaiting();
  13. //显示当前页面
  14. mui.currentWebview.show();
  15. if(importClass == 1) {
  16. $(".Totle-box").text('一级列表')
  17. } else if(importClass == 2) {
  18. $(".Totle-box").text('二级列表')
  19. } else if(importClass == 3) {
  20. $(".Totle-box").text('三级列表')
  21. }
  22. if(importClass == 1) {
  23. classImport = "Ⅰ级"
  24. } else if(importClass == 2) {
  25. classImport = "Ⅱ级"
  26. } else if(importClass == 3) {
  27. classImport = "普通工单"
  28. } else {
  29. classImport = ""
  30. }
  31. Ajax();
  32. AjaxYcl();
  33. $('.search').on('input focus', function() {
  34. keyw = $(this).val();
  35. page = 1;
  36. Ajax(keyw);
  37. AjaxYcl(keyw);
  38. });
  39. mui.init({
  40. swipeBack: false,
  41. pullRefresh: {
  42. container: '#pullrefresh',
  43. up: {
  44. contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
  45. contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
  46. callback: pullupRefresh
  47. }
  48. }
  49. });
  50. function pullupRefresh() {
  51. setTimeout(function() {
  52. mui('#pullrefresh').pullRefresh().endPullupToRefresh((page++ >= Math.ceil(total / 10)));
  53. if (index==0) {
  54. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
  55. data: {
  56. token: token,
  57. dealTimely: classImport,
  58. Processing:1,
  59. keywords:keyw,
  60. extensionphone: 1,
  61. pageindex : page,
  62. pagesize: pageSize
  63. },
  64. dataType: 'json', //服务器返回json格式数据
  65. type: 'get', //HTTP请求类型
  66. timeout: 10000, //超时时间设置为10秒;
  67. headers: {
  68. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  69. },
  70. success: function(data) {
  71. var total = data.total;
  72. if(!total) {
  73. total = 0;
  74. }
  75. $(".Totle").text('(' + total + ')');
  76. for(var i = 0; i < data.rows.length; i++) {
  77. var a = data.rows[i].F_Content;
  78. var c = data.rows[i].F_WorkState;
  79. var time = data.rows[i].F_CreateTime.substring(0, data.rows[i].F_CreateTime.indexOf(' '));
  80. imgnum = '<img src="../img/process_icon.png"/>';
  81. $('<li class="mui-table-view-cell orderli">' +
  82. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  83. '<div class="mui-table-cell mui-col-xs-12">' +
  84. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  85. ' <p class="mui-h6 mui-ellipsis">' +
  86. '<span class="advice">' + a + '</span>' +
  87. ' </p><p class="mui-h6 mui-ellipsis">' +
  88. '<span class="time">投诉时间:' + time + '</span>' +
  89. ' </p></div></div>' +
  90. '<div class="class-state">' + imgnum +
  91. '</div>' +
  92. '</li>').appendTo('#order_listClz');
  93. }
  94. },
  95. error: function(xhr, type, errorThrown) {
  96. //异常处理;
  97. }
  98. })
  99. }else if(index==1){
  100. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
  101. data: {
  102. token: token,
  103. dealTimely: classImport,
  104. Processing:2,
  105. keywords:keyw,
  106. extensionphone: 1,
  107. pageindex: page,
  108. pagesize: pageSize
  109. },
  110. dataType: 'json', //服务器返回json格式数据
  111. type: 'get', //HTTP请求类型
  112. timeout: 10000, //超时时间设置为10秒;
  113. headers: {
  114. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  115. },
  116. success: function(data) {
  117. var total = data.total;
  118. if(!total) {total = 0;}
  119. var imgnum;
  120. $(".class-icon img").hide()
  121. $(".ywcTotle").text('(' + total + ')');
  122. for(var i = 0; i < data.rows.length; i++) {
  123. var a = data.rows[i].F_Content;
  124. var c = data.rows[i].F_WorkState;
  125. var time = data.rows[i].F_CreateTime.substring(0, data.rows[i].F_CreateTime.indexOf(' '));
  126. imgnum = '<img src="../img/comple_icon.png"/>';
  127. $('<li class="mui-table-view-cell orderli">' +
  128. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  129. '<div class="mui-table-cell mui-col-xs-12">' +
  130. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  131. ' <p class="mui-h6 mui-ellipsis">' +
  132. '<span class="advice">' + a + '</span>' +
  133. ' </p><p class="mui-h6 mui-ellipsis">' +
  134. '<span class="time">投诉时间:' + time + '</span>' +
  135. ' </p></div></div>' +
  136. '<div class="class-state">' + imgnum +
  137. '</div>' +
  138. '</li>').appendTo('#order_listYwc');
  139. }
  140. },
  141. error: function(xhr, type, errorThrown) {
  142. //异常处理;
  143. }
  144. })
  145. }
  146. }, 1000);
  147. }
  148. function Ajax() {
  149. $(".orderli").remove();
  150. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
  151. data: {
  152. token: token,
  153. dealTimely: classImport,
  154. Processing:1,
  155. keywords:keyw,
  156. extensionphone: 1,
  157. pageindex: page,
  158. pagesize: pageSize
  159. },
  160. dataType: 'json', //服务器返回json格式数据
  161. type: 'get', //HTTP请求类型
  162. timeout: 10000, //超时时间设置为10秒;
  163. headers: {
  164. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  165. },
  166. success: function(data) {
  167. var total = data.total;
  168. if(!total) {total = 0;}
  169. var imgnum;
  170. $(".class-icon img").hide()
  171. $(".clzTotle").text('(' + total + ')');
  172. for(var i = 0; i < data.rows.length; i++) {
  173. var a = data.rows[i].F_Content;
  174. var c = data.rows[i].F_WorkState;
  175. var time = data.rows[i].F_CreateTime.substring(0, data.rows[i].F_CreateTime.indexOf(' '));
  176. imgnum = '<img src="../img/process_icon.png"/>';
  177. $('<li class="mui-table-view-cell orderli">' +
  178. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  179. '<div class="mui-table-cell mui-col-xs-12">' +
  180. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  181. ' <p class="mui-h6 mui-ellipsis">' +
  182. '<span class="advice">' + a + '</span>' +
  183. ' </p><p class="mui-h6 mui-ellipsis">' +
  184. '<span class="time">投诉时间:' + time + '</span>' +
  185. ' </p></div></div>' +
  186. '<div class="class-state">' + imgnum +
  187. '</div>' +
  188. '</li>').appendTo('#order_listClz');
  189. }
  190. },
  191. error: function(xhr, type, errorThrown) {
  192. //异常处理;
  193. }
  194. })
  195. }
  196. function AjaxYcl() {
  197. $(".orderli").remove();
  198. mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
  199. data: {
  200. token: token,
  201. dealTimely: classImport,
  202. Processing:2,
  203. keywords:keyw,
  204. extensionphone: 1,
  205. pageindex: page,
  206. pagesize: pageSize
  207. },
  208. dataType: 'json', //服务器返回json格式数据
  209. type: 'get', //HTTP请求类型
  210. timeout: 10000, //超时时间设置为10秒;
  211. headers: {
  212. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  213. },
  214. success: function(data) {
  215. var total = data.total;
  216. if(!total) {total = 0;}
  217. var imgnum;
  218. $(".class-icon img").hide()
  219. $(".ywcTotle").text('(' + total + ')');
  220. for(var i = 0; i < data.rows.length; i++) {
  221. var a = data.rows[i].F_Content;
  222. var c = data.rows[i].F_WorkState;
  223. var time = data.rows[i].F_CreateTime.substring(0, data.rows[i].F_CreateTime.indexOf(' '));
  224. imgnum = '<img src="../img/comple_icon.png"/>';
  225. $('<li class="mui-table-view-cell orderli">' +
  226. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  227. '<div class="mui-table-cell mui-col-xs-12">' +
  228. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  229. ' <p class="mui-h6 mui-ellipsis">' +
  230. '<span class="advice">' + a + '</span>' +
  231. ' </p><p class="mui-h6 mui-ellipsis">' +
  232. '<span class="time">投诉时间:' + time + '</span>' +
  233. ' </p></div></div>' +
  234. '<div class="class-state">' + imgnum +
  235. '</div>' +
  236. '</li>').appendTo('#order_listYwc');
  237. }
  238. },
  239. error: function(xhr, type, errorThrown) {
  240. //异常处理;
  241. }
  242. })
  243. }
  244. $('#mui_list').on('tap', 'a', function() {
  245. index=$(this).index();
  246. $("#pullrefresh").find(".mui-scroll").hide();
  247. $("#pullrefresh").find(".mui-scroll").eq(index).show();
  248. })
  249. $('.order_list').on('tap', '.order', function() {
  250. var id = $(this).attr('data-index');
  251. mui.openWindow({
  252. id: 'WorkDetails',
  253. url: 'WorkDetails.html',
  254. createNew: true,
  255. show: {
  256. aniShow: 'pop-in'
  257. },
  258. styles: {
  259. popGesture: 'hide'
  260. },
  261. waiting: {
  262. autoShow: true
  263. },
  264. extras: {
  265. name: id,
  266. classImport: classImport,
  267. token: token
  268. }
  269. });
  270. })
  271. });
  272. }