智慧园区前端大屏
linwe
2024-11-19 2676f45f33b9dedb80d0417e5af603df41216f0b
src/views/survey/components/box/dataContent.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-11-04 16:32:04
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-05 17:12:37
 * @LastEditTime: 2024-11-19 15:29:44
 * @FilePath: \bigScreen\src\views\survey\components\box\dataContent.vue
 * @Description:
 *
@@ -10,23 +10,23 @@
-->
<script setup>
// import { ref, reactive, onMounted, nextTick, inject } from 'vue'
import { useEchartsResize } from "hooks/useEchartsResize";
import { getRescueTeamStatistic } from "@/api/indParkInfo";
import { nextTick } from "vue";
import { useEchartsResize } from "hooks/useEchartsResize"
import { getRescueTeamStatistic } from "@/api/indParkInfo"
import { nextTick } from "vue"
let $echarts = inject("echarts");
const curEcharts = ref(null);
let $echarts = inject("echarts")
const curEcharts = ref(null)
let myEcharts = reactive(null);
let myEcharts = reactive(null)
function getStatistic() {
function getStatistic () {
  getRescueTeamStatistic().then((res) => {
    let xaxis_data = [];
    let yaxis_data = [];
    let xaxis_data = []
    let yaxis_data = []
    res.data.data.forEach((element) => {
      xaxis_data.push(element.type);
      yaxis_data.push(element.num);
    });
      xaxis_data.push(element.type)
      yaxis_data.push(element.num)
    })
    myEcharts.setOption({
      tooltip: {
@@ -85,6 +85,7 @@
            color: "#fff",
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: "#fff",
            },
@@ -97,6 +98,9 @@
          axisLabel: {
            color: "#fff",
          },
          splitLine: {
            show: false,
          }
        },
      ],
      series: [
@@ -110,20 +114,20 @@
          },
        },
      ],
    });
  });
    })
  })
}
nextTick(() => {
  myEcharts = $echarts.init(curEcharts.value);
  getStatistic();
});
  myEcharts = $echarts.init(curEcharts.value)
  getStatistic()
})
const echartsResize = () => {
  myEcharts && myEcharts.resize();
};
  myEcharts && myEcharts.resize()
}
useEchartsResize(echartsResize);
useEchartsResize(echartsResize)
</script>
<template>