Commit b86c94fa by wangkangjie

Merge branch 'master' of https://git.rokedata.com/dws/dwsproject

parents 5b496975 93265897
...@@ -48,4 +48,20 @@ ...@@ -48,4 +48,20 @@
</xpath> </xpath>
</field> </field>
</record> </record>
<record id="inherit_view_roke_mes_stock_quant_form" model="ir.ui.view">
<field name="name">inherit.roke.mes.stock.quant.form</field>
<field name="model">roke.mes.stock.quant</field>
<field name="inherit_id" ref="roke_mes_stock.view_roke_mes_stock_quant_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='reserved_quantity']" position="after">
<field name="subtotal"/>
</xpath>
<xpath expr="//notebook/page[1]/field[@name='in_move_line_ids']//tree//field[@name='lot_note']" position="after">
<field name="subtotal"/>
</xpath>
<xpath expr="//notebook/page[2]/field[@name='out_move_line_ids']//tree//field[@name='lot_note']" position="after">
<field name="subtotal"/>
</xpath>
</field>
</record>
</odoo> </odoo>
\ No newline at end of file
...@@ -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);
} }
}, },
...@@ -549,7 +534,11 @@ ...@@ -549,7 +534,11 @@
// 处理产线改变 // 处理产线改变
async handleLineChange() { async handleLineChange() {
// 避免在init过程中重复设置loading状态
const isAlreadyLoading = this.loading;
if (!isAlreadyLoading) {
this.loading = true; this.loading = true;
}
try { try {
console.log("产线改变,新产线ID:", this.selectedLine); console.log("产线改变,新产线ID:", this.selectedLine);
...@@ -560,11 +549,17 @@ ...@@ -560,11 +549,17 @@
// 存储当前产线的设备数据 // 存储当前产线的设备数据
this.apiData.currentLineEquipment = lineEquipment; this.apiData.currentLineEquipment = lineEquipment;
// 更新设备选择器的设备列表 // 更新设备选择器的设备列表,去重
this.devices = lineEquipment.map((device) => ({ const uniqueDevices = new Map();
lineEquipment.forEach((device) => {
if (device.code && !uniqueDevices.has(device.code)) {
uniqueDevices.set(device.code, {
id: device.code, id: device.code,
name: device.name || device.code, name: device.name || device.code,
})); });
}
});
this.devices = Array.from(uniqueDevices.values());
console.log("更新后的设备列表:", JSON.stringify(this.devices)); console.log("更新后的设备列表:", JSON.stringify(this.devices));
...@@ -581,10 +576,12 @@ ...@@ -581,10 +576,12 @@
// 使用当前产线的设备编码,而不是所有设备 // 使用当前产线的设备编码,而不是所有设备
const deviceList = []; const deviceList = [];
// 从当前产线的设备数据中获取设备编码 // 从当前产线的设备数据中获取设备编码,去重
if (this.apiData.currentLineEquipment && this.apiData.currentLineEquipment.length > 0) { if (this.apiData.currentLineEquipment && this.apiData.currentLineEquipment.length > 0) {
const uniqueCodes = new Set();
this.apiData.currentLineEquipment.forEach((device) => { this.apiData.currentLineEquipment.forEach((device) => {
if (device.code) { if (device.code && !uniqueCodes.has(device.code)) {
uniqueCodes.add(device.code);
deviceList.push(device.code); deviceList.push(device.code);
} }
}); });
...@@ -640,7 +637,13 @@ ...@@ -640,7 +637,13 @@
console.error("切换产线失败:", error); console.error("切换产线失败:", error);
this.$message.error("切换产线失败"); this.$message.error("切换产线失败");
} finally { } finally {
// 只有当我们设置了loading状态时才关闭它
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