联调中心,根据类型,上传logo调取不同接口,优化了其他代码
This commit is contained in:
@ -1,10 +1,8 @@
|
||||
<template>
|
||||
|
||||
<!-- 图表容器,设置宽高 -->
|
||||
<div class="vchartPage">
|
||||
<div ref="chartRef" class="chartRef"></div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -118,7 +116,7 @@ onMounted(() => {
|
||||
myChart.setOption(option);
|
||||
window.addEventListener('resize', handleResize);
|
||||
}
|
||||
}, 200)
|
||||
},500)
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -22,7 +22,7 @@ let dataTimer: NodeJS.Timeout | null = null; // 数据更新定时器
|
||||
const fetchDataAndUpdate = (days: number) => {
|
||||
getDeviceUsageFrequency({ days }).then((res) => {
|
||||
if (res.code === 200 && res.data && myChart) {
|
||||
// 处理接口返回的真实数据(转换为图表所需格式)
|
||||
//(转换为图表所需格式)
|
||||
const chartData = res.data.map(item => ({
|
||||
name: item.deviceName,
|
||||
value: item.frequency
|
||||
@ -78,8 +78,6 @@ const initChart = () => {
|
||||
if (!chartRef.value) return;
|
||||
|
||||
myChart = echarts.init(chartRef.value);
|
||||
|
||||
// 初始图表配置(空数据占位)
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@ -115,7 +113,7 @@ const initChart = () => {
|
||||
name: '使用频次',
|
||||
type: 'bar',
|
||||
data: [], // 初始空数据
|
||||
barWidth: '14px',
|
||||
barWidth: '10px',
|
||||
stack: 'total',
|
||||
label: {
|
||||
show: true,
|
||||
@ -171,7 +169,7 @@ onUnmounted(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vchartPage {
|
||||
margin-top: 4.8vh;
|
||||
margin-top: 4.9vh;
|
||||
position: relative; // 确保按钮定位正确
|
||||
}
|
||||
|
||||
@ -203,6 +201,6 @@ onUnmounted(() => {
|
||||
|
||||
.chartRef {
|
||||
width: 100%;
|
||||
height: 25vh;
|
||||
height: 24vh;
|
||||
}
|
||||
</style>
|
||||
@ -9,7 +9,6 @@
|
||||
</div>
|
||||
<div class="alarm-table-body">
|
||||
<div ref="tableBody" class="alarm-table-body-inner">
|
||||
<!-- 第一份数据 -->
|
||||
<div v-for="(item, index) in displayData" :key="`first-${getKey(item, index)}`" class="alarm-item">
|
||||
<div class="item-cell">{{ item.startTime }}</div>
|
||||
<div class="item-cell">{{ item.deviceTypeName }}</div>
|
||||
@ -19,7 +18,6 @@
|
||||
</div>
|
||||
<div class="item-cell loaction">{{ item.location }}</div>
|
||||
</div>
|
||||
<!-- 第二份数据(用于无缝滚动) -->
|
||||
<div v-for="(item, index) in displayData" :key="`second-${getKey(item, index)}`" class="alarm-item">
|
||||
<div class="item-cell">{{ item.startTime }}</div>
|
||||
<div class="item-cell">{{ item.deviceTypeName }}</div>
|
||||
|
||||
Reference in New Issue
Block a user