From cc6ed9d9f2aa4d07e5f900843779a094e7a4dbab Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 21 Jul 2025 11:16:26 +0800
Subject: [PATCH] feat:优化任务管理搜索操作

---
 src/views/wel/components/flightStatistics.vue |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/src/views/wel/components/flightStatistics.vue b/src/views/wel/components/flightStatistics.vue
index 5f43e1f..16768fd 100644
--- a/src/views/wel/components/flightStatistics.vue
+++ b/src/views/wel/components/flightStatistics.vue
@@ -3,7 +3,7 @@
     <div class="fytitle">
       <div class="cardtotal">
         <p>飞行统计</p>
-        <img @click="refresh" src="/src/assets/images/workbench/st1.png" alt="" />
+        <img @click="refresh" src="/src/assets/images/workbench/st1.svg" alt="" />
       </div>
       <div class="time-card">
         <div
@@ -35,7 +35,7 @@
 </template>
 
 <script setup>
-import { getJobEventByStatus, getJobEventTotal, getFly, getFlyTime } from '@/api/home/index';
+import { getFly, getFlyTime, tongjiNestApi } from '@/api/home/index';
 import flyImg1 from '@/assets/images/workbench/fy2.svg';
 import flyImg2 from '@/assets/images/workbench/fy3.svg';
 import flyImg3 from '@/assets/images/workbench/fy4.svg';
@@ -47,6 +47,12 @@
 const dateSelect = ref('CURRENT_YEAR');
 const params = ref({
   date_enum: 'CURRENT_YEAR',
+  device_sn: '',
+  end_date: undefined,
+  start_date: undefined,
+});
+const flyparams = ref({
+  date_enum: 'YEAR',
   device_sn: '',
   end_date: undefined,
   start_date: undefined,
@@ -64,17 +70,25 @@
   //   任务成果: '个',
 };
 const flyTypeList = ref([
-  { name: '飞行时长', value: 0, img: flyImg1 },
-  { name: '飞行里程', value: 0, img: flyImg2 },
+  { name: '飞行时长', value: 0, img: flyImg1, key: 'hour_count' },
+  { name: '飞行里程', value: 0, img: flyImg2, key: 'flight_mileage' },
   //   { name: '任务成果', value: 0, img: flyImg3 },
 ]);
 // 飞行统计
 const getFlyList = () => {
-  getFly(params.value).then(res => {
+  // getFly(params.value).then(res => {
+  //   flyTypeList.value = flyTypeList.value.map(item => ({
+  //     ...item,
+  //     value: res.data.data[keyMapping[item.name]] || 0,
+  //   }));
+  // });
+
+  tongjiNestApi(flyparams.value).then(res => {
     flyTypeList.value = flyTypeList.value.map(item => ({
       ...item,
-      value: res.data.data[keyMapping[item.name]] || 0,
+      value: res.data.data[item.key] || 0,
     }));
+
   });
 };
 const getFlyTimeList = () => {
@@ -83,10 +97,25 @@
     lineCharts(resList);
   });
 };
+const refresh = () => {
+  params.value.date_enum = 'CURRENT_YEAR';
+  checked.value = 'CURRENT_YEAR';
+  dateSelect.value = 'CURRENT_YEAR';
+  getFlyList();
+  getFlyTimeList();
+};
 let timeClick = (item, index) => {
+
   checked.value = item;
   params.value.date_enum = item;
   dateSelect.value = item;
+  if (item === 'CURRENT_MONTH') {
+    flyparams.value.date_enum = 'MONTH';
+  } else if (item === 'CURRENT_WEEK') {
+    flyparams.value.date_enum = 'WEEK';
+  } else {
+    flyparams.value.date_enum = 'YEAR';
+  }
   getFlyList();
   getFlyTimeList();
 };
@@ -109,8 +138,6 @@
           hasDuration = true;
           break;
         case '飞行里程':
-          // 转换为万公 (假设原始单位是米)
-          // flight_distance.push((parseFloat(item.value) / 10 || 0));
           flight_distance.push(parseFloat(item.value) || 0);
           hasDistance = true;
           break;
@@ -120,7 +147,6 @@
     // 处理可能缺失的数据项
     if (!hasDuration) flight_time.push(0);
     if (!hasDistance) flight_distance.push(0);
-
   });
   var option = {
     tooltip: {
@@ -203,7 +229,7 @@
           },
         },
         splitLine: {
-          show: true,
+          show: false,
           lineStyle: {
             type: 'dashed',
             color: '#cdd5e2',
@@ -211,6 +237,7 @@
             opacity: 0.5,
           },
         },
+     
         axisLabel: {
           color: '#383838', // 直接配置颜色
         },
@@ -268,7 +295,7 @@
   padding: 4px 14px 0 15px;
   background: #ffffff !important;
   margin-top: 5px;
-height: 100%;
+    height: pxToVh(400);
 
   .fytitle {
     display: flex;
@@ -367,7 +394,7 @@
     }
 
     .lineChart {
-      height: 209px;
+     height: pxToVh(233) ;
       width: 100%;
 
       .lineBox {

--
Gitblit v1.9.3