永城市12345 (县级市)- 来源于虞城县12345 - 所有县级统一API

complaintsReport.js 6.3KB

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