fix(RealTimeInventory): 修正完成度计算和显示问题

调整完成度状态计算逻辑,增加更多进度级别,并修复百分比显示错误
master
huangjinysf 2 months ago
parent 34419d8652
commit 465dae5122

@ -396,16 +396,25 @@ const formatWireDisc = (wireDisc) => {
// wight_completion
const getCompletionStatus = (wight_completion) => {
if (wight_completion > 0) {
//
let percentage = 25; // 25%
if (wight_completion >= 100) percentage = 100;
else if (wight_completion >= 75) percentage = 75;
else if (wight_completion >= 25) percentage = 25;
return { percentage, color: '#67C23A' }; // 绿
if (wight_completion <= 0) {
return { percentage: 0, color: '#C0C4CC' }; //
}
return { percentage: 0, color: '#C0C4CC' }; //
//
let percentage = 0;
if (wight_completion >= 100) {
percentage = 100; // 100%
} else if (wight_completion >= 75) {
percentage = 75; // 3/4
} else if (wight_completion >= 50) {
percentage = 50; // 1/2
} else if (wight_completion >= 25) {
percentage = 25; // 1/4
} else {
percentage = Math.max(10, Math.floor(wight_completion / 2.5) * 2.5); // 10%2.5%
}
return { percentage, color: '#67C23A' }; // 绿
};
//
@ -418,7 +427,7 @@ const getProductionStatusIndicator = (specification, columnProp) => {
}
const status = uidProductionStatusMap.value.get(keyWithSpec);
return getCompletionStatus(status.wight_completion);
return getCompletionStatus(status.wight_completion/100);
};
//
@ -431,7 +440,7 @@ const getProductionStatusTitle = (specification, columnProp) => {
}
const status = uidProductionStatusMap.value.get(keyWithSpec);
return `重量完成度: ${status.wight_completion.toFixed(2)}%`;
return `重量完成度: ${status.wight_completion.toFixed(2)/100}%`;
};
//

Loading…
Cancel
Save