SeizedNumAll.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <Card title="每日查获数量(总表)">
  3. <div ref="bar" style="width: 100%; height: 100%;"></div>
  4. </Card>
  5. </template>
  6. <script setup>
  7. import { computed } from 'vue';
  8. import Card from './card.vue';
  9. import { useECharts } from '@/hooks/useEcharts.js';
  10. const bar = ref(null)
  11. const props = defineProps({
  12. chartsData: {
  13. type: Object,
  14. default: () => ([])
  15. }
  16. })
  17. const setChartsOptionsBar = computed(() => {
  18. const hours = Array.from({length: 24}, (_, i) => `${i.toString().padStart(2, '0')}:00`)
  19. return {
  20. grid: {
  21. top: 40,
  22. bottom: 30,
  23. left: 60,
  24. right: 30
  25. },
  26. xAxis: {
  27. type: 'category',
  28. axisLabel: { show: false },
  29. axisLine: { show: false },
  30. boundaryGap: false
  31. },
  32. yAxis: [
  33. {
  34. type: 'value',
  35. position: 'left',
  36. axisLabel: { color: '#fff', fontSize: 14 },
  37. axisLine: { lineStyle: { color: '#fff' } },
  38. splitLine: { lineStyle: { color: '#344067' } }
  39. }
  40. ],
  41. series: [
  42. {
  43. name: '查获数',
  44. type: 'line',
  45. data: props.chartsData.map(item => item.num),
  46. smooth: true,
  47. itemStyle: { color: '#71B138' },
  48. lineStyle: { color: '#71B138' }
  49. }
  50. ],
  51. tooltip: {
  52. trigger: 'axis',
  53. backgroundColor: 'rgba(13,80,122,1)',
  54. borderColor: '#70CFE7',
  55. textStyle: { color: '#fff' }
  56. }
  57. }
  58. })
  59. useECharts(bar, setChartsOptionsBar);
  60. </script>
  61. <style lang="scss" scoped></style>