From 5b33c40610d02e045ee2f926e34dc5b7ae25d4eb Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 09 May 2025 17:46:47 +0800
Subject: [PATCH] 个人工作台调整

---
 src/views/wel/index.vue |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/views/wel/index.vue b/src/views/wel/index.vue
index 4d44409..187c6b3 100644
--- a/src/views/wel/index.vue
+++ b/src/views/wel/index.vue
@@ -132,6 +132,8 @@
   dateSelect.value = item;
   console.log('日期选择', params.value.date_enum);
   getTypeData();
+  getFlyList()
+  getFlyTimeList()
 };
 const eventTypeList = ref([
   { name: '待审核', value: 0, img: overviewImg2, color: '#FF6560', status: '2', rate: 0 },
@@ -185,7 +187,7 @@
 const getFlyTimeList=()=>{
   getFlyTime(params.value).then(res=>{
    const resList = res?.data?.data || [];
-    console.log('飞行统计11',res.data.data);
+    // console.log('飞行统计11',res.data.data);
     lineCharts(resList)
   })
 }
@@ -291,6 +293,33 @@
 const flight_distance=[]
 const flight_time=[]
 const event_num=[]
+// /遍历数据填充各系列
+  bardata?.forEach(period => {
+    let hasDuration = false, hasDistance = false, hasResult = false;
+    
+    period.data?.forEach(item => {
+      switch(item.name) {
+        case '飞行时长':
+          flight_time.push(parseFloat(item.value) || 0);
+          hasDuration = true;
+          break;
+        case '飞行里程':
+          // 转换为万公里 (假设原始单位是米)
+          flight_distance.push((parseFloat(item.value) / 1000000 || 0).toFixed(2));
+          hasDistance = true;
+          break;
+        case '任务成果':
+          event_num.push(Number(item.value) || 0);
+          hasResult = true;
+          break;
+      }
+    });
+
+    // 处理可能缺失的数据项
+    if(!hasDuration) flight_time.push(0);
+    if(!hasDistance) flight_distance.push(0);
+    if(!hasResult) event_num.push(0);
+  });
   var option = {
     tooltip: {
       trigger: 'item',
@@ -426,7 +455,7 @@
             barBorderRadius: 6,
           },
         },
-        data: [11, 14, 133, 4, 10, 14, 116, 12, 12, 58, 15, 12],
+        data: flight_time,
       },
       {
         name: '飞行里程',
@@ -447,7 +476,7 @@
             barBorderRadius: 6,
           },
         },
-        data: [0, 1, 9, 0, 5, 3, 0, 2, 0, 0, 1, 0],
+        data: flight_distance,
       },
       {
         name: '任务成果',
@@ -466,7 +495,7 @@
         lineStyle: {
           color: 'rgba(52, 146, 242, 1)',
         },
-        data: [1, 7, 6, 30, 20, 21.43, 11, 16.67, 22, 88, 6.67, 10],
+        data: event_num,
       },
     ],
   };

--
Gitblit v1.9.3