This commit is contained in:
FLL
2025-09-10 17:20:25 +08:00
parent d35577d0e4
commit 60eed1ab12
9 changed files with 116 additions and 30 deletions

View File

@@ -177,7 +177,7 @@
</template>
<script setup lang="ts">
import {getStatistics,getworkOrder,getTodayMeetCount,getHydropower,getAccessControl,getCamera} from '#/api/analytics';
import {getStatistics,getworkOrder,getTodayMeetCount,getHydropower,getAccessControl,getCamera,queryTwentyfourRunningDatasByPlNos} from '#/api/analytics';
import AnalyticsTrends from './analytics-trends.vue';
import { Radio } from 'ant-design-vue';
import {EchartsUI, useEcharts} from "@vben/plugins/echarts";
@@ -369,7 +369,6 @@ const camera = ref();
const { renderEcharts: renderCamera } = useEcharts(camera);
async function fetchCamera() {
const data = await getCamera()
console.log(data,111)
const cameraData = [
{ name: '离线', value: data.off },
{ name: '在线', value: data.on }
@@ -577,17 +576,20 @@ const initPowerChart = () => {
addChartToResizeManager(chart);
};
// 初始化环境图表
const initEnvChart = () => {
// 人流车流
const initEnvChart = async () => {
if (!envChart.value) return;
const data = await queryTwentyfourRunningDatasByPlNos()
const inCounts = data.data.inCounts
const staticTimeStrs = data.data.staticTimeStrs
console.log(data)
const chart = echarts.init(envChart.value);
const option = {
tooltip: { trigger: 'axis' },
grid: { left: 40, right: 20, top: 40, bottom: 30 },
xAxis: {
type: 'category',
data: Array.from({ length: 8 }, (_, i) => (i + 1) * 3),
data: staticTimeStrs,
axisLine: { lineStyle: { color: '#3ec6ff' } },
axisLabel: { color: '#fff' },
},
@@ -599,8 +601,8 @@ const initEnvChart = () => {
},
series: [
{
name: '今年',
data: [100, 200, 150, 300, 250, 200, 100, 80],
name: '车流',
data: inCounts,
type: 'line',
smooth: true,
itemStyle: { color: '#b388ff' },
@@ -609,17 +611,17 @@ const initEnvChart = () => {
symbol: 'circle',
symbolSize: 0,
},
{
name: '去年',
data: [80, 120, 100, 180, 150, 120, 60, 40],
type: 'line',
smooth: true,
itemStyle: { color: '#ffb300' },
lineStyle: { width: 3 },
areaStyle: { color: 'rgba(255,179,0,0.15)' },
symbol: 'circle',
symbolSize: 0,
},
// {
// name: '去年',
// data: [80, 120, 100, 180, 150, 120, 60, 40],
// type: 'line',
// smooth: true,
// itemStyle: { color: '#ffb300' },
// lineStyle: { width: 3 },
// areaStyle: { color: 'rgba(255,179,0,0.15)' },
// symbol: 'circle',
// symbolSize: 0,
// },
],
};
chart.setOption(option);