移动报表项目指南
旭日图
DETAILS
<template>
<div class="sales-sun">
<div class="sales-sun-inner">
<vue-echarts :options="options" />
</div>
</div>
</template>
<script>
export default {
name: 'SalesSun',
data () {
return {
options: {}
}
},
mounted () {
const colors = ['rgb(0,211,255)', 'rgb(0,123,255)', 'rgb(0,218,234)', 'rgb(35,69,145)', '#9A2555']
const bgColor = '#2E2733'
const itemStyle = {
star5: {
color: colors[0]
},
star4: {
color: colors[1]
},
star3: {
color: colors[2]
},
star2: {
color: colors[3]
}
}
const data = [{
name: '小食',
itemStyle: {
color: colors[1]
},
children: [{
name: '奶茶',
children: [{
name: '5☆',
children: [{
name: '港式奶茶'
}, {
name: '珍珠奶茶'
}]
}]
}, {
name: '串串',
children: [{
name: '5☆',
children: [{
name: '羊肉串'
}]
}, {
name: '4☆',
children: [{
name: '牛肉串'
}, {
name: '猪肉串'
}]
}, {
name: '3☆',
children: [{
name: '其他'
}]
}]
}]
}, {
name: '主食',
itemStyle: {
color: colors[2]
},
children: [{
name: '米饭',
children: [{
name: '5☆',
children: [{
name: '王者炒饭'
}]
}, {
name: '4☆',
children: [{
name: '套餐'
}, {
name: '轻食'
}]
}]
}, {
name: '粥',
children: [{
name: '5☆',
children: [{
name: '牛肉粥'
}]
}, {
name: '4☆',
children: [{
name: '白米粥'
}, {
name: '红豆粥'
}]
}]
}, {
name: '西餐',
children: [{
name: '5☆',
children: [{
name: '汉堡'
}]
}, {
name: '4☆',
children: [{
name: '薯条'
}, {
name: '薯饼'
}]
}]
}]
}]
for (let j = 0; j < data.length; ++j) {
const level1 = data[j].children
for (let i = 0; i < level1.length; ++i) {
const block = level1[i].children
const bookScore = []
let bookScoreId
for (let star = 0; star < block.length; ++star) {
let style = (function (name) {
switch (name) {
case '5☆':
bookScoreId = 0
return itemStyle.star5
case '4☆':
bookScoreId = 1
return itemStyle.star4
case '3☆':
bookScoreId = 2
return itemStyle.star3
case '2☆':
bookScoreId = 3
return itemStyle.star2
}
})(block[star].name)
block[star].label = {
color: style.color,
downplay: {
opacity: 0.5
}
}
if (block[star].children) {
style = {
opacity: 1,
color: style.color
}
block[star].children.forEach(function (book) {
book.value = 1
book.itemStyle = style
book.label = {
color: style.color
}
let value = 1
if (bookScoreId === 0 || bookScoreId === 3) {
value = 5
}
if (bookScore[bookScoreId]) {
bookScore[bookScoreId].value += value
} else {
bookScore[bookScoreId] = {
color: colors[bookScoreId],
value: value
}
}
})
}
}
level1[i].itemStyle = {
color: data[j].itemStyle.color
}
}
}
// 渲染echarts旭日图
this.options = {}
}
}
</script>
<style lang="scss" scoped>
.sales-sun {
position: absolute;
top: 2450px;
left: 0;
z-index: 10;
width: 100%;
height: 800px;
padding: 25px 25px 0;
box-sizing: border-box;
.sales-sun-inner {
width: 100%;
height: 100%;
background: rgba(255, 255, 255, .05);
}
}
</style>
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
雷达图
DETAILS
<template>
<div class="sales-radar">
<div class="sales-radar-inner">
<vue-echarts :options="options" />
</div>
</div>
</template>
<script>
export default {
name: 'SalesRadar',
data () {
return {
options: {}
}
},
mounted () {
// 渲染echarts雷达图
this.options = {}
}
}
</script>
<style lang="scss" scoped>
.sales-radar {
position: absolute;
top: 3250px;
left: 0;
z-index: 10;
width: 100%;
height: 800px;
padding: 25px 25px 0;
box-sizing: border-box;
.sales-radar-inner {
width: 100%;
height: 100%;
background: rgba(255, 255, 255, .05);
}
}
</style>
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
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
← svg 组件