虞城12345_前端

complaintsReport.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. $(function() {
  2. laydate.render({
  3. elem: '#time2',
  4. range: '~',
  5. format: 'yyyy-MM-dd',
  6. theme: '#114a97',
  7. done: function(value, date) {
  8. partOne()
  9. partTwo(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1])
  10. partThree(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1])
  11. }
  12. });
  13. Ajax()
  14. })
  15. //part 1 //投诉类别月统计 对接完毕
  16. var part_1 = echarts.init(document.getElementById('part_1'));
  17. part_1.setOption({
  18. color: ['#69e1a9', '#6a91e0', '#ceba5f', '#f06e84', '#569d4e', '#7d55ba', '#ce5aba', '#345cdd', '#569d4e'],
  19. tooltip: {
  20. trigger: 'axis',
  21. axisPointer: {
  22. type: 'cross',
  23. label: {
  24. show: true,
  25. backgroundColor: '#333'
  26. }
  27. }
  28. },
  29. grid: {
  30. left: '2%',
  31. right: '5%',
  32. bottom: '6%',
  33. containLabel: true
  34. },
  35. legend: {
  36. top: 'top',
  37. left: '180px',
  38. data: [],
  39. textStyle: {
  40. color: '#00e9ff'
  41. }
  42. },
  43. xAxis: {
  44. name: '月份',
  45. data: [],
  46. axisLine: {
  47. lineStyle: {
  48. color: '#3061a2'
  49. }
  50. },
  51. axisTick: {
  52. alignWithLabel: true,
  53. show: false
  54. },
  55. axisLabel: { //横轴字体颜色
  56. show: true,
  57. textStyle: {
  58. color: '#eff0f4'
  59. }
  60. }
  61. },
  62. yAxis: {
  63. name: '(数量)',
  64. splitLine: {
  65. show: false
  66. },
  67. axisLine: {
  68. lineStyle: {
  69. color: '#3061a2'
  70. }
  71. },
  72. axisLabel: { //横轴字体颜色
  73. show: true,
  74. textStyle: {
  75. color: '#eff0f4'
  76. }
  77. }
  78. },
  79. series: []
  80. });
  81. function partOne(start, end) {
  82. // var index = layer.load(1, {
  83. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  84. // });
  85. $.ajax({
  86. type: "get",
  87. url: huayi.config.callcenter_url + "info/GetTypeCountMonthByDate",
  88. async: true,
  89. dataType: 'json',
  90. data: {
  91. start: start,
  92. end: end
  93. },
  94. success: function(data) {
  95. if(data.state.toLowerCase() == 'success') {
  96. // layer.close(index);
  97. var con = data.data;
  98. var counts = con.counts;
  99. var sers = [];
  100. $(counts).each(function(i, n) {
  101. var obj = {};
  102. obj.name = con.cols[i];
  103. obj.type = "line";
  104. obj.smooth = true;
  105. obj.showAllSymbol = true;
  106. obj.symbol = "emptyCircle";
  107. obj.symbolSize = 10;
  108. obj.data = n;
  109. sers.push(obj)
  110. });
  111. part_1.setOption({
  112. xAxis: {
  113. data: con.months
  114. },
  115. legend: {
  116. data: con.cols
  117. },
  118. series: sers
  119. });
  120. }
  121. }
  122. });
  123. }
  124. //part2 //投诉关键字统计
  125. function partTwo(starts,ends){
  126. $.ajax({
  127. type:"get",
  128. url: huayi.config.callcenter_url + "Info/GetKeyCountByDateNew",
  129. dataType: 'json',
  130. async: true,
  131. data:{
  132. start:starts,
  133. end:ends
  134. },
  135. success:function(data){
  136. if(data.state.toLowerCase()=='success'){
  137. $('.thead tr').html('');
  138. $('#scroll_table tbody').html('');
  139. var con=data.data;
  140. var thead=con[0];
  141. $.each(thead, function(k, val) {
  142. $('<td>'+ k +'</td>').appendTo('.thead tr');
  143. })
  144. $(con).each(function(j, n) {
  145. var str = '<tr>'
  146. $.each(thead, function(j, m) {
  147. $.each(n, function(k, val) {
  148. if(j == k) {
  149. if(val==''){
  150. val=0;
  151. }
  152. str += '<td>' + val + '</td>'
  153. }
  154. })
  155. })
  156. str += '</tr>';
  157. $('#scroll_table tbody').append(str);
  158. })
  159. $("#scroll_table").Scroll({
  160. line: 1,
  161. speed: 500,
  162. timer: 2000
  163. });
  164. }
  165. }
  166. });
  167. }
  168. // part3 投诉分类统计
  169. var part3 = echarts.init(document.getElementById('part3'));
  170. part3.setOption({
  171. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e'],
  172. tooltip: {
  173. trigger: 'item',
  174. formatter: "{a} <br/>{b} : {c} ({d}%)",
  175. axisPointer: {
  176. crossStyle: {
  177. color: '#fff'
  178. }
  179. }
  180. },
  181. // legend: {
  182. // // orient: 'vertical',
  183. // bottom: 'bottom',
  184. // data: [],
  185. // textStyle: {
  186. // color: '#fff'
  187. // }
  188. // },
  189. series: [{
  190. name: '数据',
  191. type: 'pie',
  192. radius: ['30%', '60%'],
  193. center: ['40%', '50%'],
  194. data: [],
  195. itemStyle: {
  196. emphasis: {
  197. shadowBlur: 10,
  198. shadowOffsetX: 0,
  199. shadowColor: 'rgba(0, 0, 0, 0.5)'
  200. },
  201. normal: {
  202. label: {
  203. show: true,
  204. // formatter: '{b} : {c} ({d}%)'
  205. formatter: '{d}%'
  206. },
  207. labelLine: {
  208. show: true
  209. }
  210. }
  211. },
  212. label: {
  213. normal: {
  214. textStyle: {
  215. color: '#fff'
  216. }
  217. }
  218. }
  219. }]
  220. });
  221. function partThree(start, end) {
  222. // var index = layer.load(1, {
  223. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  224. // });
  225. $.ajax({
  226. type: "get",
  227. url: huayi.config.callcenter_url + "info/GetTypeCountByDate",
  228. async: true,
  229. dataType: 'json',
  230. data: {
  231. start: start,
  232. end: end
  233. },
  234. success: function(data) {
  235. if(data.state.toLowerCase() == 'success') {
  236. // layer.close(index);
  237. $('.complaint_type').html('');
  238. var con = data.data;
  239. var part_1_legend = [];
  240. var part_1_ser = [];
  241. $(con).each(function(i, n) {
  242. part_1_legend.push(n.TypeName)
  243. var part_1_obj = {};
  244. part_1_obj.value = n.Count;
  245. part_1_obj.name = n.TypeName;
  246. part_1_ser.push(part_1_obj)
  247. $('<li>' +
  248. '<span class="type_name">' + n.TypeName + '</span> <span class="type_count">' + n.Count + '</span>' +
  249. '</li>').appendTo('.complaint_type')
  250. })
  251. part3.setOption({
  252. // legend: {
  253. // data: part_1_legend
  254. // },
  255. series: [{
  256. data: part_1_ser
  257. }]
  258. })
  259. }
  260. }
  261. });
  262. }
  263. function Ajax(){
  264. partOne()
  265. partTwo($('#time2').val()&& $('#time2').val().split(' ~ ')[0],$('#time2').val() && $('#time2').val().split(' ~ ')[1]);
  266. partThree($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1])
  267. }