yangyin
2024-07-17 f01ac8e1c5f3f48e680f805160c378696a23bf47
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html lang="en" >
 
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>类型分布</title>
    <script src="/customer_list/ch/ai_html/views/demo/js/tailwind.js"></script>
    <script src="/customer_list/ch/ai_html/views/demo/js/vue.global.js"></script>
    <script src="/customer_list/ch/ai_html/views/demo/js/iframe-resizer/child-5.1.5.js" async></script>
    <link href="/customer_list/ch/static/fonts/iconfont/iconfont.css" rel="stylesheet" type="text/css">
    </link>
    <script src="/customer_list/ch/ai_html/views/demo/js/echarts.min.js"></script>
</head>
 
<body>
    <div class="w-full h-full bg-[#fff] px-10 py-0" id="monthlyPay">
        <div class="w-full h-[270px]" id="MonthlyPayChart">
        </div>
        <div class="w-full h-[270px]" id="MonthPayRecord">
        </div>
        <div class="w-full h-[370px]" id="MonthPayAmount">
        </div>
    </div>
</body>
<script>
    const { createApp, onMounted, ref, reactive } = Vue;
 
    createApp({
        setup() {
            const initMonthlyPayEChart = () => {
                const chartDom = document.getElementById('MonthlyPayChart');
                const myChart = echarts.init(chartDom);
                const data = [{ "name": 1596038400000, "value": [1596038400000, 53] }, { "name": 1596039040000, "value": [1596039040000, 51] }, { "name": 1596039680000, "value": [1596039680000, 51] }, { "name": 1596040320000, "value": [1596040320000, 51] }, { "name": 1596040832000, "value": [1596040832000, 58] }, { "name": 1596041472000, "value": [1596041472000, 67] }, { "name": 1596042112000, "value": [1596042112000, 68] }, { "name": 1596042624000, "value": [1596042624000, 54] }, { "name": 1596043264000, "value": [1596043264000, 51] }, { "name": 1596043904000, "value": [1596043904000, 57] }, { "name": 1596044416000, "value": [1596044416000, 52] }, { "name": 1596045056000, "value": [1596045056000, 54] }, { "name": 1596045696000, "value": [1596045696000, 51] }, { "name": 1596046208000, "value": [1596046208000, 51] }, { "name": 1596046848000, "value": [1596046848000, 52] }, { "name": 1596047488000, "value": [1596047488000, 51] }, { "name": 1596048000000, "value": [1596048000000, 53] }, { "name": 1596048640000, "value": [1596048640000, 52] }, { "name": 1596049280000, "value": [1596049280000, 67] }, { "name": 1596049920000, "value": [1596049920000, 59] }, { "name": 1596050432000, "value": [1596050432000, 58] }, { "name": 1596051072000, "value": [1596051072000, 52] }, { "name": 1596051712000, "value": [1596051712000, 55] }, { "name": 1596052224000, "value": [1596052224000, 53] }, { "name": 1596052864000, "value": [1596052864000, 54] }, { "name": 1596053504000, "value": [1596053504000, 54] }, { "name": 1596054016000, "value": [1596054016000, 54] }, { "name": 1596054656000, "value": [1596054656000, 52] }, { "name": 1596055296000, "value": [1596055296000, 54] }, { "name": 1596055808000, "value": [1596055808000, 65] }, { "name": 1596056448000, "value": [1596056448000, 59] }, { "name": 1596057088000, "value": [1596057088000, 55] }, { "name": 1596057600000, "value": [1596057600000, 53] }, { "name": 1596058240000, "value": [1596058240000, 55] }, { "name": 1596058880000, "value": [1596058880000, 54] }, { "name": 1596059520000, "value": [1596059520000, 55] }, { "name": 1596060032000, "value": [1596060032000, 64] }, { "name": 1596060672000, "value": [1596060672000, 57] }, { "name": 1596061312000, "value": [1596061312000, 56] }, { "name": 1596061824000, "value": [1596061824000, 55] }, { "name": 1596062464000, "value": [1596062464000, 55] }, { "name": 1596063104000, "value": [1596063104000, 55] }, { "name": 1596063616000, "value": [1596063616000, 58] }, { "name": 1596064256000, "value": [1596064256000, 79] }, { "name": 1596064896000, "value": [1596064896000, 60] }, { "name": 1596065408000, "value": [1596065408000, 63] }, { "name": 1596066048000, "value": [1596066048000, 63] }, { "name": 1596066688000, "value": [1596066688000, 82] }, { "name": 1596067200000, "value": [1596067200000, 81] }, { "name": 1596067840000, "value": [1596067840000, 78] }, { "name": 1596068480000, "value": [1596068480000, 78] }, { "name": 1596069120000, "value": [1596069120000, 65] }, { "name": 1596069632000, "value": [1596069632000, 76] }, { "name": 1596070272000, "value": [1596070272000, 80] }, { "name": 1596070912000, "value": [1596070912000, 78] }, { "name": 1596107040000, "value": [1596107040000, 70] }, { "name": 1596124799000, "value": [1596124799000, 0] }];
                //下面是一个简单的demo,方便展示数据格式和构成
                let option = {
                    title: {
                        text: '缴费占比',
                        textStyle:{
                            fontSize:13
                        }
                    },
                    legend: {},
                    tooltip: {
                        trigger: 'axis',
                        formatter: function (params) {
                            params = params[0];
                            var date = new Date(params.name);
                            var hour = date.getHours();
                            var minutes = date.getMinutes();
                            if (hour < 10) {
                                hour = '0' + hour;
                            }
                            if (minutes < 10) {
                                minutes = '0' + minutes;
                            }
                            var dateStr = hour + ':' + minutes;
                            return dateStr + ' ' + params.value[1];
                        },
                        axisPointer: {
                            animation: false
                        }
                    },
                    xAxis: {
                        type: 'time',
                        splitLine: {
                            show: false
                        },
                        splitNumber: 8,
                        axisLine: {
                            lineStyle: {
                                color: '#1B2232'
                            }
                        },
                        axisLabel: {
                            formatter: function (value, index) {
                                var date = new Date(value);
                                var hour = date.getHours();
                                var minutes = date.getMinutes();
                                if (hour < 10) {
                                    hour = '0' + hour;
                                }
                                if (minutes < 10) {
                                    minutes = '0' + minutes;
                                }
                                return hour + ':' + minutes;
                            },
                            color: '#1B2232'
                        }
                    },
                    yAxis: {
                        name: '数据',
                        nameTextStyle: {
                            color: '#1B2232',
                            fontSize: 15
                        },
                        type: 'value',
                        boundaryGap: [0, '100%'],
                        splitLine: {
                            show: false
                        },
                        axisLine: {
                            lineStyle: {
                                color: '#1B2232'
                            }
                        },
                        axisLabel: {
                            color: '#1B2232'
                        }
                    },
                    series: [{
                        name: '',
                        type: 'line',
                        hoverAnimation: false,
                        smooth: true,
                        symbolSize: 4,
                        data: data
 
                    }]
                };
                option && myChart.setOption(option);
                myChart && myChart.resize();
            }
            const initMonthPayRecordEChart = () => {
                const chartDom = document.getElementById('MonthPayRecord');
                const myMonthPayChart = echarts.init(chartDom);
                var monthPayOption = {
                    title: {
                        text: '近12个月的缴费记录',
                        textStyle:{
                            fontSize:13
                        }
                    },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'cross',
                            label: {
                                backgroundColor: '#6a7985'
                            }
                        }
                    },
                    legend: {
                        data: ['厦门', '二供', '集美', '海沧', '翔安']
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    grid: {
                        top:'23%',
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [
                        {
                            type: 'category',
                            boundaryGap: false,
                            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value'
                        }
                    ],
                    series: [
                        {
                            name: '厦门',
                            type: 'line',
                            stack: 'Total',
                            areaStyle: {},
                            emphasis: {
                                focus: 'series'
                            },
                            data: [120, 132, 101, 134, 90, 230, 210]
                        },
                        {
                            name: '二供',
                            type: 'line',
                            stack: 'Total',
                            areaStyle: {},
                            emphasis: {
                                focus: 'series'
                            },
                            data: [220, 182, 191, 234, 290, 330, 310]
                        },
                        {
                            name: '集美',
                            type: 'line',
                            stack: 'Total',
                            areaStyle: {},
                            emphasis: {
                                focus: 'series'
                            },
                            data: [150, 232, 201, 154, 190, 330, 410]
                        },
                        {
                            name: '海沧',
                            type: 'line',
                            stack: 'Total',
                            areaStyle: {},
                            emphasis: {
                                focus: 'series'
                            },
                            data: [320, 332, 301, 334, 390, 330, 320]
                        },
                        {
                            name: '翔安',
                            type: 'line',
                            stack: 'Total',
                            label: {
                                show: true,
                                position: 'top'
                            },
                            areaStyle: {},
                            emphasis: {
                                focus: 'series'
                            },
                            data: [820, 932, 901, 934, 1290, 1330, 1320]
                        }
                    ]
                };
 
                monthPayOption && myMonthPayChart.setOption(monthPayOption);
                myMonthPayChart && myMonthPayChart.resize();
            }
            const initMonthPayAmountEChart = () => {
                const chartDom = document.getElementById('MonthPayAmount');
                const myMonthPayAmountChart = echarts.init(chartDom);
                var monthPayAmountOption = {
                    title: {
                        text: '近12个月的缴费金额',
                        textStyle:{
                            fontSize:13
                        }
                    },
                    tooltip: {},
                    legend: {},
                    xAxis: {
                        data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月"]
                    },
                    yAxis: {},
                    series: [{
                        name: "Sale",
                        type: "bar",
                        data: [5, 20, 36, 10, 10, 20, 4]
                    }]
                }
                monthPayAmountOption && myMonthPayAmountChart.setOption(monthPayAmountOption);
                myMonthPayAmountChart && myMonthPayAmountChart.resize();
            }
            onMounted(() => {
                initMonthlyPayEChart();
                initMonthPayRecordEChart()
                initMonthPayAmountEChart()
            });
 
 
        },
    }).mount('#monthlyPay');
</script>
 
</html>