dashboard.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
  2. var Controller = {
  3. index: function () {
  4. // 基于准备好的dom,初始化echarts实例
  5. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  6. // 指定图表的配置项和数据
  7. var option = {
  8. title: {
  9. text: '',
  10. subtext: ''
  11. },
  12. color: [
  13. "#18d1b1",
  14. "#3fb1e3",
  15. "#626c91",
  16. "#a0a7e6",
  17. "#c4ebad",
  18. "#96dee8"
  19. ],
  20. tooltip: {
  21. trigger: 'axis'
  22. },
  23. legend: {
  24. data: ['注册用户数']
  25. },
  26. toolbox: {
  27. show: false,
  28. feature: {
  29. magicType: {show: true, type: ['stack', 'tiled']},
  30. saveAsImage: {show: true}
  31. }
  32. },
  33. xAxis: {
  34. type: 'category',
  35. boundaryGap: false,
  36. data: Config.column
  37. },
  38. yAxis: {},
  39. grid: [{
  40. left: 'left',
  41. top: 'top',
  42. right: '10',
  43. bottom: 30
  44. }],
  45. series: [{
  46. name: '注册用户数',
  47. type: 'line',
  48. smooth: true,
  49. areaStyle: {
  50. normal: {}
  51. },
  52. lineStyle: {
  53. normal: {
  54. width: 1.5
  55. }
  56. },
  57. data: Config.user_data
  58. }]
  59. };
  60. // 使用刚指定的配置项和数据显示图表。
  61. myChart.setOption(option);
  62. $(window).resize(function () {
  63. myChart.resize();
  64. });
  65. $(document).on("click", ".btn-refresh", function () {
  66. setTimeout(function () {
  67. myChart.resize();
  68. }, 0);
  69. });
  70. // 绑定【待处理报名数量】点击弹窗事件
  71. $(document).on("click", "#signup_count", function () {
  72. Fast.api.open('exam/room_signup?status=0', '待处理报名数量', {
  73. shadeClose: false,
  74. shade: [0.3, '#393D49'],
  75. area: ['80%', '80%'],
  76. });
  77. });
  78. // 【待处理报名数量】置红
  79. let total_wait_apply_signup_count = $('#total_wait_apply_signup_count').text();
  80. if (parseInt(total_wait_apply_signup_count) > 0) {
  81. $('#total_wait_apply_signup_count').addClass('font-red');
  82. }
  83. }
  84. };
  85. return Controller;
  86. });