detail.vue
3.87 KB
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
<template>
<div class="statusdetail">
<el-dialog
title="活动状态"
:visible.sync="show"
width="40%"
:before-close="handleClose">
<div v-show="curshow == 'chart'" class="report-select">
<el-select class="flr" v-model="period" @change="chageperiod">
<el-option label="天" value="day"></el-option>
<el-option label="周" value="week"></el-option>
<el-option label="月" value="month"></el-option>
</el-select>
</div>
<div class="activitychart" id="activitychart" v-show="curshow == 'chart'"></div>
<div class="imgbox" v-show="curshow == 'img'"></div>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">取 消</el-button>
<el-button type="primary" @click="show = false">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
show:false,
detaildata:'',
curshow:'img',
period:'week',
xdata:['01','02','03','04','05','06'],
apperadata:[23,60,20,36,23,85]
}
},
methods:{
initImg(){
this.show = true
this.curshow = 'img'
},
chageperiod(){
this.xdata = ['00:00','00:01','00:02','00:03','00:04','00:05']
this.apperadata = [123,60,32,36,213,85]
this.initchart()
},
initchart(data){
this.show = true;
this.curshow = 'chart'
this.detaildata = data
setTimeout(() => {
this.initactivityChart(this.data)
}, 0);
},
initactivityChart(){
var chart = this.$echarts.init(document.getElementById('activitychart'))
var option = {
tooltip: {
trigger: 'axis'
},
xAxis: [{
type: 'category',
data: this.xdata,
axisLine: {
lineStyle: {
color: "#999"
}
}
}],
yAxis: [{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD'
}
},
axisLine: {
show: false,
lineStyle: {
color: "#333"
},
},
nameTextStyle: {
color: "#999"
},
splitArea: {
show: false
}
}],
series: [{
name: '次数',
type: 'line',
data: this.apperadata,
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
colorStops: [{
offset: 0,
color: '#A9F387' // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20
}
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: "#A9F387"
}
},
smooth: true
}]
};
chart.setOption(option)
}
},
mounted(){
}
}
</script>
<style lang="stylus" scoped>
.activitychart{
height 40vh
width 40vw
}
.report-select{
width 100%
overflow hidden
}
</style>