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