优化混炼示方中换算系数和配方参数的数值展示与输入解析,调整相关字段的小数精度,增强用户交互体验。
This commit is contained in:
@@ -57,7 +57,7 @@ export const mainSchema: FormSchema[] = [
|
|||||||
{ label: '制作日期', field: 'makeDate', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
{ label: '制作日期', field: 'makeDate', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
||||||
{ label: '发行编号', field: 'issueNumber', component: 'Input', required: true, colProps: { span: 8 } },
|
{ label: '发行编号', field: 'issueNumber', component: 'Input', required: true, colProps: { span: 8 } },
|
||||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A33】混炼示方基本信息字段优化-----------
|
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A33】混炼示方基本信息字段优化-----------
|
||||||
{ label: '换算系数', field: 'convertFactor', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
{ label: '换算系数', field: 'convertFactor', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 2, style: { width: '100%' } } },
|
||||||
{ label: '填充体积', field: 'fillVolume', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
{ label: '填充体积', field: 'fillVolume', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||||
{ label: '回收炭黑(秒)', field: 'recycleCarbonSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
{ label: '回收炭黑(秒)', field: 'recycleCarbonSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||||
{ label: '母胶比重', field: 'motherRubberSg', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
{ label: '母胶比重', field: 'motherRubberSg', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||||
@@ -279,6 +279,79 @@ function toMixingMaterialNumber(value: unknown): number | null {
|
|||||||
/** 混炼示方重量小数位(与后端 BigDecimal 精度一致) */
|
/** 混炼示方重量小数位(与后端 BigDecimal 精度一致) */
|
||||||
const MIXING_MATERIAL_WEIGHT_SCALE = 6;
|
const MIXING_MATERIAL_WEIGHT_SCALE = 6;
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A60】换算系数/配方参数数值展示优化-----------
|
||||||
|
/** 换算系数展示小数位 */
|
||||||
|
export const MIXING_CONVERT_FACTOR_SCALE = 2;
|
||||||
|
|
||||||
|
/** 配方参数设定允许的小数精度 */
|
||||||
|
export const MIXING_RECIPE_PARAM_DECIMAL_SCALE = 6;
|
||||||
|
|
||||||
|
/** 配方参数设定:允许小数的字段 */
|
||||||
|
export const MIXING_RECIPE_PARAM_DECIMAL_FIELDS = [
|
||||||
|
'sideWallWaterTemp',
|
||||||
|
'overtempDischargeTemp',
|
||||||
|
'doorWaterTemp',
|
||||||
|
'rotorWaterTemp',
|
||||||
|
'maxFeedTemp',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
/** 换算系数展示:固定保留两位小数 */
|
||||||
|
export function formatMixingConvertFactorDisplay(value: unknown): string {
|
||||||
|
if (value === null || value === undefined || value === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const num = Number(value);
|
||||||
|
if (Number.isNaN(num)) {
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
return num.toFixed(MIXING_CONVERT_FACTOR_SCALE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 换算系数输入解析 */
|
||||||
|
export function parseMixingConvertFactorValue(value: unknown): number | null {
|
||||||
|
if (value === '' || value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const num = Number(String(value).replace(/,/g, '').trim());
|
||||||
|
if (Number.isNaN(num)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Number(num.toFixed(MIXING_CONVERT_FACTOR_SCALE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 配方参数展示:允许小数,无小数部分时仅展示整数 */
|
||||||
|
export function formatMixingRecipeParamDisplay(value: unknown, maxPrecision = MIXING_RECIPE_PARAM_DECIMAL_SCALE): string {
|
||||||
|
if (value === null || value === undefined || value === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const num = Number(value);
|
||||||
|
if (Number.isNaN(num)) {
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
const rounded = Number(num.toFixed(maxPrecision));
|
||||||
|
if (Number.isInteger(rounded)) {
|
||||||
|
return String(rounded);
|
||||||
|
}
|
||||||
|
return String(rounded);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 配方参数输入解析 */
|
||||||
|
export function parseMixingRecipeParamValue(value: unknown): number | null {
|
||||||
|
if (value === '' || value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const text = String(value).replace(/,/g, '').trim();
|
||||||
|
if (!text) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const num = Number(text);
|
||||||
|
if (Number.isNaN(num)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Number(num.toFixed(MIXING_RECIPE_PARAM_DECIMAL_SCALE));
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260526 for:【XSLMES-20260526-A60】换算系数/配方参数数值展示优化-----------
|
||||||
|
|
||||||
/** 重量四舍五入,消除浮点累加误差 */
|
/** 重量四舍五入,消除浮点累加误差 */
|
||||||
function roundMixingMaterialNumber(value: number): number {
|
function roundMixingMaterialNumber(value: number): number {
|
||||||
return Number(value.toFixed(MIXING_MATERIAL_WEIGHT_SCALE));
|
return Number(value.toFixed(MIXING_MATERIAL_WEIGHT_SCALE));
|
||||||
|
|||||||
@@ -67,7 +67,9 @@
|
|||||||
<a-input-number
|
<a-input-number
|
||||||
v-model:value="sheetForm.convertFactor"
|
v-model:value="sheetForm.convertFactor"
|
||||||
:disabled="!showFooter"
|
:disabled="!showFooter"
|
||||||
:precision="6"
|
:precision="2"
|
||||||
|
:formatter="formatConvertFactorInput"
|
||||||
|
:parser="parseConvertFactorInput"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@@ -146,7 +148,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="formTitle">侧壁水温</th>
|
<th class="formTitle">侧壁水温</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
<a-input-number v-model:value="sheetForm.sideWallWaterTemp" :disabled="!showFooter" :precision="6" :bordered="false" class="form-input" style="width: 100%" />
|
<a-input-number
|
||||||
|
v-model:value="sheetForm.sideWallWaterTemp"
|
||||||
|
:disabled="!showFooter"
|
||||||
|
:formatter="formatRecipeParamInput"
|
||||||
|
:parser="parseRecipeParamInput"
|
||||||
|
:bordered="false"
|
||||||
|
class="form-input"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<th class="formTitle">超时排胶时间</th>
|
<th class="formTitle">超时排胶时间</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
@@ -158,21 +168,53 @@
|
|||||||
</td>
|
</td>
|
||||||
<th class="formTitle">超温排胶温度</th>
|
<th class="formTitle">超温排胶温度</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
<a-input-number v-model:value="sheetForm.overtempDischargeTemp" :disabled="!showFooter" :precision="6" :bordered="false" class="form-input" style="width: 100%" />
|
<a-input-number
|
||||||
|
v-model:value="sheetForm.overtempDischargeTemp"
|
||||||
|
:disabled="!showFooter"
|
||||||
|
:formatter="formatRecipeParamInput"
|
||||||
|
:parser="parseRecipeParamInput"
|
||||||
|
:bordered="false"
|
||||||
|
class="form-input"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<th class="formTitle">卸料门水温</th>
|
<th class="formTitle">卸料门水温</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
<a-input-number v-model:value="sheetForm.doorWaterTemp" :disabled="!showFooter" :precision="6" :bordered="false" class="form-input" style="width: 100%" />
|
<a-input-number
|
||||||
|
v-model:value="sheetForm.doorWaterTemp"
|
||||||
|
:disabled="!showFooter"
|
||||||
|
:formatter="formatRecipeParamInput"
|
||||||
|
:parser="parseRecipeParamInput"
|
||||||
|
:bordered="false"
|
||||||
|
class="form-input"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<th class="formTitle">转子水温</th>
|
<th class="formTitle">转子水温</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
<a-input-number v-model:value="sheetForm.rotorWaterTemp" :disabled="!showFooter" :precision="6" :bordered="false" class="form-input" style="width: 100%" />
|
<a-input-number
|
||||||
|
v-model:value="sheetForm.rotorWaterTemp"
|
||||||
|
:disabled="!showFooter"
|
||||||
|
:formatter="formatRecipeParamInput"
|
||||||
|
:parser="parseRecipeParamInput"
|
||||||
|
:bordered="false"
|
||||||
|
class="form-input"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="formTitle">最高进料温度</th>
|
<th class="formTitle">最高进料温度</th>
|
||||||
<td class="formValue">
|
<td class="formValue">
|
||||||
<a-input-number v-model:value="sheetForm.maxFeedTemp" :disabled="!showFooter" :precision="6" :bordered="false" class="form-input" style="width: 100%" />
|
<a-input-number
|
||||||
|
v-model:value="sheetForm.maxFeedTemp"
|
||||||
|
:disabled="!showFooter"
|
||||||
|
:formatter="formatRecipeParamInput"
|
||||||
|
:parser="parseRecipeParamInput"
|
||||||
|
:bordered="false"
|
||||||
|
class="form-input"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="formValue blank" colspan="10"></td>
|
<td class="formValue blank" colspan="10"></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -474,6 +516,10 @@ import {
|
|||||||
calcMixingMaterialAccumWeightTotal,
|
calcMixingMaterialAccumWeightTotal,
|
||||||
buildMixingMaterialFooterCells,
|
buildMixingMaterialFooterCells,
|
||||||
normalizeMixingConvertFactor,
|
normalizeMixingConvertFactor,
|
||||||
|
formatMixingConvertFactorDisplay,
|
||||||
|
parseMixingConvertFactorValue,
|
||||||
|
formatMixingRecipeParamDisplay,
|
||||||
|
parseMixingRecipeParamValue,
|
||||||
initMaterialBaseUnitWeights,
|
initMaterialBaseUnitWeights,
|
||||||
applyConvertFactorToMaterialRows,
|
applyConvertFactorToMaterialRows,
|
||||||
syncMaterialBaseUnitWeightFromDisplay,
|
syncMaterialBaseUnitWeightFromDisplay,
|
||||||
@@ -682,6 +728,30 @@ function stripMaterialRowForSave(row: Recordable) {
|
|||||||
const { baseUnitWeight: _baseUnitWeight, ...rest } = row;
|
const { baseUnitWeight: _baseUnitWeight, ...rest } = row;
|
||||||
return rest;
|
return rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A60】换算系数/配方参数数值展示优化-----------
|
||||||
|
function formatConvertFactorInput(value: string | number, info?: { userTyping?: boolean }) {
|
||||||
|
if (info?.userTyping) {
|
||||||
|
return value == null ? '' : String(value);
|
||||||
|
}
|
||||||
|
return formatMixingConvertFactorDisplay(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseConvertFactorInput(value: string) {
|
||||||
|
return parseMixingConvertFactorValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRecipeParamInput(value: string | number, info?: { userTyping?: boolean }) {
|
||||||
|
if (info?.userTyping) {
|
||||||
|
return value == null ? '' : String(value);
|
||||||
|
}
|
||||||
|
return formatMixingRecipeParamDisplay(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseRecipeParamInput(value: string) {
|
||||||
|
return parseMixingRecipeParamValue(value);
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260526 for:【XSLMES-20260526-A60】换算系数/配方参数数值展示优化-----------
|
||||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A43】换算系数联动明细单重实时计算-----------
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A43】换算系数联动明细单重实时计算-----------
|
||||||
|
|
||||||
function recalcMaterialAccumWeight() {
|
function recalcMaterialAccumWeight() {
|
||||||
|
|||||||
Reference in New Issue
Block a user