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
| /**
| * 角色管理的单例
| */
| var Statistics = {
| type: 1
| };
|
|
|
| /**
| * 搜索
| */
| Statistics.search = function () {
| let quarter = '';
| let dataType = $('#dateType').val();
| if(dataType == 1){
| if($('#dayTime').val() == null || $('#dayTime').val() == '' ){
|
| let end = new Date().format("yyyy-MM-dd");
| let start = new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * 30)).format("yyyy-MM-dd");
| time = start + ' - ' + end;
| }else {
| time = $('#dayTime').val();
| }
| }
| if(dataType == 2){
| time = $('#monthTime').val();
| }
| if(dataType == 3){
| time = $('#quarterTime').val();
| quarter = $('#quarter').val();
| }
| if(dataType == 4){
| time = $('#yearTime').val();
| }
| var ajax = new $ax(Feng.ctxPath + "/statistics/queryVipLevelNumberSummaryGraph", function (res) {
| if(res.code == 200){
| let data = res.data.data;
| let date = res.data.date;
| let names = [];
| let series = [];
| for(let i in data){
| names.push(data[i].vipLevel);
| series.push({
| name: data[i].vipLevel,
| data: data[i].data,
| type: 'line',
| showSymbol: true
| })
| }
|
|
| let chartDom = document.getElementById("container");
| let myChart = echarts.init(chartDom);
| let option;
| option = {
| title: {
| text: Statistics.type == 1 ? '当前等级人数' : '权益领取人数'
| },
| tooltip: {
| trigger: 'axis',
| axisPointer: {
| type: 'cross',
| animation: false,
| label: {
| backgroundColor: '#ccc',
| borderColor: '#aaa',
| borderWidth: 1,
| shadowBlur: 0,
| shadowOffsetX: 0,
| shadowOffsetY: 0,
| color: '#222'
| }
| }
| },
| legend: {
| data: names
| },
| toolbox: {
| show: true,
| },
| grid: {
| left: '3%',
| right: '4%',
| bottom: '3%',
| containLabel: true
| },
| xAxis: {
| type: 'category',
| data: date
| },
| yAxis: {
| type: 'value',
| min: function (value) {
| return Math.floor(value.min);
| },
| max: function (value) {
| return Math.ceil(value.max);
| },
| },
| series: series
| };
| // 使用刚指定的配置项和数据显示图表。
| myChart.setOption(option);
| }else{
| Feng.error(data.msg);
| }
| }, function (data) {
| Feng.error("获取失败!" + data.responseJSON.message + "!");
| });
| ajax.setData({
| type: Statistics.type,
| dateType: dataType,
| time: time,
| quarter: quarter
| });
| ajax.start();
| }
|
| /**
| * 重置
| */
| Statistics.resetSearch = function(){
| let end = new Date().format("yyyy-MM-dd");
| let start = new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * 30)).format("yyyy-MM-dd");
| $("#dayTime").val(start + ' - ' + end);
| $('#dateType').val(1);
| $('#dateType').change();
| Statistics.search();
| }
|
|
| $(function () {
| Statistics.search();
|
| $('#dateType').on('change', function () {
| let dateType = $(this).val();
| if(dateType == 1){
| $('.day').show();
| $('.month').hide();
| $('.quarter').hide();
| $('.year').hide();
| }
| if(dateType == 2){
| $('.day').hide();
| $('.month').show();
| $('.quarter').hide();
| $('.year').hide();
| }
| if(dateType == 3){
| $('.day').hide();
| $('.month').hide();
| $('.quarter').show();
| $('.year').hide();
| }
| if(dateType == 4){
| $('.day').hide();
| $('.month').hide();
| $('.quarter').hide();
| $('.year').show();
| }
| })
| });
|
|