配合示方生成混炼示方完善

This commit is contained in:
2026-07-30 11:28:26 +08:00
parent 2310f79f43
commit 5c27bacd11
231 changed files with 33361 additions and 184 deletions

View File

@@ -111,7 +111,7 @@ export function applyWeightPercentToLines(lines: Recordable[]): void {
row.weightPercent = null;
return;
}
row.weightPercent = Number(((phr / totalPhr) * 100).toFixed(1));
row.weightPercent = Number(((phr / totalPhr) * 100).toFixed(3));
});
}
@@ -429,9 +429,25 @@ export function createEmptyLineRows(count = DEFAULT_LINE_ROW_COUNT): Recordable[
return Array.from({ length: count }, () => ({ id: buildUUID() }));
}
/** 明细数值保留三位小数 */
export function roundFormulaLineDecimal3(value: unknown): number | null {
if (value == null || value === '') {
return null;
}
const n = Number(value);
return Number.isFinite(n) ? Number(n.toFixed(3)) : null;
}
/** 确保每行有唯一 idJVxeTable rowKey 依赖 id否则单元格无法渲染 */
export function normalizeLineRows(rows: Recordable[]): Recordable[] {
return (rows || []).map((r) => ({ ...r, id: r?.id || buildUUID() }));
//update-begin---author:jiangxh ---date:20260729 for【配合示方】明细重量%/体积保留三位小数-----------
return (rows || []).map((r) => ({
...r,
id: r?.id || buildUUID(),
weightPercent: roundFormulaLineDecimal3(r?.weightPercent),
volume: roundFormulaLineDecimal3(r?.volume),
}));
//update-end---author:jiangxh ---date:20260729 for【配合示方】明细重量%/体积保留三位小数-----------
}
function sectionTitle(label: string, field: string): FormSchema {
@@ -931,6 +947,7 @@ export function buildLineJVxeColumns(mixingStages?: number | null, tableDisabled
type: JVxeTypes.inputNumber,
minWidth: 90,
align: 'center',
props: { precision: 3 },
},
{
title: '体积',
@@ -939,6 +956,7 @@ export function buildLineJVxeColumns(mixingStages?: number | null, tableDisabled
minWidth: 90,
align: 'center',
placeholder: '自动计算',
props: { precision: 3 },
},
{
title: '备注',