暫無描述

complaintsReport.js 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. var areaOneVal = helper.cookies.get("areaOneVal");
  2. var areaOneText = helper.cookies.get("areaOneText");
  3. if (areaOneVal) {
  4. var areaOneVal = helper.cookies.get("areaOneVal");
  5. } else{
  6. var areaOneVal="sqs12345"
  7. }
  8. $(function() {
  9. laydate.render({
  10. elem: '#time1',
  11. range: '~',
  12. format: 'yyyy-MM',
  13. type: 'month',
  14. theme: '#114a97',
  15. done: function(value, date) {
  16. var areaOneVal=$(".areaOne").val();
  17. partOne(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  18. var start=value.split(' ~ ')[0];
  19. var end=value.split(' ~ ')[1];
  20. }
  21. });
  22. laydate.render({
  23. elem: '#time2',
  24. range: '~',
  25. format: 'yyyy-MM-dd',
  26. theme: '#114a97',
  27. done: function(value, date) {
  28. var areaOneVal=$(".areaOne").val();
  29. partTwo(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  30. }
  31. });
  32. laydate.render({
  33. elem: '#time3',
  34. range: '~',
  35. theme: '#114a97',
  36. done: function(value, date) {
  37. var areaOneVal=$(".areaOne").val();
  38. partThree(value && value.split(' ~ ')[0], value && value.split(' ~ ')[1],areaOneVal)
  39. }
  40. });
  41. Ajax()
  42. $(".areaOne").change(function() {
  43. var areaOneVal=$(this).val();
  44. var areaOneText=$(".areaOne").find("option:selected").text();
  45. helper.cookies.set("areaOneVal", areaOneVal, 7);
  46. helper.cookies.set("areaOneText", areaOneText, 7);
  47. partOne($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1],areaOneVal);
  48. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  49. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal);
  50. // Ajax()
  51. });
  52. $(".keys").change(function() {
  53. var areaOneVal = helper.cookies.get("areaOneVal");
  54. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  55. })
  56. keylist ();
  57. //部门下拉框
  58. function keylist () {
  59. $.getJSON( huayi.config.callcenter_url +"info/GetKeyList", function(result) {
  60. if(result.state.toLowerCase() == "success") {
  61. goodslist = result.data;
  62. $(".keys").empty();
  63. $('<option value="">请选择关键词</option>').appendTo($(".keys"));
  64. $(goodslist).each(function(i, n) {
  65. $('<option value="' + n.F_ValueId
  66. + '">' + n.F_Value
  67. + '</option>').appendTo($(".keys"));
  68. })
  69. }
  70. });
  71. }
  72. })
  73. //区县筛选
  74. deprtment ();
  75. function deprtment () {
  76. $.getJSON( huayi.config.callcenter_url +"CountyBranch/GetBranchListS", function(result) {
  77. if(result.state.toLowerCase() == "success") {
  78. goodslist = result.data;
  79. // 第五屏
  80. $(".areaOne").empty();
  81. $(goodslist).each(function(i, n) {
  82. $('<option value="' + n.F_Code
  83. + '">' + n.F_Name
  84. + '</option>').appendTo($(".areaOne"));
  85. });
  86. if (areaOneVal) {
  87. $(".areaOne").val(areaOneVal);
  88. }
  89. }
  90. });
  91. }
  92. //part 1 //投诉类别月统计 对接完毕
  93. var part_1 = echarts.init(document.getElementById('part_1'));
  94. part_1.setOption({
  95. color: ['#69e1a9', '#6a91e0', '#ceba5f', '#f06e84', '#569d4e', '#7d55ba', '#ce5aba', '#345cdd', '#569d4e'],
  96. tooltip: {
  97. trigger: 'axis',
  98. axisPointer: {
  99. type: 'cross',
  100. label: {
  101. show: true,
  102. backgroundColor: '#333'
  103. }
  104. }
  105. },
  106. grid: {
  107. left: '2%',
  108. right: '5%',
  109. bottom: '6%',
  110. containLabel: true
  111. },
  112. legend: {
  113. top: 'top',
  114. left: '180px',
  115. data: [],
  116. textStyle: {
  117. color: '#00e9ff'
  118. }
  119. },
  120. xAxis: {
  121. name: '月份',
  122. data: [],
  123. axisLine: {
  124. lineStyle: {
  125. color: '#3061a2'
  126. }
  127. },
  128. axisTick: {
  129. alignWithLabel: true,
  130. show: false
  131. },
  132. axisLabel: { //横轴字体颜色
  133. show: true,
  134. textStyle: {
  135. color: '#eff0f4'
  136. }
  137. }
  138. },
  139. yAxis: {
  140. name: '(数量)',
  141. splitLine: {
  142. show: false
  143. },
  144. axisLine: {
  145. lineStyle: {
  146. color: '#3061a2'
  147. }
  148. },
  149. axisLabel: { //横轴字体颜色
  150. show: true,
  151. textStyle: {
  152. color: '#eff0f4'
  153. }
  154. }
  155. },
  156. series: []
  157. });
  158. function partOne(start, end,areaOneVal) {
  159. // var index = layer.load(1, {
  160. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  161. // });
  162. $.ajax({
  163. type: "get",
  164. url: huayi.config.callcenter_url + "info/GetTypeCountMonthByDate",
  165. async: true,
  166. dataType: 'json',
  167. data: {
  168. start: start,
  169. end: end,
  170. branchcode:areaOneVal
  171. },
  172. success: function(data) {
  173. if(data.state.toLowerCase() == 'success') {
  174. // layer.close(index);
  175. var con = data.data;
  176. var counts = con.counts;
  177. var sers = [];
  178. $(counts).each(function(i, n) {
  179. var obj = {};
  180. obj.name = con.cols[i];
  181. obj.type = "line";
  182. obj.smooth = true;
  183. obj.showAllSymbol = true;
  184. obj.symbol = "emptyCircle";
  185. obj.symbolSize = 10;
  186. obj.data = n;
  187. sers.push(obj)
  188. });
  189. part_1.setOption({
  190. xAxis: {
  191. data: con.months
  192. },
  193. legend: {
  194. data: con.cols
  195. },
  196. series: sers
  197. });
  198. }
  199. }
  200. });
  201. }
  202. //part2 //投诉关键字统计
  203. function partTwo(starts, ends, areaOneVal) {
  204. var keyid=$('.keys').val()
  205. $.ajax({
  206. type: "get",
  207. url: huayi.config.callcenter_url + "Info/GetKeyCountByDateNew",
  208. dataType: 'json',
  209. async: true,
  210. data: {
  211. start: starts,
  212. end: ends,
  213. keyid: keyid,
  214. branchcode:areaOneVal
  215. },
  216. success: function(data) {
  217. if(data.state.toLowerCase() == 'success') {
  218. $('.thead tr').html('');
  219. $('#scroll_table tbody').html('');
  220. var con = data.data;
  221. var thead = con[0];
  222. $.each(thead, function(k, val) {
  223. $('<td>' + k + '</td>').appendTo('.thead tr');
  224. })
  225. $(con).each(function(j, n) {
  226. var str = '<tr>'
  227. $.each(thead, function(j, m) {
  228. $.each(n, function(k, val) {
  229. if(j == k) {
  230. if(val == '') {
  231. val = 0;
  232. }
  233. str += '<td>' + val + '</td>'
  234. }
  235. })
  236. })
  237. str += '</tr>';
  238. $('#scroll_table tbody').append(str);
  239. })
  240. }
  241. }
  242. });
  243. }
  244. // part3 投诉分类统计
  245. var part3 = echarts.init(document.getElementById('part3'));
  246. part3.setOption({
  247. color: ['#6ce7ac', '#6a91e0', '#ceba5f', '#cb5f79', '#ae765a', '#569d4e'],
  248. tooltip: {
  249. trigger: 'item',
  250. formatter: "{a} <br/>{b} : {c} ({d}%)",
  251. axisPointer: {
  252. crossStyle: {
  253. color: '#fff'
  254. }
  255. }
  256. },
  257. // legend: {
  258. // // orient: 'vertical',
  259. // bottom: 'bottom',
  260. // data: [],
  261. // textStyle: {
  262. // color: '#fff'
  263. // }
  264. // },
  265. series: [{
  266. name: '数据',
  267. type: 'pie',
  268. radius: ['30%', '60%'],
  269. center: ['40%', '50%'],
  270. data: [],
  271. itemStyle: {
  272. emphasis: {
  273. shadowBlur: 10,
  274. shadowOffsetX: 0,
  275. shadowColor: 'rgba(0, 0, 0, 0.5)'
  276. },
  277. normal: {
  278. label: {
  279. show: true,
  280. // formatter: '{b} : {c} ({d}%)'
  281. formatter: '{d}%'
  282. },
  283. labelLine: {
  284. show: true
  285. }
  286. }
  287. },
  288. label: {
  289. normal: {
  290. textStyle: {
  291. color: '#fff'
  292. }
  293. }
  294. }
  295. }]
  296. });
  297. function partThree(start, end,areaOneVal) {
  298. // var index = layer.load(1, {
  299. // shade: [0.5, '#030303'] //0.1透明度的白色背景
  300. // });
  301. $.ajax({
  302. type: "get",
  303. url: huayi.config.callcenter_url + "info/GetTypeCountByDate",
  304. async: true,
  305. dataType: 'json',
  306. data: {
  307. start: start,
  308. end: end,
  309. branchcode:areaOneVal
  310. },
  311. success: function(data) {
  312. if(data.state.toLowerCase() == 'success') {
  313. // layer.close(index);
  314. $('.complaint_type').html('');
  315. var con = data.data;
  316. var part_1_legend = [];
  317. var part_1_ser = [];
  318. $(con).each(function(i, n) {
  319. part_1_legend.push(n.TypeName)
  320. var part_1_obj = {};
  321. part_1_obj.value = n.Count;
  322. part_1_obj.name = n.TypeName;
  323. part_1_ser.push(part_1_obj)
  324. $('<li>' +
  325. '<span class="type_name">' + n.TypeName + '</span> <span class="type_count">' + n.Count + '</span>' +
  326. '</li>').appendTo('.complaint_type')
  327. })
  328. part3.setOption({
  329. // legend: {
  330. // data: part_1_legend
  331. // },
  332. series: [{
  333. data: part_1_ser
  334. }]
  335. })
  336. }
  337. }
  338. });
  339. }
  340. //表格滚动
  341. var area = document.getElementById('scroll_table');
  342. var iliHeight = 34; //单行滚动的高度
  343. var speed = 20; //滚动的速度
  344. var time;
  345. var delay = 1000;
  346. area.scrollTop = 0;
  347. area.innerHTML += area.innerHTML; //克隆一份一样的内容
  348. function startScroll() {
  349. time = setInterval("scrollUp()", speed);
  350. area.scrollTop++;
  351. console.log(area.scrollTop);
  352. }
  353. function scrollUp() {
  354. if(area.scrollTop % iliHeight == 0) {
  355. clearInterval(time);
  356. setTimeout(startScroll, delay);
  357. } else {
  358. area.scrollTop++;
  359. if(area.scrollTop >= area.scrollHeight / 2) {
  360. area.scrollTop = 0;
  361. }
  362. }
  363. }
  364. setTimeout(startScroll, delay)
  365. function Ajax() {
  366. var areaOneVal = helper.cookies.get("areaOneVal");
  367. var areaOneText = helper.cookies.get("areaOneText");
  368. partOne($('#time1').val() && $('#time1').val().split(' ~ ')[0], $('#time1').val() && $('#time1').val().split(' ~ ')[1],areaOneVal)
  369. partTwo($('#time2').val() && $('#time2').val().split(' ~ ')[0], $('#time2').val() && $('#time2').val().split(' ~ ')[1],areaOneVal);
  370. partThree($('#time3').val() && $('#time3').val().split(' ~ ')[0], $('#time3').val() && $('#time3').val().split(' ~ ')[1],areaOneVal)
  371. }