Aucune description

receiptDepartment.js 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. $(function() {
  2. getdepartments()
  3. laydate.render({
  4. elem: '#startTime',
  5. range: '~',
  6. theme: '#114a97',
  7. done: function(value, date) {
  8. partOne();
  9. }
  10. });
  11. laydate.render({
  12. elem: '#phone_time',
  13. range: '~',
  14. theme: '#114a97',
  15. done: function(value, date) {
  16. partTwo();
  17. }
  18. });
  19. // laydate.render({
  20. // elem: '#tody_time',
  21. // theme: '#114a97',
  22. // done: function(value, date) {
  23. // partOne();
  24. // }
  25. // });
  26. Ajax();
  27. $(".areaOne").change(function() {
  28. var areaOneVal = $(this).val();
  29. var areaOneText = $(".areaOne").find("option:selected").text();
  30. helper.cookies.set("areaOneVal", areaOneVal, 7);
  31. helper.cookies.set("areaOneText", areaOneText, 7);
  32. partTwo($('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], $('#phone_time').val() && $(
  33. 'phone_time').val().split(' ~ ')[1], areaOneVal);
  34. partThree($('#tody_time').val(), areaOneVal);
  35. });
  36. $(".depart").change(function() {
  37. var areaOneVal = helper.cookies.get("areaOneVal");
  38. partTwo($('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], $('#phone_time').val() && $(
  39. '#phone_time').val().split(' ~ ')[1], areaOneVal);
  40. })
  41. })
  42. // 获取班组
  43. function getdepartments() {
  44. $("#bzdatas").html('');
  45. equipmentdata = []
  46. $("#bzdatas").append('<option value="">请选择班组</option>');
  47. $.ajax({
  48. type: "get",
  49. url: huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getallbzcount",
  50. async: true,
  51. headers: {
  52. "content-type": "application/json;charset=utf-8",
  53. "Authorization": "Bearer " + window.localStorage.getItem('token')
  54. }, //请求头类型
  55. success: function(data) {
  56. var leveldata = []
  57. console.log(JSON.parse(data))
  58. if (JSON.parse(data).state.toLowerCase() == 'success') {
  59. leveldata = JSON.parse(data).data
  60. $(leveldata).each(function(q, p) {
  61. console.log(p)
  62. $("<option value='" + p.role_name + "'>" + p.role_name + "</option>").appendTo("#bzdatas");
  63. // $("#bzdatas").selectpicker('refresh');
  64. });
  65. } else {
  66. $("#bzdatas").empty();
  67. // $("#bzdatas").selectpicker('refresh');
  68. }
  69. }
  70. });
  71. }
  72. $("#bzdatas").change(function() {
  73. partTwo()
  74. partThree()
  75. })
  76. // 跳轉
  77. $(".index").click(function() {
  78. window.open('detail.html', '_self')
  79. })
  80. $(".second").click(function() {
  81. window.open('second.html', '_self')
  82. })
  83. $(".third").click(function() {
  84. window.open('third.html', '_self')
  85. })
  86. $(".fourth").click(function() {
  87. window.open('fourth.html', '_self')
  88. })
  89. $(".nav_middle").click(function() {
  90. window.open('index.html', '_self')
  91. })
  92. // $("#department").click(function(){
  93. // window.open('receiptDepartment.html','_self')
  94. // })
  95. $("#sourceChannel").click(function() {
  96. window.open('sourceChannel.html', '_self')
  97. })
  98. $("#call").click(function() {
  99. window.open('TelephoneDetails.html', '_self')
  100. })
  101. $("#complaint").click(function() {
  102. window.open('complaintsReport.html', '_self')
  103. })
  104. //part 1 //工单状态统计 对接完毕
  105. var phoneTimeCount = echarts.init(document.getElementById('phoneTimeCount'));
  106. phoneTimeCount.setOption({
  107. color: ['#69e1a9', '#6a91e0', '#ceba5f', '#f06e84', '#569d4e', '#7d55ba', '#ce5aba', '#345cdd', '#569d4e'],
  108. tooltip: {
  109. trigger: 'axis',
  110. axisPointer: {
  111. type: 'cross',
  112. label: {
  113. show: true,
  114. backgroundColor: '#333'
  115. }
  116. }
  117. },
  118. grid: {
  119. left: '2%',
  120. right: '5%',
  121. bottom: '6%',
  122. containLabel: true
  123. },
  124. legend: {
  125. top: 'top',
  126. left: '180px',
  127. data: [],
  128. textStyle: {
  129. color: '#00e9ff'
  130. }
  131. },
  132. xAxis: {
  133. name: '月份',
  134. data: [],
  135. axisLine: {
  136. lineStyle: {
  137. color: '#3061a2'
  138. }
  139. },
  140. axisTick: {
  141. alignWithLabel: true,
  142. show: false
  143. },
  144. axisLabel: { //横轴字体颜色
  145. show: true,
  146. textStyle: {
  147. color: '#eff0f4'
  148. }
  149. }
  150. },
  151. yAxis: {
  152. name: '(数量)',
  153. splitLine: {
  154. show: false
  155. },
  156. axisLine: {
  157. lineStyle: {
  158. color: '#3061a2'
  159. }
  160. },
  161. axisLabel: { //横轴字体颜色
  162. show: true,
  163. textStyle: {
  164. color: '#eff0f4'
  165. }
  166. }
  167. },
  168. series: []
  169. });
  170. function partOne() {
  171. // var index = layer.load(1, {
  172. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  173. // });
  174. $.ajax({
  175. type: "get",
  176. url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/getlistsbypages",
  177. async: true,
  178. headers: {
  179. "content-type": "application/json;charset=utf-8",
  180. "Authorization": "Bearer " + window.localStorage.getItem('token')
  181. }, //请求头类型
  182. data: {
  183. // pageindex:1,
  184. // pagesize:10,
  185. // state:'',
  186. stime: $('#startTime').val() && $('#startTime').val().split(' ~ ')[0], //开始时间
  187. etime: $('#startTime').val() && $('#startTime').val().split(' ~ ')[1], //结束时间
  188. },
  189. dataType: 'json',
  190. success: function(data) {
  191. if (data.state.toLowerCase() == 'success') {
  192. // layer.close(index);
  193. // console.log(data)
  194. var con = data.data;
  195. // var jieDans = result.data.a;
  196. var counts = con.counts;
  197. var sers = [];
  198. $(counts).each(function(i, n) {
  199. var obj = {};
  200. obj.name = con.cols[i];
  201. obj.type = "line";
  202. obj.smooth = true;
  203. obj.showAllSymbol = true;
  204. obj.symbol = "emptyCircle";
  205. obj.symbolSize = 10;
  206. obj.data = n;
  207. sers.push(obj)
  208. });
  209. phoneTimeCount.setOption({
  210. xAxis: {
  211. data: con.months
  212. },
  213. legend: {
  214. data: con.cols
  215. },
  216. series: sers
  217. });
  218. }
  219. }
  220. });
  221. }
  222. //part 2 //各部门工单情况
  223. function partTwo() {
  224. $.ajax({
  225. type: "get",
  226. url: huayi.config.callcenter_url + "/equipmentapi/api/worepairbase/gettjlists",
  227. dataType: 'json',
  228. async: true,
  229. headers: {
  230. "content-type": "application/json;charset=utf-8",
  231. "Authorization": "Bearer " + window.localStorage.getItem('token')
  232. }, //请求头类型
  233. data: {
  234. daytype: $('#timeType').val(),
  235. isdjtype: '动态',
  236. Jwocode: $('#bzdatas').val(),
  237. stime: $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], //开始时间
  238. etime: $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[1], //结束时间
  239. },
  240. success: function(data) {
  241. if (data.state.toLowerCase() == 'success') {
  242. $('.thead tr').html('');
  243. $('#scroll_table tbody').html('');
  244. var con = data.data;
  245. // console.log(con)
  246. var thead = con[0];
  247. $.each(thead, function(k, val) {
  248. // console.log(k)
  249. $('<td>' + k + '</td>').appendTo('.thead tr');
  250. })
  251. $(con).each(function(j, n) {
  252. var str = '<tr>'
  253. $.each(thead, function(j, m) {
  254. $.each(n, function(k, val) {
  255. if (j == k) {
  256. if (val == '') {
  257. val = 0;
  258. }
  259. str += '<td>' + val + '</td>'
  260. }
  261. })
  262. })
  263. str += '</tr>';
  264. $('#scroll_table tbody').append(str);
  265. })
  266. }
  267. }
  268. });
  269. }
  270. $("#timeType").change(function() {
  271. partTwo()
  272. partThree()
  273. })
  274. // part3 工单处理时间分布
  275. var sitProportion = echarts.init(document.getElementById('sitProportion')); //坐席闲忙比例
  276. sitProportion.setOption({
  277. color: ['#4ab7c7', '#2484d9', '#2e39c1'],
  278. tooltip: {
  279. trigger: 'axis',
  280. axisPointer: {
  281. type: 'shadow',
  282. label: {
  283. show: true,
  284. backgroundColor: '#333'
  285. }
  286. },
  287. formatter: function(datas) {
  288. var res = datas[0].name + '<br/>',
  289. val;
  290. for (var i = 0, length = datas.length; i < length; i++) {
  291. // val = (datas[i].value) + '%';
  292. val = (datas[i].value);
  293. res += datas[i].seriesName + ':' + val + '<br/>';
  294. }
  295. return res;
  296. }
  297. },
  298. legend: {
  299. top: 'top',
  300. left: '165px',
  301. data: ['完结单率', '满意度'],
  302. textStyle: {
  303. color: '#00e9ff'
  304. }
  305. },
  306. grid: {
  307. left: '2%',
  308. right: '5%',
  309. bottom: '5%',
  310. containLabel: true
  311. },
  312. xAxis: {
  313. name: '班组',
  314. data: [],
  315. axisLine: {
  316. lineStyle: {
  317. color: '#3061a2',
  318. },
  319. },
  320. axisTick: {
  321. alignWithLabel: true,
  322. show: false
  323. },
  324. axisLabel: { //横轴字体颜色
  325. show: true,
  326. interval: '0',
  327. rotate: 20,
  328. textStyle: {
  329. color: '#65ABE7'
  330. }
  331. },
  332. },
  333. grid: {
  334. left: '15',
  335. right: '40',
  336. bottom: '30',
  337. containLabel: true
  338. },
  339. yAxis: {
  340. name: '(百分比)',
  341. nameTextStyle: {
  342. color: "#65ABE7",
  343. fontSize: 12,
  344. },
  345. splitLine: {
  346. show: false
  347. },
  348. type: 'value',
  349. axisLabel: {
  350. show: true,
  351. interval: 'auto',
  352. textStyle: {
  353. color: '#65ABE7', //字体颜色
  354. fontSize: 12 //字体大小
  355. },
  356. formatter: '{value} %'
  357. },
  358. show: true
  359. },
  360. series: [{
  361. name: '完结单率',
  362. type: 'bar',
  363. data: []
  364. }, {
  365. name: '满意度',
  366. type: 'bar',
  367. data: []
  368. }],
  369. });
  370. // 跳轉
  371. $(".index").click(function() {
  372. window.open('detail.html', '_self')
  373. })
  374. $(".second").click(function() {
  375. window.open('second.html', '_self')
  376. })
  377. $(".third").click(function() {
  378. window.open('third.html', '_self')
  379. })
  380. $(".fourth").click(function() {
  381. window.open('fourth.html', '_self')
  382. })
  383. $(".nav_middle").click(function() {
  384. window.open('index.html', '_self')
  385. })
  386. function partThree() {
  387. $.ajax({
  388. type: "get",
  389. headers: {
  390. "content-type": "application/json;charset=utf-8",
  391. "Authorization": "Bearer " + window.localStorage.getItem('token')
  392. }, //请求头类型
  393. url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/gettjliststh",
  394. dataType: 'json',
  395. async: true,
  396. data: {
  397. daytype: $('#timeType').val(),
  398. isdjtype: '动态',
  399. Jwocode: $('#bzdatas').val(),
  400. stime: $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[0], //开始时间
  401. etime: $('#phone_time').val() && $('#phone_time').val().split(' ~ ')[1], //结束时间
  402. },
  403. success: function(data) {
  404. if (data.state.toLowerCase() == 'success') {
  405. var con = data.data;
  406. var xdatas = []
  407. var xdatas2 = []
  408. for (var i = 0; i < con.finishwodlv.length; i++) {
  409. xdatas.push(con.finishwodlv[i].slice(0, -1))
  410. }
  411. for (var i = 0; i < con.mydlv.length; i++) {
  412. xdatas2.push(con.mydlv[i].slice(0, -1))
  413. }
  414. sitProportion.setOption({
  415. xAxis: {
  416. data: con.bzname
  417. },
  418. series: [{
  419. data: xdatas
  420. }, {
  421. data: xdatas2
  422. }],
  423. });
  424. }
  425. }
  426. });
  427. }
  428. //表格滚动
  429. var area = document.getElementById('scroll_table');
  430. var iliHeight = 34; //单行滚动的高度
  431. var speed = 20; //滚动的速度
  432. var time;
  433. var delay = 1000;
  434. area.scrollTop = 0;
  435. area.innerHTML += area.innerHTML; //克隆一份一样的内容
  436. function startScroll() {
  437. time = setInterval("scrollUp()", speed);
  438. area.scrollTop++;
  439. }
  440. function scrollUp() {
  441. if (area.scrollTop % iliHeight == 0) {
  442. clearInterval(time);
  443. setTimeout(startScroll, delay);
  444. } else {
  445. area.scrollTop++;
  446. if (area.scrollTop >= area.scrollHeight / 2) {
  447. area.scrollTop = 0;
  448. }
  449. }
  450. }
  451. setTimeout(startScroll, delay)
  452. function Ajax() {
  453. partOne()
  454. partTwo();
  455. partThree();
  456. }