forked from drone/command-center-dashboard

罗广辉
2025-04-13 898c836c57c22b9439321e96650f8a35b1cea917
src/views/TaskManage/TaskTop/TaskIndustry.vue
@@ -9,8 +9,9 @@
<script setup>
import * as echarts from 'echarts';
import { industryJobNumPieChart } from '@/api/home/task';
import useEchartsResize from '@/hooks/useEchartsResize'
const chartRef = ref(null);
let chart = null;
let { chart } = useEchartsResize(chartRef)
const option = {
  tooltip: {
@@ -73,7 +74,7 @@
        item.value = matchData.value;
      }
    });
    chart.setOption(option);
    chart.value.setOption(option);
  });
};
@@ -90,23 +91,13 @@
//       }
//     }));
//     option.series[0].data = data;
//     chart.setOption(option);
//     chart.value.setOption(option);
//   });
// };
onMounted(() => {
  chart = echarts.init(chartRef.value);
  getIndustryJobNumPieChart();
  window.addEventListener('resize', () => {
    chart?.resize();
  });
});
onUnmounted(() => {
  window.removeEventListener('resize', chart?.resize);
  chart?.dispose();
});
</script>
@@ -116,7 +107,7 @@
  width: 244px;
  height: 100%;
  .title {
    margin-top: 10px;
    margin-top: 10px;
    width: 244px;
    height: 26px;
    background: url('@/assets/images/task/title.png') no-repeat center / 100% 100%;
@@ -129,4 +120,4 @@
    height: 200px;
  }
}
</style>
</style>