From f0fcda1e20ec7f29070992d363c7bbfb86c43ee5 Mon Sep 17 00:00:00 2001 From: tangzh Date: Fri, 18 Jul 2025 10:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eladmin-web/src/views/dashboard/LineChart.vue | 10 +++- .../system/rest/DashboardController.java | 4 +- .../system/service/DashboardService.java | 2 +- .../service/impl/DashboardServiceImpl.java | 5 +- .../mapper/system/DashboardMapper.xml | 48 ++++++++----------- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/eladmin-web/src/views/dashboard/LineChart.vue b/eladmin-web/src/views/dashboard/LineChart.vue index e1b18d2..93dd917 100644 --- a/eladmin-web/src/views/dashboard/LineChart.vue +++ b/eladmin-web/src/views/dashboard/LineChart.vue @@ -62,9 +62,15 @@ export default { this.setOptions(this.chartData) }, setOptions({ data } = {}) { // , actualData + let titleList = []; + let dataList = []; + data.forEach(function (rItem) { + titleList.push(rItem.text) + dataList.push(rItem.value) + }); this.chart.setOption({ xAxis: { - data: ['前一天', '前两天', '前三天', '前四天', '前五天', '前六天', '前七天'], + data: titleList, boundaryGap: false, axisTick: { show: false @@ -104,7 +110,7 @@ export default { }, smooth: true, type: 'line', - data: data, + data: dataList, animationDuration: 2800, animationEasing: 'cubicInOut' }, diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DashboardController.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DashboardController.java index 6d33244..b00a980 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DashboardController.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DashboardController.java @@ -34,8 +34,8 @@ public class DashboardController { @ApiOperation("折线图数据") @GetMapping("/lineChartData") - public ResponseEntity> getLineChartData(String type) { - List data = dashboardService.getLineChartData(type); + public ResponseEntity> getLineChartData(String type) { + List data = dashboardService.getLineChartData(type); return new ResponseEntity<>(data, HttpStatus.OK); } diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DashboardService.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DashboardService.java index cfdc9bf..08c5de7 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DashboardService.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DashboardService.java @@ -24,7 +24,7 @@ public interface DashboardService { Map getCardData(); - List getLineChartData(String type); + List getLineChartData(String type); List getPieChatData(); diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DashboardServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DashboardServiceImpl.java index 9bc437c..75fde2c 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DashboardServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DashboardServiceImpl.java @@ -39,10 +39,9 @@ public class DashboardServiceImpl implements DashboardService { } @Override - public List getLineChartData(String type) { + public List getLineChartData(String type) { List data = dashboardMapper.getLineChartData(type); - List values = data.stream().map(i -> Integer.parseInt(i.getValue().toString())).collect(Collectors.toList()); - return values; + return data; } @Override diff --git a/eladmin/eladmin-system/src/main/resources/mapper/system/DashboardMapper.xml b/eladmin/eladmin-system/src/main/resources/mapper/system/DashboardMapper.xml index 8919991..6ac37e2 100644 --- a/eladmin/eladmin-system/src/main/resources/mapper/system/DashboardMapper.xml +++ b/eladmin/eladmin-system/src/main/resources/mapper/system/DashboardMapper.xml @@ -20,40 +20,32 @@