This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.vue
172 lines (166 loc) · 4.64 KB
/
index.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<template>
<div>
<title-bar :title-stack="titleStack" />
<hero-bar :has-right-visible="false">
Dashboard
</hero-bar>
<section class="section is-main-section">
<tiles>
<card-widget
class="tile is-child"
type="is-primary"
icon="account-multiple"
:number="512"
label="Clients"
/>
<card-widget
class="tile is-child"
type="is-info"
icon="cart-outline"
:number="7770"
prefix="$"
label="Sales"
/>
<card-widget
class="tile is-child"
type="is-success"
icon="chart-timeline-variant"
:number="256"
suffix="%"
label="Performance"
/>
</tiles>
<card-component
title="Performance"
icon="finance"
header-icon="reload"
@header-icon-click="fillChartData"
>
<div v-if="defaultChart.chartData" class="chart-area">
<line-chart
ref="bigChart"
style="height: 100%;"
chart-id="big-line-chart"
:chart-data="defaultChart.chartData"
:extra-options="defaultChart.extraOptions"
>
</line-chart>
</div>
</card-component>
<card-component title="Clients" class="has-table has-mobile-sort-spaced">
<clients-table-sample
:data-url="`${$router.options.base}data-sources/clients.json`"
/>
</card-component>
</section>
</div>
</template>
<script>
// @ is an alias to /src
import * as chartConfig from '@/components/Charts/chart.config'
import TitleBar from '@/components/TitleBar'
import HeroBar from '@/components/HeroBar'
import Tiles from '@/components/Tiles'
import CardWidget from '@/components/CardWidget'
import CardComponent from '@/components/CardComponent'
import LineChart from '@/components/Charts/LineChart'
import ClientsTableSample from '@/components/ClientsTableSample'
export default {
name: 'Home',
components: {
ClientsTableSample,
LineChart,
CardComponent,
CardWidget,
Tiles,
HeroBar,
TitleBar,
},
data() {
return {
defaultChart: {
chartData: null,
extraOptions: chartConfig.chartOptionsMain,
},
}
},
computed: {
titleStack() {
return ['Admin', 'Dashboard']
},
},
mounted() {
this.fillChartData()
this.$buefy.snackbar.open({
message: 'Welcome back',
queue: false,
})
},
methods: {
randomChartData(n) {
const data = []
for (let i = 0; i < n; i++) {
data.push(Math.round(Math.random() * 200))
}
return data
},
fillChartData() {
this.defaultChart.chartData = {
datasets: [
{
fill: false,
borderColor: chartConfig.chartColors.default.primary,
borderWidth: 2,
borderDash: [],
borderDashOffset: 0.0,
pointBackgroundColor: chartConfig.chartColors.default.primary,
pointBorderColor: 'rgba(255,255,255,0)',
pointHoverBackgroundColor: chartConfig.chartColors.default.primary,
pointBorderWidth: 20,
pointHoverRadius: 4,
pointHoverBorderWidth: 15,
pointRadius: 4,
data: this.randomChartData(9),
},
{
fill: false,
borderColor: chartConfig.chartColors.default.info,
borderWidth: 2,
borderDash: [],
borderDashOffset: 0.0,
pointBackgroundColor: chartConfig.chartColors.default.info,
pointBorderColor: 'rgba(255,255,255,0)',
pointHoverBackgroundColor: chartConfig.chartColors.default.info,
pointBorderWidth: 20,
pointHoverRadius: 4,
pointHoverBorderWidth: 15,
pointRadius: 4,
data: this.randomChartData(9),
},
{
fill: false,
borderColor: chartConfig.chartColors.default.danger,
borderWidth: 2,
borderDash: [],
borderDashOffset: 0.0,
pointBackgroundColor: chartConfig.chartColors.default.danger,
pointBorderColor: 'rgba(255,255,255,0)',
pointHoverBackgroundColor: chartConfig.chartColors.default.danger,
pointBorderWidth: 20,
pointHoverRadius: 4,
pointHoverBorderWidth: 15,
pointRadius: 4,
data: this.randomChartData(9),
},
],
labels: ['01', '02', '03', '04', '05', '06', '07', '08', '09'],
}
},
},
head() {
return {
title: 'Dashboard — Admin One Nuxt.js',
}
},
}
</script>