Нет описания

Work-listClass.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. window.onload = function() {
  2. mui.plusReady(function() {
  3. //var isdeal=helper.request.queryString("isdeal");
  4. var token = localStorage.getItem("token");
  5. var F_See = localStorage.getItem("F_See");
  6. var page = 1; //页数
  7. var pageSize = 10; //每页显示条目
  8. var total; //数据总条数
  9. var wv = plus.webview.currentWebview();
  10. var importClass = wv.importClass; //工单等级
  11. var choujian = wv.choujian; //抽检
  12. var shaixuan = wv.shaixuan
  13. var keyw="";
  14. var index=0;
  15. var dataIndex=1;
  16. plus.nativeUI.closeWaiting();
  17. //显示当前页面
  18. mui.currentWebview.show();
  19. if(localStorage.getItem("index")){
  20. index = localStorage.getItem("index");
  21. dataIndex = localStorage.getItem("dataIndex");
  22. classImport = localStorage.getItem("classImport");
  23. areaId = localStorage.getItem("areaId");
  24. officeId = localStorage.getItem("officeId");
  25. $("#mui_list").find(".mui-control-item_1").removeClass("mui-active_q");
  26. $("#mui_list").find(".mui-control-item_1").eq(index).addClass("mui-active_q");
  27. }
  28. if(importClass == 1) {
  29. $(".Totle-box").text('1类问题')
  30. classImport = "Ⅰ级"
  31. } else if(importClass == 2) {
  32. $(".Totle-box").text('2类问题')
  33. classImport = "Ⅱ级"
  34. } else if(importClass == 3) {
  35. $(".Totle-box").text('3类问题')
  36. classImport = "普通工单"
  37. }else{
  38. $(".Totle-box").text('抽检列表')
  39. classImport = ""
  40. }
  41. if(F_See == 0) { //调度
  42. $("#DW").css('display', 'block')
  43. } else{
  44. $("#DW").css('display', 'none')
  45. }
  46. Ajax();
  47. AjaxYcl();
  48. if(dataIndex==1){
  49. $("#pullrefresh").find(".mui-scroll_1").show();
  50. $("#pullrefresh").find(".mui-scroll_2").remove();
  51. }else if(dataIndex==2){
  52. $("#pullrefresh").find(".mui-scroll_1").remove();
  53. $("#pullrefresh").find(".mui-scroll_2").show();
  54. }
  55. $('.search').on('input focus', function() {
  56. keyw = $(this).val();
  57. page = 1;
  58. if (dataIndex==1) {
  59. Ajax(keyw);
  60. }else if (dataIndex==2) {
  61. AjaxYcl(keyw);
  62. }
  63. });
  64. mui.init({
  65. swipeBack: false,
  66. pullRefresh: {
  67. container: '#pullrefresh',
  68. up: {
  69. contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
  70. contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
  71. callback: pullupRefresh
  72. }
  73. }
  74. });
  75. function pullupRefresh() {
  76. setTimeout(function() {
  77. mui('#pullrefresh').pullRefresh().endPullupToRefresh((page++ >= Math.ceil(total / 10)));
  78. if (index==0) {
  79. $.ajax({
  80. data: {
  81. token: token,
  82. dealTimely: classImport,
  83. Processing:1,
  84. CJ:choujian,
  85. keywords:keyw,
  86. extensionphone: 1,
  87. area:areaId,
  88. offce:officeId,
  89. pageindex : page,
  90. pagesize: pageSize
  91. },
  92. url: huayi.config.callcenter_url + '/WorkorderApp/GetList',
  93. dataType: 'json', //服务器返回json格式数据
  94. type: 'get', //HTTP请求类型
  95. timeout: 10000, //超时时间设置为10秒;
  96. headers: {
  97. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  98. },
  99. success: function(data) {
  100. var total = data.total;
  101. if(!total) {
  102. total = 0;
  103. }
  104. $(".Totle").text('(' + total + ')');
  105. for(var i = 0; i < data.rows.length; i++) {
  106. var a = data.rows[i].F_Content;
  107. var c = data.rows[i].F_WorkState;
  108. var time = data.rows[i].F_CreateTime;
  109. var areaOffice;
  110. if (!data.rows[i].F_AreaName) {
  111. areaOffice='';
  112. }else{
  113. areaOffice='<p class="mui-h6 mui-ellipsis" style="padding-left: 15px;">' +
  114. '<span class="areaOffice">大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'</span>' +
  115. ' </p>'
  116. }
  117. imgnum = '<img src="../img/process_icon.png"/>';
  118. $('<li class="mui-table-view-cell orderli">' +
  119. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  120. '<div class="mui-table-cell mui-col-xs-12">' +
  121. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  122. ' <p class="mui-h6 mui-ellipsis">' +
  123. '<span class="advice">' + a + '</span>' +
  124. ' </p>'+areaOffice+'<p class="mui-h6 mui-ellipsis">' +
  125. '<span class="time">投诉时间:' + time + '</span>' +
  126. ' </p></div></div>' +
  127. '<div class="class-state">' + imgnum +
  128. '</div>' +
  129. '</li>').appendTo('#order_listClz');
  130. }
  131. },
  132. error: function(xhr, type, errorThrown) {
  133. //异常处理;
  134. }
  135. })
  136. }else if(index==1){
  137. $.ajax({
  138. data: {
  139. token: token,
  140. dealTimely: classImport,
  141. Processing:2,
  142. keywords:keyw,
  143. area:areaId,
  144. offce:officeId,
  145. CJ:choujian,
  146. extensionphone: 1,
  147. pageindex: page,
  148. pagesize: pageSize
  149. },
  150. url: huayi.config.callcenter_url + '/WorkorderApp/GetList',
  151. dataType: 'json', //服务器返回json格式数据
  152. type: 'get', //HTTP请求类型
  153. timeout: 10000, //超时时间设置为10秒;
  154. headers: {
  155. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  156. },
  157. success: function(data) {
  158. var imgnum;
  159. $(".class-icon img").hide()
  160. for(var i = 0; i < data.rows.length; i++) {
  161. var a = data.rows[i].F_Content;
  162. var c = data.rows[i].F_WorkState;
  163. var time = data.rows[i].F_CreateTime;
  164. imgnum = '<img src="../img/comple_icon.png"/>';
  165. var areaOffice;
  166. if (!data.rows[i].F_AreaName) {
  167. areaOffice='';
  168. }else{
  169. areaOffice='<p class="mui-h6 mui-ellipsis" style="padding-left: 15px;">' +
  170. '<span class="areaOffice">大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'</span>' +
  171. ' </p>'
  172. }
  173. $('<li class="mui-table-view-cell orderli">' +
  174. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  175. '<div class="mui-table-cell mui-col-xs-12">' +
  176. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  177. ' <p class="mui-h6 mui-ellipsis">' +
  178. '<span class="advice">' + a + '</span>' +
  179. ' </p>'+areaOffice+'<p class="mui-h6 mui-ellipsis">' +
  180. '<span class="time">投诉时间:' + time + '</span>' +
  181. ' </p></div></div>' +
  182. '<div class="class-state">' + imgnum +
  183. '</div>' +
  184. '</li>').appendTo('#order_listYwc');
  185. }
  186. },
  187. error: function(xhr, type, errorThrown) {
  188. //异常处理;
  189. }
  190. })
  191. }
  192. }, 1000);
  193. }
  194. function Ajax() {
  195. $.ajax({
  196. data: {
  197. token: token,
  198. dealTimely: classImport,
  199. Processing:1,
  200. keywords:keyw,
  201. extensionphone: 1,
  202. area:areaId,
  203. offce:officeId,
  204. CJ:choujian,
  205. pageindex: 1,
  206. pagesize: 10
  207. },
  208. url: huayi.config.callcenter_url + '/WorkorderApp/GetList',
  209. dataType: 'json', //服务器返回json格式数据
  210. type: 'get', //HTTP请求类型
  211. timeout: 10000, //超时时间设置为10秒;
  212. headers: {
  213. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  214. },
  215. success: function(data) {
  216. var total = data.total;
  217. $(".orderli").remove();
  218. if(!total) {total = 0;}
  219. var imgnum;
  220. $(".class-icon img").hide()
  221. $(".clzTotle").text('(' + total + ')');
  222. for(var i = 0; i < data.rows.length; i++) {
  223. var a = data.rows[i].F_Content;
  224. var c = data.rows[i].F_WorkState;
  225. var time = data.rows[i].F_CreateTime;
  226. var areaOffice;
  227. if (!data.rows[i].F_AreaName) {
  228. areaOffice='';
  229. }else{
  230. areaOffice='<p class="mui-h6 mui-ellipsis" style="padding-left: 15px;">' +
  231. '<span class="areaOffice">大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'</span>' +
  232. ' </p>'
  233. }
  234. imgnum = '<img src="../img/process_icon.png"/>';
  235. $('<li class="mui-table-view-cell orderli">' +
  236. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  237. '<div class="mui-table-cell mui-col-xs-12">' +
  238. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  239. ' <p class="mui-h6 mui-ellipsis">' +
  240. '<span class="advice">' + a + '</span>' +
  241. ' </p>'+areaOffice+'<p class="mui-h6 mui-ellipsis">' +
  242. '<span class="time">投诉时间:' + time + '</span>' +
  243. ' </p></div></div>' +
  244. '<div class="class-state">' + imgnum +
  245. '</div>' +
  246. '</li>').appendTo('#order_listClz');
  247. }
  248. },
  249. error: function(xhr, type, errorThrown) {
  250. //异常处理;
  251. }
  252. })
  253. }
  254. function AjaxYcl() {
  255. $.ajax({
  256. data: {
  257. token: token,
  258. dealTimely: classImport,
  259. Processing:2,
  260. keywords:keyw,
  261. extensionphone: 1,
  262. area:areaId,
  263. offce:officeId,
  264. CJ:choujian,
  265. pageindex: 1,
  266. pagesize: 10
  267. },
  268. url: huayi.config.callcenter_url + '/WorkorderApp/GetList',
  269. dataType: 'json', //服务器返回json格式数据
  270. type: 'get', //HTTP请求类型
  271. timeout: 10000, //超时时间设置为10秒;
  272. headers: {
  273. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  274. },
  275. success: function(data) {
  276. $(".orderli1").remove();
  277. var total = data.total;
  278. if(!total) {total = 0;}
  279. var imgnum;
  280. $(".class-icon img").hide()
  281. $(".ywcTotle").text('(' + total + ')');
  282. for(var i = 0; i < data.rows.length; i++) {
  283. var a = data.rows[i].F_Content;
  284. var c = data.rows[i].F_WorkState;
  285. var time = data.rows[i].F_CreateTime;
  286. imgnum = '<img src="../img/comple_icon.png"/>';
  287. var areaOffice;
  288. if (!data.rows[i].F_AreaName) {
  289. areaOffice='';
  290. }else{
  291. areaOffice='<p class="mui-h6 mui-ellipsis" style="padding-left: 15px;">' +
  292. '<span class="areaOffice">大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'</span>' +
  293. ' </p>'
  294. }
  295. $('<li class="mui-table-view-cell orderli1">' +
  296. '<div class="mui-table order" data-index="' + data.rows[i].F_Id + '">' +
  297. '<div class="mui-table-cell mui-col-xs-12">' +
  298. '<h5 class="mui-ellipsis new_title" >' + data.rows[i].F_QualityProblem + '</h5>' +
  299. ' <p class="mui-h6 mui-ellipsis">' +
  300. '<span class="advice">' + a + '</span>' +
  301. ' </p>'+areaOffice+'<p class="mui-h6 mui-ellipsis">' +
  302. '<span class="time">投诉时间:' + time + '</span>' +
  303. ' </p></div></div>' +
  304. '<div class="class-state">' + imgnum +
  305. '</div>' +
  306. '</li>').appendTo('#order_listYwc');
  307. }
  308. },
  309. error: function(xhr, type, errorThrown) {
  310. //异常处理;
  311. }
  312. })
  313. }
  314. $('#mui_list').on('tap', '.mui-control-item_1', function() {
  315. index=$(this).index();
  316. dataIndex=$(this).attr("data-index");
  317. localStorage.setItem("index", index);
  318. localStorage.setItem("dataIndex", dataIndex);
  319. localStorage.setItem("classImport", classImport);
  320. localStorage.setItem("areaId", areaId);
  321. localStorage.setItem("officeId", officeId);
  322. window.location.reload();
  323. })
  324. $(".tureBtn").click(function(){
  325. areaD(); officeD(); Ajax(); AjaxYcl();
  326. if ($('.grade-eject').hasClass('grade-w-roll')) {
  327. $('.grade-eject').removeClass('grade-w-roll');
  328. $(this).removeClass('current');
  329. setTimeout(function() {$(".grade-eject_bj").hide()},400)
  330. } else {
  331. $('.grade-eject').addClass('grade-w-roll');
  332. $(this).addClass('current');
  333. setTimeout(function() {$(".grade-eject_bj").show()},400)
  334. }
  335. })
  336. $('.order_list').on('tap', '.order', function() {
  337. var id = $(this).attr('data-index');
  338. mui.openWindow({
  339. id: 'WorkDetails',
  340. url: 'WorkDetails.html',
  341. createNew: true,
  342. show: {
  343. aniShow: 'pop-in'
  344. },
  345. styles: {
  346. popGesture: 'hide'
  347. },
  348. waiting: {
  349. autoShow: true
  350. },
  351. extras: {
  352. name: id,
  353. classImport: classImport,
  354. token: token
  355. }
  356. });
  357. })
  358. // 产品代码
  359. var Product = [];
  360. $.ajax({
  361. type: "get",
  362. url: huayi.config.callcenter_url + 'Department/GetAPPAreaList',
  363. async: false,
  364. data: {
  365. flag: "CPDM",
  366. token:localStorage.getItem("token")
  367. },
  368. dataType: 'json',
  369. success: function(res) {
  370. if(res.state.toLowerCase() === "success") {
  371. res = res.data;
  372. if(res && res.length > 0) {
  373. res.forEach(function(v, i) {
  374. var obj = {};
  375. obj.id = v.id;
  376. obj.text = v.text;
  377. obj.children = v.children;
  378. Product.push(obj);
  379. });
  380. }
  381. }
  382. }
  383. });
  384. });
  385. }