Нет описания

complaintsReport.js 9.6KB

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