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

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

@@ -284,6 +284,9 @@
<span>混合步骤</span>
<div class="panel-head-actions" @click.stop>
<MesXslMixingTableRowHeightSetting table-key="step" v-model:preference="stepHeightPref" />
<!--update-begin---author:cursor ---date:20260526 forXSLMES-20260526-A58混合步骤参照历史示方按钮----------- -->
<a-button v-if="showFooter" size="small" @click="openHistoryStepPicker">参照历史混合步骤</a-button>
<!--update-end---author:cursor ---date:20260526 forXSLMES-20260526-A58混合步骤参照历史示方按钮----------- -->
<a-button v-if="showFooter" size="small" type="primary" @click="addStepRow">新增行</a-button>
</div>
</div>
@@ -417,6 +420,7 @@
<MesXslEquipmentLedgerSelectModal @register="registerMachineModal" @select="onMachineSelect" />
<MesXslMixerPsCompileSelectModal @register="registerIssueNumberModal" @select="onIssueNumberSelect" />
<MesXslMixingMaterialSelectModal @register="registerMixingMaterialModal" @select="onMixingMaterialSelect" />
<MesXslMixingSpecStepHistorySelectModal @register="registerHistoryStepModal" @select="onHistoryStepSelect" />
</template>
<script lang="ts" setup>
@@ -466,6 +470,7 @@ import {
syncMaterialBaseUnitWeightFromDisplay,
calcMixingFillVolume,
resolveMixingSpecificGravity,
cloneMixingHistoryStepRows,
MIXING_MATERIAL_ROW_NUMBER_WIDTH,
MIXING_MATERIAL_FOOTER_ROW_HEIGHT,
MIXING_MATERIAL_MIN_COLUMN_WIDTH,
@@ -482,6 +487,7 @@ import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspect
import { queryById as queryEquipmentById } from '/@/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api';
import MesXslMixerPsCompileSelectModal from '/@/views/xslmes/mesXslMixerPsCompile/components/MesXslMixerPsCompileSelectModal.vue';
import MesXslMixingMaterialSelectModal from './MesXslMixingMaterialSelectModal.vue';
import MesXslMixingSpecStepHistorySelectModal from './MesXslMixingSpecStepHistorySelectModal.vue';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
@@ -886,12 +892,16 @@ const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useF
const [registerMachineModal, { openModal: openMachineModalInner, closeModal: closeMachineModal }] = useModal();
const [registerIssueNumberModal, { openModal: openIssueNumberModalInner, closeModal: closeIssueNumberModal }] = useModal();
const [registerMixingMaterialModal, { openModal: openMixingMaterialModalInner, closeModal: closeMixingMaterialModal, setModalProps: setMixingMaterialModalProps }] = useModal();
//update-begin---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------
const [registerHistoryStepModal, { openModal: openHistoryStepModalInner, closeModal: closeHistoryStepModal, setModalProps: setHistoryStepModalProps }] = useModal();
//update-end---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A52】关闭混炼示方弹窗时同步关闭嵌套选料弹窗-----------
function closeNestedPickers() {
closeMixingMaterialModal();
closeMachineModal();
closeIssueNumberModal();
closeHistoryStepModal();
materialPickerRow.value = null;
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A52】关闭混炼示方弹窗时同步关闭嵌套选料弹窗-----------
@@ -950,6 +960,38 @@ function onMixingMaterialSelect(payload: Recordable | null) {
recalcMaterialAccumWeight();
materialPickerRow.value = null;
}
//update-begin---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤回填明细-----------
function openHistoryStepPicker() {
if (!showFooter.value) {
return;
}
setHistoryStepModalProps({ zIndex: 1500 });
openHistoryStepModalInner(true, {
machineId: sheetForm.machineId || '',
excludeSpecId: sheetForm.id || '',
});
}
async function onHistoryStepSelect(payload: Recordable | null) {
if (!payload?.mixingSpecId) {
return;
}
try {
const raw = await queryById({ id: payload.mixingSpecId });
const row = (raw as Recordable)?.specName != null ? raw : (raw as Recordable)?.result;
const clonedSteps = cloneMixingHistoryStepRows(row?.stepList || []);
if (!clonedSteps.length) {
createMessage.warning('所选混炼示方没有可参照的混合步骤');
return;
}
stepData.value = ensureMixingDetailRows(clonedSteps, DEFAULT_MIXING_STEP_ROW_COUNT);
createMessage.success(`已参照「${payload.specName || row?.specName || ''}」混合步骤`);
} catch {
createMessage.error('加载历史混合步骤失败');
}
}
//update-end---author:cursor ---date:20260526 for【XSLMES-20260526-A58】参照历史混合步骤回填明细-----------
//update-end---author:cursor ---date:20260522 for【XSLMES-20260522-A33】混炼示方主表选择弹窗-----------
function ensureTcuDefaultRows(rows: Recordable[] = []) {