fix(首页): 样式优化

This commit is contained in:
Zhunianya
2026-03-30 18:07:40 +08:00
parent d0fb156ad3
commit de782ec60e
2 changed files with 27 additions and 10 deletions

View File

@@ -17,9 +17,6 @@
import {
loadBMap
} from '@/utils/map.js'
//安装的是echarts完整包里面包含百度地图扩展路径为 echarts/extension/bmap/bmap.js将其引入
//ECharts的百度地图扩展可以在百度地图上展现点图线图热力图等可视化
require('echarts/extension/bmap/bmap')
import {
listAllDeviceShort,
} from "@/api/iot/device";
@@ -66,7 +63,9 @@ export default {
/**加载地图*/
loadMap() {
loadBMap().then(() => {
this.getmap();
import('echarts/extension/bmap/bmap').then(() => {
this.getmap();
});
});
},

View File

@@ -240,9 +240,6 @@ import { getDeviceStatistic } from '@/api/iot/device';
import { listNotice, getNotice } from '@/api/system/notice';
import CountTo from 'vue-count-to';
import { loadBMap } from '@/utils/map.js';
//安装的是echarts完整包里面包含百度地图扩展路径为 echarts/extension/bmap/bmap.js将其引入
//ECharts的百度地图扩展可以在百度地图上展现点图线图热力图等可视化
require('echarts/extension/bmap/bmap');
import { getServer } from '@/api/monitor/server';
import { listAllDeviceShort } from '@/api/iot/device';
@@ -303,6 +300,12 @@ export default {
this.getNoticeList();
this.getDeviceStatistic();
},
mounted() {
this.$nextTick(() => {
this.draawPieCpu();
window.addEventListener('resize', this.handleResize); // 监听窗口大小变化以重新渲染饼图
});
},
methods: {
init() {
if (this.$store.state.user.roles.indexOf('tenant') === -1 && this.$store.state.user.roles.indexOf('general') === -1) {
@@ -357,11 +360,26 @@ export default {
/**加载地图*/
loadMap() {
loadBMap().then(() => {
setTimeout(() => {
this.getmap(); // 里面有 setOption
}, 500);
import('echarts/extension/bmap/bmap').then(() => {
setTimeout(() => {
this.getmap();
}, 500);
});
});
},
handleResize() {
// 在大小变化时重新渲染图表
if (this.bMapChart) {
this.bMapChart.resize();
}
if (this.gMapChart) {
this.gMapChart.resize();
}
if (this.pieCpuChart) {
this.pieCpuChart.resize();
this.updateRadius();
}
},
/** 查询服务器信息 */
getServer() {
getServer().then((response) => {