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

View File

@@ -240,9 +240,6 @@ import { getDeviceStatistic } from '@/api/iot/device';
import { listNotice, getNotice } from '@/api/system/notice'; import { listNotice, getNotice } from '@/api/system/notice';
import CountTo from 'vue-count-to'; import CountTo from 'vue-count-to';
import { loadBMap } from '@/utils/map.js'; 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 { getServer } from '@/api/monitor/server';
import { listAllDeviceShort } from '@/api/iot/device'; import { listAllDeviceShort } from '@/api/iot/device';
@@ -303,6 +300,12 @@ export default {
this.getNoticeList(); this.getNoticeList();
this.getDeviceStatistic(); this.getDeviceStatistic();
}, },
mounted() {
this.$nextTick(() => {
this.draawPieCpu();
window.addEventListener('resize', this.handleResize); // 监听窗口大小变化以重新渲染饼图
});
},
methods: { methods: {
init() { init() {
if (this.$store.state.user.roles.indexOf('tenant') === -1 && this.$store.state.user.roles.indexOf('general') === -1) { if (this.$store.state.user.roles.indexOf('tenant') === -1 && this.$store.state.user.roles.indexOf('general') === -1) {
@@ -357,10 +360,25 @@ export default {
/**加载地图*/ /**加载地图*/
loadMap() { loadMap() {
loadBMap().then(() => { loadBMap().then(() => {
import('echarts/extension/bmap/bmap').then(() => {
setTimeout(() => { setTimeout(() => {
this.getmap(); // 里面有 setOption this.getmap();
}, 500); }, 500);
}); });
});
},
handleResize() {
// 在大小变化时重新渲染图表
if (this.bMapChart) {
this.bMapChart.resize();
}
if (this.gMapChart) {
this.gMapChart.resize();
}
if (this.pieCpuChart) {
this.pieCpuChart.resize();
this.updateRadius();
}
}, },
/** 查询服务器信息 */ /** 查询服务器信息 */
getServer() { getServer() {