Brak opisu

huawu.js 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. $(document).ready(function() {
  2. laydate.render({
  3. elem: '#time1',
  4. theme: '#00a1cb'
  5. });
  6. laydate.render({
  7. elem: '#time2',
  8. theme: '#00a1cb'
  9. });
  10. laydate.render({
  11. elem: '#time3',
  12. theme: '#00a1cb'
  13. });
  14. laydate.render({
  15. elem: '#time4',
  16. theme: '#00a1cb'
  17. });
  18. //part 1
  19. var main1 = echarts.init(document.getElementById('main1'));
  20. main1.setOption({
  21. tooltip: {
  22. trigger: 'axis',
  23. axisPointer: {
  24. type: 'cross',
  25. label: {
  26. show: true,
  27. backgroundColor: '#333'
  28. }
  29. }
  30. },
  31. legend: {
  32. bottom:'bottom',
  33. data: ["来电数量", "接通数量", "放弃数量", "黑名单拒接数量"],
  34. textStyle: {
  35. color: '#fff'
  36. }
  37. },
  38. xAxis: {
  39. name: '时',
  40. data: [],
  41. axisLine: {
  42. lineStyle: {
  43. color: '#ccc'
  44. }
  45. }
  46. },
  47. yAxis: {
  48. name: '数量',
  49. splitLine: {
  50. show: false
  51. },
  52. axisLine: {
  53. lineStyle: {
  54. color: '#ccc'
  55. }
  56. }
  57. },
  58. series: []
  59. });
  60. function partOne() {
  61. var index = layer.load(1, {
  62. shade: [0.5, '#030303'] //0.1透明度的白色背景
  63. });
  64. $('.list_one').html('');
  65. $.ajax({
  66. type: "get",
  67. url: huayi.config.callcenter_url + "info/GetTelCount24ByDate",
  68. async: true,
  69. dataType: "json",
  70. data: {
  71. date: $('#time1').val()
  72. },
  73. success: function(data) {
  74. if(data.state.toLowerCase() == "success") {
  75. layer.close(index);
  76. var con = data.data;
  77. main1.setOption({
  78. xAxis: {
  79. data: con.hours
  80. },
  81. series: [{
  82. name: "来电数量",
  83. type: "line",
  84. smooth: true,
  85. showAllSymbol: true,
  86. symbol: "emptyCircle",
  87. symbolSize: 10,
  88. data: con.rcounts
  89. }, {
  90. name: "接通数量",
  91. type: "line",
  92. smooth: true,
  93. showAllSymbol: true,
  94. symbol: "emptyCircle",
  95. symbolSize: 10,
  96. data: con.ccounts
  97. },
  98. {
  99. name: "放弃数量",
  100. type: "line",
  101. smooth: true,
  102. showAllSymbol: true,
  103. symbol: "emptyCircle",
  104. symbolSize: 10,
  105. data: con.gcounts
  106. },
  107. {
  108. name: "黑名单拒接数量",
  109. type: "line",
  110. smooth: true,
  111. showAllSymbol: true,
  112. symbol: "emptyCircle",
  113. symbolSize: 10,
  114. data: con.scounts
  115. }]
  116. })
  117. }
  118. }
  119. });
  120. }
  121. $('.part1Btn').click(function() {
  122. partOne();
  123. })
  124. //part 2
  125. var phone_num = echarts.init(document.getElementById('phone_num'));
  126. phone_num.setOption({
  127. title: {
  128. // text: '投诉/举报汇总',
  129. x: 'center',
  130. textStyle: {
  131. color: '#fff',
  132. fontSize: 16
  133. },
  134. },
  135. tooltip: {
  136. trigger: 'axis',
  137. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  138. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  139. }
  140. },
  141. toolbox: {
  142. show: true,
  143. },
  144. calculable: true,
  145. xAxis: [{
  146. type: 'category',
  147. // name: '月份',
  148. splitLine: {
  149. show: false
  150. }, //去除网格线
  151. data: ["话务量(通)", "来电(通)", "接通量(通)", "平均通话时长(秒)"],
  152. // axisTick: {
  153. // alignWithLabel: true
  154. // },
  155. axisLine: {
  156. show: false,
  157. lineStyle: {
  158. color: '#fff'
  159. }
  160. },
  161. // axisLine: {},
  162. axisTick: {
  163. show: false
  164. }
  165. }],
  166. yAxis: [{
  167. show: false
  168. }],
  169. series: [{
  170. name: '数量',
  171. type: 'bar',
  172. barWidth: '30%', //图形宽度
  173. data: [],
  174. itemStyle: {
  175. normal: {
  176. label: {
  177. show: true,
  178. textStyle: {
  179. color: '#fff' //顶部数据颜色
  180. }
  181. }
  182. }
  183. },
  184. label: {
  185. normal: {
  186. show: true,
  187. position: 'top' //顶部数据显示位置
  188. }
  189. }
  190. }
  191. ]
  192. // color: ['#ff9800','#61a0a8','#1ab394']
  193. });
  194. function partTwo() {
  195. var index = layer.load(1, {
  196. shade: [0.5, '#030303'] //0.1透明度的白色背景
  197. });
  198. $.ajax({
  199. type: "get",
  200. url: huayi.config.callcenter_url + "info/GetTelCountByDate",
  201. async: true,
  202. dataType: "json",
  203. data: {
  204. date: $('#time2').val()
  205. },
  206. success: function(data) {
  207. if(data.state.toLowerCase() == "success") {
  208. layer.close(index);
  209. var con = data.data;
  210. phone_num.setOption({
  211. series: [{
  212. data: [con.hwcon, con.lhcon, con.jtcon, con.pjthtimes]
  213. // data: [20, 100, 5, 80]
  214. }]
  215. })
  216. }
  217. }
  218. });
  219. }
  220. $('.part2Btn').click(function() {
  221. partTwo();
  222. })
  223. //pasrt 3
  224. var main = echarts.init(document.getElementById('main'));
  225. main.setOption({
  226. tooltip: {
  227. trigger: 'axis',
  228. axisPointer: {
  229. type: 'cross',
  230. label: {
  231. show: true,
  232. backgroundColor: '#333'
  233. }
  234. },
  235. formatter: function(datas) {
  236. var res = datas[0].name + '<br/>',
  237. val;
  238. for(var i = 0, length = datas.length; i < length; i++) {
  239. val = (datas[i].value) + '%';
  240. res += datas[i].seriesName + ':' + val + '<br/>';
  241. }
  242. return res;
  243. }
  244. },
  245. legend: {
  246. data: ["空闲", "通话", "置忙"],
  247. textStyle: {
  248. color: '#fff'
  249. },
  250. bottom:'bottom'
  251. },
  252. xAxis: {
  253. name: '时',
  254. data: [],
  255. axisLine: {
  256. lineStyle: {
  257. color: '#ccc'
  258. }
  259. }
  260. },
  261. yAxis: {
  262. name: '比率',
  263. splitLine: {
  264. show: false
  265. },
  266. axisLine: {
  267. lineStyle: {
  268. color: '#ccc'
  269. }
  270. }
  271. },
  272. series: []
  273. });
  274. function partThree(){
  275. var index = layer.load(1, {
  276. shade: [0.5, '#030303'] //0.1透明度的白色背景
  277. });
  278. $.ajax({
  279. type: "get",
  280. url: huayi.config.callcenter_url + "info/GetUserStateCount24ByDate",
  281. async: true,
  282. dataType: "json",
  283. data: {
  284. start: $('#time3').val(),
  285. end: $('#time4').val()
  286. },
  287. success: function(data) {
  288. if(data.state.toLowerCase() == "success") {
  289. layer.close(index);
  290. var con = data.data;
  291. // var part3 = result.data.b;
  292. main.setOption({
  293. xAxis: {
  294. data: con.hours
  295. },
  296. series: [{
  297. name: "空闲",
  298. type: "bar",
  299. data: con.kxpercents
  300. }, {
  301. name: "通话",
  302. type: "bar",
  303. data: con.thpercents
  304. }, {
  305. name: "置忙",
  306. type: "bar",
  307. data: con.zmpercents
  308. }]
  309. })
  310. }
  311. }
  312. });
  313. }
  314. $('.part3Btn').click(function() {
  315. partThree();
  316. })
  317. Ajax()
  318. function Ajax(){
  319. partOne();
  320. partTwo()
  321. partThree();
  322. }
  323. setInterval(Ajax, huayi.config.indextime); //Ajax调用函数
  324. })