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