联调中心,根据类型,上传logo调取不同接口,优化了其他代码
This commit is contained in:
@ -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>
|
||||
Reference in New Issue
Block a user