虞城12345_前端

huawu.js 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. $(document).ready(function() {
  2. //part 1
  3. var main1 = echarts.init(document.getElementById('main1'));
  4. main1.setOption({
  5. tooltip: {
  6. trigger: 'item',
  7. formatter: "{a} <br/>{b} : {c} ({d}%)",
  8. axisPointer: {
  9. crossStyle: {
  10. color: '#fff'
  11. }
  12. }
  13. },
  14. legend: {
  15. // orient: 'vertical',
  16. bottom: 'bottom',
  17. data: [],
  18. textStyle: {
  19. color: '#fff'
  20. }
  21. },
  22. series: [{
  23. name: '数据',
  24. type: 'pie',
  25. radius: '55%',
  26. center: ['50%', '50%'],
  27. data: [],
  28. itemStyle: {
  29. emphasis: {
  30. shadowBlur: 10,
  31. shadowOffsetX: 0,
  32. shadowColor: 'rgba(0, 0, 0, 0.5)'
  33. },
  34. normal:{
  35. label:{
  36. show: true,
  37. formatter: '{b} : {c} ({d}%)'
  38. },
  39. labelLine :{show:true}
  40. }
  41. },
  42. label: {
  43. normal: {
  44. textStyle: {
  45. color: '#fff'
  46. }
  47. }
  48. }
  49. }]
  50. });
  51. //part 2
  52. var phone_num = echarts.init(document.getElementById('phone_num'));
  53. phone_num.setOption({
  54. title: {
  55. // text: '投诉/举报汇总',
  56. x: 'center',
  57. textStyle: {
  58. color: '#fff',
  59. fontSize: 16
  60. },
  61. },
  62. tooltip: {
  63. trigger: 'axis',
  64. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  65. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  66. }
  67. },
  68. toolbox: {
  69. show: true,
  70. },
  71. calculable: true,
  72. xAxis: [{
  73. type: 'category',
  74. // name: '月份',
  75. splitLine: {
  76. show: false
  77. }, //去除网格线
  78. data: ["话务来电总量(通)", "接通总量(通)"],
  79. // axisTick: {
  80. // alignWithLabel: true
  81. // },
  82. axisLine: {
  83. show: false,
  84. lineStyle: {
  85. color: '#fff'
  86. }
  87. },
  88. // axisLine: {},
  89. axisTick: {
  90. show: false
  91. }
  92. }],
  93. yAxis: [{
  94. show: false
  95. }],
  96. series: [{
  97. name: '数量',
  98. type: 'bar',
  99. barWidth: '30%', //图形宽度
  100. data: [],
  101. itemStyle: {
  102. normal: {
  103. label: {
  104. show: true,
  105. textStyle: {
  106. color: '#fff' //顶部数据颜色
  107. }
  108. }
  109. }
  110. },
  111. label: {
  112. normal: {
  113. show: true,
  114. position: 'top' //顶部数据显示位置
  115. }
  116. }
  117. }
  118. ]
  119. // color: ['#ff9800','#61a0a8','#1ab394']
  120. });
  121. //接通率报表part3
  122. var jtv = echarts.init(document.getElementById('jtv_num'));
  123. jtv.setOption({
  124. tooltip: {
  125. trigger: 'axis',
  126. axisPointer: {
  127. type: 'shadow',
  128. label: {
  129. show: true,
  130. backgroundColor: '#333'
  131. }
  132. },
  133. formatter: function(datas)
  134. {
  135. var res = datas[0].name + '<br/>', val;
  136. for(var i = 0, length = datas.length; i < length; i++) {
  137. val = (datas[i].value) + '%';
  138. res += datas[i].seriesName + ':' + val + '<br/>';
  139. }
  140. return res;
  141. }
  142. },
  143. legend: {
  144. // top: 30,
  145. bottom:'bottom',
  146. data: [],
  147. textStyle: {
  148. color: '#fff'
  149. }
  150. },
  151. xAxis: {
  152. name: '部门',
  153. data: [],
  154. axisLine: {
  155. lineStyle: {
  156. color: '#ccc'
  157. }
  158. },
  159. },
  160. yAxis: {
  161. name: '数量',
  162. splitLine: {
  163. show: false
  164. },
  165. axisLine: {
  166. lineStyle: {
  167. color: '#ccc'
  168. }
  169. }
  170. },
  171. series: [{
  172. name: '诉求量',
  173. type: 'bar',
  174. barWidth: 8,
  175. itemStyle: {
  176. normal: {
  177. color: new echarts.graphic.LinearGradient(
  178. 0, 0, 0, 1, [{
  179. offset: 0,
  180. color: '#14c8d4'
  181. },
  182. {
  183. offset: 1,
  184. color: '#43eec6'
  185. }
  186. ]
  187. )
  188. }
  189. },
  190. data: []
  191. }]
  192. });
  193. //通话时长part4
  194. var th_nums = echarts.init(document.getElementById('th_nums'));
  195. th_nums.setOption({
  196. tooltip: {
  197. trigger: 'item',
  198. formatter: "{a} <br/>{b} : {c} ({d}%)",
  199. axisPointer: {
  200. crossStyle: {
  201. color: '#fff'
  202. }
  203. }
  204. },
  205. legend: {
  206. // orient: 'vertical',
  207. bottom: 'bottom',
  208. data: [],
  209. textStyle: {
  210. color: '#fff'
  211. }
  212. },
  213. series: [{
  214. name: '数据',
  215. type: 'pie',
  216. radius: '55%',
  217. center: ['50%', '50%'],
  218. data: [],
  219. itemStyle: {
  220. emphasis: {
  221. shadowBlur: 10,
  222. shadowOffsetX: 0,
  223. shadowColor: 'rgba(0, 0, 0, 0.5)'
  224. },
  225. normal:{
  226. label:{
  227. show: true,
  228. formatter: '{b} : {c} ({d}%)'
  229. },
  230. labelLine :{show:true}
  231. }
  232. },
  233. label: {
  234. normal: {
  235. textStyle: {
  236. color: '#fff'
  237. }
  238. }
  239. }
  240. }]
  241. });
  242. Ajax();
  243. function Ajax(){
  244. $.ajax({
  245. type: "get",
  246. url: huayi.config.callcenter_url + "Info/GetScreen",
  247. async: true,
  248. dataType: "json",
  249. data: {
  250. // token: $.cookie("token")
  251. },
  252. success: function(data) {
  253. if(data.state.toLowerCase() == "success") {
  254. // layer.close(index);
  255. var part_a = data.data.a;//图二
  256. phone_num.setOption({
  257. series: [{
  258. data: [part_a.jtcount, part_a.zldcount]
  259. // data: [20, 100, 5, 80]
  260. }]
  261. })
  262. var part_b = data.data.b;//图1
  263. var part_1_legend =[];
  264. var part_1_ser = [];
  265. $(part_b).each(function(i,n){
  266. part_1_legend.push(n.Source);
  267. var part_1_obj = {};
  268. part_1_obj.value = n.Count;
  269. part_1_obj.name = n.Source;
  270. part_1_ser.push(part_1_obj)
  271. })
  272. main1.setOption({
  273. legend: {
  274. data: part_1_legend
  275. },
  276. series: [{
  277. data: part_1_ser
  278. }]
  279. })
  280. var part_c = data.data.c;//图3
  281. var part_3_legend =[];
  282. var part_3_ser = [];
  283. $(part_c).each(function(j,m){
  284. part_3_legend.push(m.DeptName)
  285. part_3_ser.push(m.Count)
  286. })
  287. jtv.setOption({
  288. // legend: {
  289. // data:part_3_legend,
  290. // },
  291. xAxis: {
  292. data:part_3_legend
  293. },
  294. series: [{
  295. data:part_3_ser
  296. }]
  297. })
  298. var part_d = data.data.d;//图4
  299. var part_4_legend =[];
  300. var part_4_ser = [];
  301. $(part_d).each(function(y,s){
  302. part_4_legend.push(s.TypeName);
  303. var part_4_obj = {};
  304. part_4_obj.value = s.Count;
  305. part_4_obj.name = s.TypeName;
  306. part_4_ser.push(part_4_obj)
  307. })
  308. th_nums.setOption({
  309. legend: {
  310. data: part_4_legend
  311. },
  312. series: [{
  313. data: part_4_ser
  314. }]
  315. })
  316. }
  317. }
  318. });
  319. }
  320. setInterval(Ajax, huayi.config.indextime); //Ajax调用函数
  321. })