无人机管理后台前端(已迁走)
张含笑
2025-07-18 2164e8be5da81b365636503159f29d2665df3aef
feat:添加暂无数据
1 files modified
29 ■■■■ changed files
src/views/wel/components/taskOutcome.vue 29 ●●●● patch | view | raw | blame | history
src/views/wel/components/taskOutcome.vue
@@ -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',
@@ -151,43 +162,33 @@
  gettaskOutcomApi(value).then(res => {
    const list = res?.data?.data || [];
    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);
      });
      });
      eventTypeList.value.forEach(typeItem => {
        const value = monthData.get(typeItem.type) || 0;
        if (seriesObj[typeItem.name]) {
          seriesObj[typeItem.name].data.push(value);
        }
      });
    });
    if (list.length > 0) {
      const lastMonth = list[list.length - 1];
      const lastMonthData = new Map();