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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
| <!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="/ai_html/views/demo/js/tailwind.js"></script>
| <script src="/ai_html/views/demo/js/vue.global.js"></script>
| <script src="/ai_html/views/demo/js/datav.umd.js"></script>
| <script src="/ai_html/views/demo/js/index.full.js"></script>
| <script src="/ai_html/views/demo/js/iframe-resizer/child-5.1.5.js" async></script>
| <script src="/ai_html/views/demo/js/echarts.min.js"></script>
| <script src="/ai_html/views/demo/js/customInstruction.js"></script>
| <link href="/ai_html/views/demo/css/variablesDemo.css" rel="stylesheet" type="text/css" />
| <link href="/static/fonts/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
| <link href="/ai_html/views/demo/css/ele-index.css" rel="stylesheet" type="text/css" />
| <style>
| .el-dialog__header {
| margin-right: 0;
| padding: 8px 10px;
| background: #528abe;
| }
|
| .el-dialog__title {
| color: #fff;
| font-size: 14px;
| }
|
| .el-dialog__close {
| color: #fff !important;
| }
| </style>
| </head>
|
| <body>
| <div class="w-full h-full bg-[#f2f4f8]" id="overview">
| <div class="screen-top-center">
| <div class="top-center-data">
| <div class="data-item" v-for="(item, index) in state.dataList">
| <p class="data-item-title">{{item.title}}</p>
| <p class="data-item-desc cursor-pointer" @click="handleDataItemClick(item)">{{item.value}}</p>
| </div>
| </div>
| <div class="top-center-chart">
| <div class="chart-item">
| <div class="screen-top-header flex flex-wrap justify-center items-center">
| <div class="header-left flex-c">
| <i class="myiconfont icon-ico_shuju text-[#1c86ff]"></i>
| </div>
| <div class="header-right flex-l">
| <span class="header-title">今日地区销量排行</span>
| <Decoration3 class="dv-dec-3" />
| </div>
| </div>
| <div class="max-w-[600px] h-full ml-[5px]">
| <div v-for="(item,index) in state.rankList.data" :key="index" class="flex">
| <div class="text-[16px] text-[#000] w-[70px]">{{item.name}}</div>
|
| <el-progress
| :stroke-width="20"
| :percentage="item.value/100"
| class="mb-[15px] w-full"
| :text-inside="true"
| ></el-progress>
| <div class="text-[12px] text-[#000] w-[70px] ml-[10px]">{{item.value}}</div>
| </div>
| </div>
| </div>
| <div class="chart-item">
| <div class="screen-top-header flex-l">
| <div class="header-left flex-c">
| <i class="myiconfont icon-shangchuan text-[#1c86ff]"></i>
| </div>
| <div class="header-right flex-l">
| <span class="header-title">今日业绩完成度</span>
| <Decoration3 class="dv-dec-3" />
| </div>
| </div>
| <div class="pond-section" v-resize="chartContainerResize">
| <div id="pond" class="w-full h-[270px]"></div>
| </div>
| </div>
| </div>
| </div>
| <el-dialog
| v-model="state.isShowChartVisible"
| :title="state.volumeInfo.title"
| width="50%"
| class="px-[unset] py-[unset]"
| :before-close="handleCloseChartVisible"
| >
| <div id="businessTrends" class="w-full h-[500px]" v-resize="chartContainerResize"></div>
| </el-dialog>
| </div>
| </body>
| <script>
| const { createApp, onMounted, ref, reactive, nextTick } = Vue;
| const { Decoration3 } = DataV;
| const demoOverViewChart = ref(null);
| const demoBusinessTrendsChart = ref(null);
| const App = createApp({
| setup() {
| let state = reactive({
| annualPayment: [
| {
| ID: 1,
| Name: '本年缴费',
| Value: 8009987,
| Unit: '笔',
| },
| {
| ID: 2,
| Name: '缴费金额',
| Value: 7298.3,
| Unit: '万元',
| },
| {
| ID: 3,
| Name: '本月缴费',
| Value: 198,
| Unit: '笔',
| },
| {
| ID: 4,
| Name: '缴费金额',
| Value: 3,
| Unit: '万元',
| },
| {
| ID: 5,
| Name: '本月缴费',
| Value: 22,
| Unit: '笔',
| },
| {
| ID: 6,
| Name: '缴费金额',
| Value: 0.3,
| Unit: '万元',
| },
| {
| ID: 7,
| Name: '今日实时',
| Value: 198,
| Unit: '笔',
| },
| {
| ID: 8,
| Name: '缴费金额',
| Value: 198,
| Unit: '万元',
| },
| ],
| dataList: [
| {
| id: 1,
| title: '今日累计销量',
| value: 755,
| },
| {
| id: 2,
| title: '本周累计销量',
| value: 3288,
| },
| {
| id: 3,
| title: '本月累计销量',
| value: 14222,
| },
| {
| id: 4,
| title: '季度累计销量',
| value: 41022,
| },
| {
| id: 5,
| title: '年度累计销量',
| value: 176888,
| },
| {
| id: 6,
| title: '今日目标销量',
| value: 820,
| },
| ],
| completeObj: {
| data: [45, 56],
| shape: 'round',
| },
| rankList: {
| data: [
| {
| name: '武汉市',
| value: 1210,
| },
| {
| name: '北京',
| value: 1655,
| },
| {
| name: '上海',
| value: 1788,
| },
| {
| name: '深圳',
| value: 2100,
| },
| {
| name: '广州',
| value: 1577,
| },
| {
| name: '成都',
| value: 1625,
| },
| {
| name: '厦门',
| value: 857,
| },
| {
| name: '郑州',
| value: 1322,
| },
| ],
| carousel: 'single',
| unit: '辆',
| },
| intervalInstance: 0,
| isShowChartVisible: false,
| volumeInfo: {
| id: null,
| title: null,
| value: null,
| },
| });
| const getOverViewList = () => {
| const iconList = [
| 'biaodan',
| 'putong',
| 'zhongduancanshuchaxun',
| 'shidu',
| 'fuwenbenkuang',
| 'fuwenben',
| 'jiliandongxuanzeqi',
| 'jinridaiban',
| 'gongju',
| ];
| state.annualPayment.forEach((annual, index) => {
| annual.Icon = iconList[index];
| annual.BgColor = randomHexColor();
| });
| };
| //随机生成颜色
| const randomHexColor = () => {
| return `#${Math.floor(Math.random() * 16777215)
| .toString(16)
| .padEnd(6, '0')}`;
| };
| onMounted(() => {
| // getOverViewList();
| initOverViewEchart();
| });
| //初始化今日业绩完成度echart
| const initOverViewEchart = () => {
| var chartDom = document.getElementById('pond');
| var myChart = echarts.init(chartDom);
| var dataCake = [
| { value: 2562, name: '优质', percentage: '15.86%' },
| { value: 6000, name: '良好', percentage: '37.15%' },
| { value: 2589, name: '一般', percentage: '16.03%' },
| { value: 4000, name: '较差', percentage: '24.77%' },
| { value: 1000, name: '恶劣', percentage: '6.19%' },
| ];
| demoOverViewChart.value = myChart;
| var option = {
| tooltip: {
| trigger: 'item',
| },
| legend: {
| orient: 'vertical',
| left: '54%',
| y: 'center',
|
| formatter: function (name) {
| let target, percentage;
| for (let i = 0; i < dataCake.length; i++) {
| if (dataCake[i].name === name) {
| target = dataCake[i].value;
| percentage = dataCake[i].percentage;
| }
| }
| let arr = [name + ' ', ' ' + target + '人 ', ' ' + percentage];
| return arr.join(' ');
| },
| },
| grid: {
| left: '25',
| },
| series: [
| {
| name: '今日业绩完成度',
| type: 'pie',
| radius: ['40%', '60%'],
| center: ['30%', '50%'],
| avoidLabelOverlap: false,
| label: {
| show: false,
| position: 'center',
| },
|
| labelLine: {
| show: false,
| },
| data: dataCake,
| },
| ],
| };
|
| option && myChart.setOption(option);
| };
| //初始化弹窗echart
| const initBusinessTrendsEchart = () => {
| var chartDom = document.getElementById('businessTrends');
| var businessTrendsChart = echarts.init(chartDom);
| demoBusinessTrendsChart.value = businessTrendsChart;
| const option = {
| tooltip: {
| trigger: 'axis',
| },
| grid: {
| left: '3%', // 调整左边距
| right: '5%', // 调整右边距
| bottom: '3%', // 调整底部边距
| top: '5%', // 调整顶部边距
| containLabel: true, // 确保标签和轴标题被包含在容器内
| },
| xAxis: {
| name: '时间',
| type: 'category',
| minInterval: 3600 * 4 * 1000, //12
| data: ['00:00', '05:00', '10:00', '15:00', '20:00', '23:45'],
| },
| yAxis: {
| type: 'value',
| axisLabel: {
| formatter: '{value}',
| },
| },
| dataZoom: {
| type: 'inside',
| },
| series: [
| {
| name: '销售额',
| type: 'line',
| data: [620, 1032, 701, 1234, 890, 1430, 1320, 1230, 1320, 1430, 1320], // 示例数据,模拟起伏更大
| smooth: true, // 折线平滑
| lineStyle: {
| width: 2,
| color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
| { offset: 0, color: '#62c1fe' },
| { offset: 0.5, color: '#ad90f7' },
| { offset: 1, color: '#e875f2' },
| ]),
| },
| symbolSize: (value, params) => {
| // 获取数据系列的长度
| const seriesLength = option.series[0].data.length;
| // 中间节点放大
| if (params.dataIndex === Math.floor(seriesLength / 2)) {
| return 8; // 中间节点的大小
| }
| return 8; // 其他节点的大小
| },
| },
| ],
| };
| option && businessTrendsChart.setOption(option);
| };
| //点击数据项弹窗
| const handleDataItemClick = (item) => {
| state.volumeInfo = item;
| nextTick(() => {
| initBusinessTrendsEchart();
| });
| state.isShowChartVisible = true;
| };
| //关闭弹窗
| const handleCloseChartVisible = () => {
| state.isShowChartVisible = false;
| };
| const chartContainerResize = ({ width, height }) => {
| demoOverViewChart.value.resize();
| demoBusinessTrendsChart.value.resize();
| };
| return { state, handleDataItemClick, handleCloseChartVisible, chartContainerResize };
| },
| });
|
| App.component('Decoration3', Decoration3);
| elementResizeDirective(App);
| App.use(ElementPlus);
| App.mount('#overview');
| </script>
| </html>
|
|