You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UseStatistics.js 6.9 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. var bootstrap = function ($, learun) {
  2. "use strict";
  3. var date = "";
  4. var page = {
  5. init: function () {
  6. page.bind();
  7. page.initGrid();
  8. page.initChart();
  9. },
  10. bind: function () {
  11. //当前年
  12. var now = learun.formatDate(new Date(), 'yyyy-MM-dd');
  13. $('#date').val(now);
  14. date = now;
  15. // 刷新
  16. $('#lr-replace').on('click', function () {
  17. location.reload();
  18. });
  19. //查询
  20. $('#btn_Search').on('click', function () {
  21. date = $('#date').val();
  22. page.search();
  23. });
  24. },
  25. initGrid: function () {
  26. $(".lr-layout-grid").height($(window).height() - 110);
  27. $('#gridtable').jfGrid({
  28. url: top.$.rootUrl + '/LR_SystemModule/Log/GetUseList?CategoryId=1',
  29. headData: [
  30. {
  31. name: "category", label: "分类", width: 50, align: "center", formatter: function (cellvalue) {
  32. return "登录";
  33. }
  34. },
  35. { name: "department", label: "部门", width: 150, align: "center" },
  36. { name: "source", label: "来源", width: 80, align: "center" },
  37. { name: "total", label: "人数", width: 80, align: "center" }
  38. ]
  39. });
  40. $('#gridtable2').jfGrid({
  41. url: top.$.rootUrl + '/LR_SystemModule/Log/GetUseList?CategoryId=2',
  42. headData: [
  43. {
  44. name: "category", label: "分类", width: 50, align: "center", formatter: function (cellvalue) {
  45. return "操作";
  46. }
  47. },
  48. { name: "department", label: "部门", width: 150, align: "center" },
  49. { name: "source", label: "来源", width: 80, align: "center" },
  50. { name: "total", label: "人数", width: 80, align: "center" }
  51. ]
  52. });
  53. page.search();
  54. },
  55. initChart: function () {
  56. var myChart1 = echarts.init(document.getElementById('main'));
  57. var myChart2 = echarts.init(document.getElementById('main1'));
  58. var myChart3 = echarts.init(document.getElementById('main2'));
  59. var queryJson = { date: date };
  60. learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Log/GetUseChartList", { queryJson: JSON.stringify(queryJson) }, function (res) {
  61. if (res.code == 200) {
  62. var option1 = {
  63. title: {
  64. text: date + ' 登录记录',
  65. x: 'center'
  66. },
  67. tooltip: {
  68. trigger: 'item',
  69. formatter: "{a} <br/>{b} : {c}人 ({d}%)"
  70. },
  71. legend: {
  72. orient: 'vertical',
  73. left: 'left',
  74. data: res.data.legendData
  75. },
  76. series: [
  77. {
  78. name: '登录记录',
  79. type: 'pie',
  80. radius: '55%',
  81. center: ['50%', '60%'],
  82. data: res.data.seriesData,
  83. itemStyle: {
  84. emphasis: {
  85. shadowBlur: 10,
  86. shadowOffsetX: 0,
  87. shadowColor: 'rgba(0, 0, 0, 0.5)'
  88. }
  89. }
  90. }
  91. ]
  92. };
  93. myChart1.setOption(option1);
  94. var option2 = {
  95. title: {
  96. text: date + ' 操作记录',
  97. x: 'center'
  98. },
  99. tooltip: {
  100. trigger: 'item',
  101. formatter: "{a} <br/>{b} : {c}人 ({d}%)"
  102. },
  103. legend: {
  104. orient: 'vertical',
  105. left: 'left',
  106. data: res.data.legendData
  107. },
  108. series: [
  109. {
  110. name: '操作记录',
  111. type: 'pie',
  112. radius: '55%',
  113. center: ['50%', '60%'],
  114. data: res.data.seriesData2,
  115. itemStyle: {
  116. emphasis: {
  117. shadowBlur: 10,
  118. shadowOffsetX: 0,
  119. shadowColor: 'rgba(0, 0, 0, 0.5)'
  120. }
  121. }
  122. }
  123. ]
  124. };
  125. myChart2.setOption(option2);
  126. var option3 = {
  127. title: {
  128. text: date.slice(0, 4) + '年系统使用趋势图',
  129. x: 'center'
  130. },
  131. legend: {
  132. orient: 'vertical',
  133. left: 'left',
  134. data: res.data.legendDataOfLine
  135. },
  136. tooltip: {
  137. trigger: 'axis'
  138. },
  139. grid: {
  140. left: '15%',
  141. right: '3%',
  142. bottom: '3%',
  143. containLabel: true
  144. },
  145. xAxis: {
  146. type: 'category',
  147. boundaryGap: false,
  148. data: res.data.xAxis
  149. },
  150. yAxis: {
  151. type: 'value',
  152. name: '人数'
  153. },
  154. series: res.data.seriesLineData
  155. };
  156. myChart3.setOption(option3);
  157. }
  158. });
  159. },
  160. search: function (param) {
  161. param = param || {};
  162. param.date = date;
  163. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  164. $('#gridtable2').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  165. page.initChart();
  166. }
  167. };
  168. page.init();
  169. }