|
<script setup>
|
import publicContent from './publicContent.vue'
|
|
// import { ref, reactive, onMounted, nextTick, inject } from 'vue'
|
|
import { getRescueTeamStatistic } from '@/api/indParkInfo'
|
|
let $echarts = inject('echarts')
|
const curEcharts = ref(null)
|
|
let myEcharts = reactive(null)
|
|
onMounted(() => {
|
nextTick(() => {
|
myEcharts = $echarts.init(curEcharts.value)
|
getStatistic()
|
|
})
|
})
|
|
|
function getStatistic() {
|
getRescueTeamStatistic().then(res => {
|
let xaxis_data = []
|
res.data.data.forEach(element => {
|
xaxis_data.push(element.type)
|
});
|
let yaxis_data = []
|
res.data.data.forEach(element => {
|
yaxis_data.push(element.num)
|
});
|
myEcharts.setOption({
|
tooltip: {
|
trigger: 'axis',
|
axisPointer: {
|
type: 'shadow'
|
}
|
},
|
xAxis: {
|
data: xaxis_data
|
},
|
yAxis: {},
|
series: [
|
{
|
type: 'bar',
|
data: yaxis_data,
|
barWidth: '30%'
|
}
|
]
|
})
|
})
|
}
|
|
|
</script>
|
|
<template>
|
<public-content>
|
<template #content>
|
<div class="unit-content">
|
<div class="unit-content-echarts" ref="curEcharts">
|
|
</div>
|
</div>
|
</template>
|
</public-content>
|
</template>
|
|
<style lang="scss" scoped>
|
.data-content {
|
color: #fff;
|
|
}
|
|
.unit-content-echarts {
|
height: 200px;
|
}
|
</style>
|