无人机管理后台前端(已迁走)
张含笑
2025-07-17 3563d2022f499ba185fd747989a191ef9275383a
feat:飞行统计更换接口
2 files modified
52 ■■■■ changed files
src/api/home/index.js 8 ●●●●● patch | view | raw | blame | history
src/views/wel/components/flightStatistics.vue 44 ●●●● patch | view | raw | blame | history
src/api/home/index.js
@@ -56,6 +56,14 @@
    data,
  });
};
// 飞行统计111
export const tongjiNestApi = data => {
    return request({
        url: `/drone-device-core/manage/api/v1/devices/getAllDeviceStatistics`,
        method: 'post',
        data,
    })
}
// 飞行时长 里程 任务数
export const getFlyTime = data => {
  return request({
src/views/wel/components/flightStatistics.vue
@@ -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,27 @@
    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';
  }
    console.log('ttt', flyparams.value);
  getFlyList();
  getFlyTimeList();
};
@@ -120,7 +151,6 @@
    // 处理可能缺失的数据项
    if (!hasDuration) flight_time.push(0);
    if (!hasDistance) flight_distance.push(0);
  });
  var option = {
    tooltip: {
@@ -268,7 +298,7 @@
  padding: 4px 14px 0 15px;
  background: #ffffff !important;
  margin-top: 5px;
height: 100%;
  height: 100%;
  .fytitle {
    display: flex;