From 3be2e099bbc05e902dfcfabc403ade0a2aba8ef4 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 21 Jul 2025 15:12:44 +0800
Subject: [PATCH] feat:数据中心优化
---
src/views/wel/components/taskOutcome.vue | 43 +++++++++++++++++++------------------------
1 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/src/views/wel/components/taskOutcome.vue b/src/views/wel/components/taskOutcome.vue
index fc8fd50..e8186e6 100644
--- a/src/views/wel/components/taskOutcome.vue
+++ b/src/views/wel/components/taskOutcome.vue
@@ -40,9 +40,9 @@
const totalNum = ref(0)
const dateSelect = ref('CURRENT_YEAR');
const refresh = () => {
- params.value.dateEnum = 'CURRENT_YEAR';
- checked.value = 'CURRENT_YEAR';
- dateSelect.value = 'CURRENT_YEAR';
+ // params.value.dateEnum = 'CURRENT_YEAR';
+ // checked.value = 'CURRENT_YEAR';
+ // dateSelect.value = 'CURRENT_YEAR';
getBarChartData(params.value);
};
let timeClick = (item, index) => {
@@ -51,7 +51,18 @@
dateSelect.value = item;
getBarChartData(params.value);
};
+const seriesObj = {};
const echartsOption = {
+ title: {
+ text: seriesObj ? '' :'暂无数据',
+ left: 'center',
+ top: 'center',
+ textStyle: {
+ color: '#999',
+ fontSize: '1.6rem',
+ fontWeight: 'normal'
+ }
+ },
tooltip: {
trigger: 'axis',
axisPointer: {
@@ -130,7 +141,7 @@
{ name: '三维', value: 0, type: '3', color: '#04C598' },
{ name: '正射', value: 0, type: '4', color: '#3673E8' },
]);
-const seriesObj = {};
+
eventTypeList.value.forEach(item => {
seriesObj[item.name] = {
type: 'bar',
@@ -150,50 +161,34 @@
const getBarChartData = value => {
gettaskOutcomApi(value).then(res => {
const list = res?.data?.data || [];
- console.log('list',list);
+
- // 清空现有的eventTypeList值
eventTypeList.value.forEach(item => {
item.value = 0;
});
-
- // 创建一个类型映射以便快速查找
const typeMap = new Map();
eventTypeList.value.forEach(item => {
typeMap.set(item.type, item);
});
-
- // 处理图表数据 - 确保每个月份都有所有类型的数据
echartsOption.xAxis.data = list.map(item => item.name);
-
- // 清空系列数据
+
Object.keys(seriesObj).forEach(key => {
seriesObj[key].data = [];
- });
-
+ });
// 遍历所有月份
list.forEach(month => {
totalNum.value = month.total
-
-
- // 创建一个临时映射存储当月的数据
const monthData = new Map();
month.data.forEach(item => {
monthData.set(item.name, item.value);
- });
-
- // 为每个类型添加数据(如果有则用实际值,没有则为0)
+ });
eventTypeList.value.forEach(typeItem => {
const value = monthData.get(typeItem.type) || 0;
-
- // 添加到图表系列
if (seriesObj[typeItem.name]) {
seriesObj[typeItem.name].data.push(value);
}
});
});
-
- // 更新eventTypeList的值(取最后一个月份的数据)
if (list.length > 0) {
const lastMonth = list[list.length - 1];
const lastMonthData = new Map();
--
Gitblit v1.9.3