Commit db01bd32 by 延飞 李

继续修改 loading 一直显示问题

parent 1a039f47
...@@ -258,37 +258,14 @@ ...@@ -258,37 +258,14 @@
this.init(); // 直接调用init方法 this.init(); // 直接调用init方法
this.$nextTick(() => { this.$nextTick(() => {
// 这些初始化操作可能会与init方法中的操作重复,可以考虑移除 // 只显示页面内容,其他初始化操作由init方法处理
document.getElementById("bodyId").style.display = "block"; document.getElementById("bodyId").style.display = "block";
this.charts.statusPie = this.initStatusPieChart();
this.charts.oeeRank = this.initOEERankChart();
this.charts.waitingLoss = this.initWaitingLossChart();
this.charts.oeeTrend = this.initOEETrendChart();
this.charts.faultLoss = this.initFaultLossChart();
// 直接更新图表,不需要先获取设备列表
this.updateAllCharts();
// 设置默认选中的车间和产线
if (this.productionLines.length > 0) {
this.selectedLine = this.productionLines[0].id;
const workshopId = this.productionLines[0].workshopId;
this.selectedWorkshop = this.workshops.find((w) => w.id === workshopId);
}
// 初始化拖拽功能
this.initDraggable();
// 添加窗口大小变化监听
window.addEventListener("resize", this.handleResize);
// 初始化完成后触发一次resize
this.handleResize();
}); });
// 添加延迟更新,确保图表能正确显示 // 添加延迟更新,确保图表能正确显示
setTimeout(() => { setTimeout(() => {
console.log("延迟更新所有图表..."); console.log("延迟更新所有图表...");
console.log("当前loading状态:", this.loading);
if (this.apiData.faultLossData && this.apiData.faultLossData.length > 0) { if (this.apiData.faultLossData && this.apiData.faultLossData.length > 0) {
console.log("故障损失数据存在,重新更新故障损失图表"); console.log("故障损失数据存在,重新更新故障损失图表");
this.updateFaultLossChart(); this.updateFaultLossChart();
...@@ -297,6 +274,7 @@ ...@@ -297,6 +274,7 @@
console.log("等待损失数据存在,重新更新等待损失图表"); console.log("等待损失数据存在,重新更新等待损失图表");
this.updateWaitingLossChart(); this.updateWaitingLossChart();
} }
console.log("延迟更新完成,当前loading状态:", this.loading);
}, 1000); }, 1000);
}, },
...@@ -321,6 +299,7 @@ ...@@ -321,6 +299,7 @@
}, },
// 初始化 // 初始化
async init() { async init() {
console.log("Init started: setting loading to true");
this.loading = true; this.loading = true;
try { try {
// console.log("开始初始化..."); // console.log("开始初始化...");
...@@ -384,6 +363,12 @@ ...@@ -384,6 +363,12 @@
this.$message.error("初始化失败,请刷新页面重试"); this.$message.error("初始化失败,请刷新页面重试");
} finally { } finally {
this.loading = false; this.loading = false;
console.log("Init completed: loading set to false");
// 强制确保loading状态被正确设置,延迟一点时间确保所有异步操作完成
setTimeout(() => {
this.loading = false;
console.log("Final loading state set to false");
}, 100);
} }
}, },
...@@ -647,6 +632,9 @@ ...@@ -647,6 +632,9 @@
// 只有当我们设置了loading状态时才关闭它 // 只有当我们设置了loading状态时才关闭它
if (!isAlreadyLoading) { if (!isAlreadyLoading) {
this.loading = false; this.loading = false;
console.log("HandleLineChange completed: loading set to false");
} else {
console.log("HandleLineChange completed: loading state managed by parent");
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment