Brak opisu

Work-listCJ.js 12KB

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