index_v1.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <panel-group @handleSetLineChartData="handleSetLineChartData" />
  4. <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
  5. <line-chart :chart-data="lineChartData" />
  6. </el-row>
  7. <el-row :gutter="32">
  8. <el-col :xs="24" :sm="24" :lg="8">
  9. <div class="chart-wrapper">
  10. <raddar-chart />
  11. </div>
  12. </el-col>
  13. <el-col :xs="24" :sm="24" :lg="8">
  14. <div class="chart-wrapper">
  15. <pie-chart />
  16. </div>
  17. </el-col>
  18. <el-col :xs="24" :sm="24" :lg="8">
  19. <div class="chart-wrapper">
  20. <bar-chart />
  21. </div>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </template>
  26. <script>
  27. import PanelGroup from './dashboard/PanelGroup'
  28. import LineChart from './dashboard/LineChart'
  29. import RaddarChart from './dashboard/RaddarChart'
  30. import PieChart from './dashboard/PieChart'
  31. import BarChart from './dashboard/BarChart'
  32. const lineChartData = {
  33. newVisitis: {
  34. expectedData: [100, 120, 161, 134, 105, 160, 165],
  35. actualData: [120, 82, 91, 154, 162, 140, 145]
  36. },
  37. messages: {
  38. expectedData: [200, 192, 120, 144, 160, 130, 140],
  39. actualData: [180, 160, 151, 106, 145, 150, 130]
  40. },
  41. purchases: {
  42. expectedData: [80, 100, 121, 104, 105, 90, 100],
  43. actualData: [120, 90, 100, 138, 142, 130, 130]
  44. },
  45. shoppings: {
  46. expectedData: [130, 140, 141, 142, 145, 150, 160],
  47. actualData: [120, 82, 91, 154, 162, 140, 130]
  48. }
  49. }
  50. export default {
  51. name: 'Index',
  52. components: {
  53. PanelGroup,
  54. LineChart,
  55. RaddarChart,
  56. PieChart,
  57. BarChart
  58. },
  59. data() {
  60. return {
  61. lineChartData: lineChartData.newVisitis
  62. }
  63. },
  64. methods: {
  65. handleSetLineChartData(type) {
  66. this.lineChartData = lineChartData[type]
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .dashboard-editor-container {
  73. padding: 32px;
  74. background-color: rgb(240, 242, 245);
  75. position: relative;
  76. .chart-wrapper {
  77. background: #fff;
  78. padding: 16px 16px 0;
  79. margin-bottom: 32px;
  80. }
  81. }
  82. @media (max-width:1024px) {
  83. .chart-wrapper {
  84. padding: 8px;
  85. }
  86. }
  87. </style>