新增参照历史混合步骤功能,包含混合步骤复制、状态解析及历史步骤选择弹窗,优化用户交互体验。

This commit is contained in:
geht
2026-05-26 10:10:28 +08:00
parent 41f8cef462
commit a579f0e15c
3 changed files with 344 additions and 0 deletions

View File

@@ -1115,3 +1115,73 @@ export function applyMixingMaterialFromSelection(row: Recordable, material: Reco
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类仅读配置表移除小类名兜底-----------
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A50】混炼示方密炼物料选料弹窗与种类解析-----------
//update-begin---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------
/** 混合步骤可复制的业务字段 */
export const MIXING_STEP_COPY_FIELD_KEYS = [
'sortNo',
'actionName',
'actionSec',
'protectSec',
'tempC',
'powerKw',
'energyKwh',
'comboMode',
'speedRpm',
'pressureMpa',
'boltPercent',
] as const;
/** 判断混合步骤行是否含有效业务数据 */
export function isMixingStepRowFilled(row: Recordable = {}): boolean {
return MIXING_STEP_COPY_FIELD_KEYS.some((key) => {
const value = row[key];
return value != null && value !== '';
});
}
/** 从历史混炼示方混合步骤克隆为新行(生成新 id剔除主表/审计字段) */
export function cloneMixingHistoryStepRows(sourceRows: Recordable[] = []): Recordable[] {
return (sourceRows || [])
.filter((row) => isMixingStepRowFilled(row))
.map((row, index) => {
const next: Recordable = { id: buildUUID() };
MIXING_STEP_COPY_FIELD_KEYS.forEach((key) => {
const value = row[key];
if (value != null && value !== '') {
next[key] = value;
}
});
if (next.sortNo == null) {
next.sortNo = index + 1;
}
return next;
});
}
/** 解析混炼示方配方状态(参照旧系统展示) */
export function resolveMixingSpecFormulaStatus(record: Recordable = {}): string {
if (Number(record.delFlag) === 1) {
return '作废';
}
if (record.approveTime) {
return '审批通过';
}
return '编制中';
}
/** 参照历史混合步骤:混炼示方选择列表列 */
export const mixingSpecHistorySelectColumns: BasicColumn[] = [
{ title: '示方编号', align: 'center', dataIndex: 'specName', width: 160 },
{ title: '机台', align: 'center', dataIndex: 'machineName', width: 100 },
{ title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 150 },
{ title: '发行日期', align: 'center', dataIndex: 'makeDate', width: 120 },
{
title: '配方状态',
align: 'center',
dataIndex: 'formulaStatus',
width: 100,
customRender: ({ record }) => resolveMixingSpecFormulaStatus(record),
},
];
//update-end---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------