优化混炼示方新增时选择机台逻辑
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
:defaultFullscreen="true"
|
:defaultFullscreen="true"
|
||||||
wrapClassName="mixing-spec-modal-wrap"
|
wrapClassName="mixing-spec-modal-wrap"
|
||||||
@register="registerModal"
|
@register="registerModal"
|
||||||
@cancel="closeNestedPickers"
|
@cancel="handleMainModalClose"
|
||||||
@ok="handleSubmit"
|
@ok="handleSubmit"
|
||||||
>
|
>
|
||||||
<template #title>{{ title }}</template>
|
<template #title>{{ title }}</template>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<a-input
|
<a-input
|
||||||
:value="sheetForm.machineName"
|
:value="sheetForm.machineName"
|
||||||
readonly
|
readonly
|
||||||
placeholder="请点击选择设备台账"
|
:placeholder="machinePickerPlaceholder"
|
||||||
:disabled="!showFooter"
|
:disabled="!showFooter"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
:class="['form-input', 'mixing-picker-input', { 'is-filled': !!sheetForm.machineName }]"
|
:class="['form-input', 'mixing-picker-input', { 'is-filled': !!sheetForm.machineName }]"
|
||||||
@@ -467,15 +467,15 @@
|
|||||||
<BasicForm v-show="false" @register="registerForm" />
|
<BasicForm v-show="false" @register="registerForm" />
|
||||||
</div>
|
</div>
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
<MesXslEquipmentLedgerSelectModal @register="registerMachineModal" @select="onMachineSelect" />
|
<MesXslEquipmentLedgerSelectModal :key="nestedPickerKey" @register="registerMachineModal" @select="onMachineSelect" />
|
||||||
<MesXslMixerPsCompileSelectModal @register="registerIssueNumberModal" @select="onIssueNumberSelect" />
|
<MesXslMixerPsCompileSelectModal :key="nestedPickerKey" @register="registerIssueNumberModal" @select="onIssueNumberSelect" />
|
||||||
<MesXslMixingMaterialSelectModal @register="registerMixingMaterialModal" @select="onMixingMaterialSelect" />
|
<MesXslMixingMaterialSelectModal :key="nestedPickerKey" @register="registerMixingMaterialModal" @select="onMixingMaterialSelect" />
|
||||||
<MesXslMixingSpecStepHistorySelectModal @register="registerHistoryStepModal" @select="onHistoryStepSelect" />
|
<MesXslMixingSpecStepHistorySelectModal :key="nestedPickerKey" @register="registerHistoryStepModal" @select="onHistoryStepSelect" />
|
||||||
<MesXslMixingSpecSelectModal @register="registerSpecPickerModal" @edit="onSpecPickerEdit" @referenceAdd="onSpecPickerReferenceAdd" />
|
<MesXslMixingSpecSelectModal :key="nestedPickerKey" @register="registerSpecPickerModal" @edit="onSpecPickerEdit" @referenceAdd="onSpecPickerReferenceAdd" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, ref, unref } from 'vue';
|
import { computed, nextTick, reactive, ref, unref } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { BasicModal, useModal, useModalInner } from '/@/components/Modal';
|
import { BasicModal, useModal, useModalInner } from '/@/components/Modal';
|
||||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||||
@@ -560,6 +560,9 @@ const showFooter = ref(true);
|
|||||||
const isHistoryView = ref(false);
|
const isHistoryView = ref(false);
|
||||||
const historyVersion = ref('');
|
const historyVersion = ref('');
|
||||||
const mixerPsCompilePickerId = ref('');
|
const mixerPsCompilePickerId = ref('');
|
||||||
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A04】主弹窗关闭后重建嵌套选择弹窗,避免 useModal 状态残留-----------
|
||||||
|
const nestedPickerKey = ref(0);
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A04】主弹窗关闭后重建嵌套选择弹窗,避免 useModal 状态残留-----------
|
||||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A34】混合步骤动作/组合下拉选项-----------
|
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A34】混合步骤动作/组合下拉选项-----------
|
||||||
const mixerActionOptions = ref<{ title: string; value: string }[]>([]);
|
const mixerActionOptions = ref<{ title: string; value: string }[]>([]);
|
||||||
const mixerConditionOptions = ref<{ title: string; value: string }[]>([]);
|
const mixerConditionOptions = ref<{ title: string; value: string }[]>([]);
|
||||||
@@ -985,7 +988,7 @@ const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useF
|
|||||||
});
|
});
|
||||||
|
|
||||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A33】混炼示方主表选择弹窗-----------
|
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A33】混炼示方主表选择弹窗-----------
|
||||||
const [registerMachineModal, { openModal: openMachineModalInner, closeModal: closeMachineModal }] = useModal();
|
const [registerMachineModal, { openModal: openMachineModalInner, closeModal: closeMachineModal, setModalProps: setMachineModalProps }] = useModal();
|
||||||
const [registerIssueNumberModal, { openModal: openIssueNumberModalInner, closeModal: closeIssueNumberModal }] = useModal();
|
const [registerIssueNumberModal, { openModal: openIssueNumberModalInner, closeModal: closeIssueNumberModal }] = useModal();
|
||||||
const [registerMixingMaterialModal, { openModal: openMixingMaterialModalInner, closeModal: closeMixingMaterialModal, setModalProps: setMixingMaterialModalProps }] = useModal();
|
const [registerMixingMaterialModal, { openModal: openMixingMaterialModalInner, closeModal: closeMixingMaterialModal, setModalProps: setMixingMaterialModalProps }] = useModal();
|
||||||
//update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------
|
//update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A58】参照历史混合步骤选择弹窗-----------
|
||||||
@@ -1004,14 +1007,42 @@ function closeNestedPickers() {
|
|||||||
closeSpecPickerModal();
|
closeSpecPickerModal();
|
||||||
materialPickerRow.value = null;
|
materialPickerRow.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A03】主弹窗关闭时重置表单并清理嵌套弹窗状态-----------
|
||||||
|
function handleMainModalClose() {
|
||||||
|
closeNestedPickers();
|
||||||
|
resetSheetForm();
|
||||||
|
isUpdate.value = false;
|
||||||
|
isHistoryView.value = false;
|
||||||
|
historyVersion.value = '';
|
||||||
|
showFooter.value = true;
|
||||||
|
mixerActionOptions.value = [];
|
||||||
|
mixerConditionOptions.value = [];
|
||||||
|
nestedPickerKey.value += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A03】主弹窗关闭时重置表单并清理嵌套弹窗状态-----------
|
||||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】关闭混炼示方弹窗时同步关闭嵌套选料弹窗-----------
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】关闭混炼示方弹窗时同步关闭嵌套选料弹窗-----------
|
||||||
|
|
||||||
function openMachinePicker() {
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A01】规格有数据时机台点击走示方选择弹窗-----------
|
||||||
|
const machinePickerPlaceholder = computed(() =>
|
||||||
|
sheetForm.specName ? '请点击选择混炼示方' : '请点击选择设备台账',
|
||||||
|
);
|
||||||
|
|
||||||
|
async function openMachinePicker() {
|
||||||
if (!showFooter.value) {
|
if (!showFooter.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
openMachineModalInner(true, { equipmentLedgerId: sheetForm.machineId || '' });
|
if (sheetForm.specName) {
|
||||||
|
openSpecPicker();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setMachineModalProps({ zIndex: 1500 });
|
||||||
|
openMachineModalInner(true, { equipmentLedgerId: sheetForm.machineId || '', ts: Date.now() });
|
||||||
|
await nextTick();
|
||||||
|
setMachineModalProps({ zIndex: 1500, open: true });
|
||||||
}
|
}
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A01】规格有数据时机台点击走示方选择弹窗-----------
|
||||||
|
|
||||||
async function onMachineSelect(payload: Recordable | null) {
|
async function onMachineSelect(payload: Recordable | null) {
|
||||||
sheetForm.machineId = payload?.equipmentLedgerId || '';
|
sheetForm.machineId = payload?.equipmentLedgerId || '';
|
||||||
@@ -1037,7 +1068,11 @@ function openSpecPicker() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSpecPickerModalProps({ zIndex: 1500 });
|
setSpecPickerModalProps({ zIndex: 1500 });
|
||||||
openSpecPickerModalInner(true, { machineId: sheetForm.machineId || '' });
|
openSpecPickerModalInner(true, {
|
||||||
|
machineId: sheetForm.machineId || '',
|
||||||
|
machineName: sheetForm.machineName || '',
|
||||||
|
ts: Date.now(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyMixingSpecPageData(row: Recordable, mode: 'edit' | 'referenceAdd') {
|
async function applyMixingSpecPageData(row: Recordable, mode: 'edit' | 'referenceAdd') {
|
||||||
@@ -1141,6 +1176,7 @@ function openHistoryStepPicker() {
|
|||||||
setHistoryStepModalProps({ zIndex: 1500 });
|
setHistoryStepModalProps({ zIndex: 1500 });
|
||||||
openHistoryStepModalInner(true, {
|
openHistoryStepModalInner(true, {
|
||||||
machineId: sheetForm.machineId || '',
|
machineId: sheetForm.machineId || '',
|
||||||
|
machineName: sheetForm.machineName || '',
|
||||||
excludeSpecId: sheetForm.id || '',
|
excludeSpecId: sheetForm.id || '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1238,6 +1274,15 @@ function addDownStepRow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A03】打开主弹窗时先同步清理嵌套弹窗与表单残留-----------
|
||||||
|
isHistoryView.value = !!data?.isHistoryView;
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
showFooter.value = !!data?.showFooter && !isHistoryView.value;
|
||||||
|
closeNestedPickers();
|
||||||
|
resetSheetForm();
|
||||||
|
historyVersion.value = '';
|
||||||
|
await nextTick();
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A03】打开主弹窗时先同步清理嵌套弹窗与表单残留-----------
|
||||||
await resetFields();
|
await resetFields();
|
||||||
resetSheetForm();
|
resetSheetForm();
|
||||||
materialData.value = [];
|
materialData.value = [];
|
||||||
@@ -1248,10 +1293,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
|||||||
downStepData.value = [];
|
downStepData.value = [];
|
||||||
tcuData.value = ensureTcuDefaultRows([]);
|
tcuData.value = ensureTcuDefaultRows([]);
|
||||||
await loadMixerStepOptions('');
|
await loadMixerStepOptions('');
|
||||||
isHistoryView.value = !!data?.isHistoryView;
|
|
||||||
historyVersion.value = data?.historyVersion || '';
|
historyVersion.value = data?.historyVersion || '';
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
showFooter.value = !!data?.showFooter && !isHistoryView.value;
|
|
||||||
await setProps({ disabled: !showFooter.value });
|
await setProps({ disabled: !showFooter.value });
|
||||||
setModalProps({ showOkBtn: showFooter.value, showCancelBtn: showFooter.value, confirmLoading: false });
|
setModalProps({ showOkBtn: showFooter.value, showCancelBtn: showFooter.value, confirmLoading: false });
|
||||||
if (isHistoryView.value && data?.historyId) {
|
if (isHistoryView.value && data?.historyId) {
|
||||||
@@ -1346,6 +1388,7 @@ async function handleSubmit() {
|
|||||||
try {
|
try {
|
||||||
await saveOrUpdate(payload, unref(isUpdate));
|
await saveOrUpdate(payload, unref(isUpdate));
|
||||||
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
|
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
|
||||||
|
handleMainModalClose();
|
||||||
closeModal();
|
closeModal();
|
||||||
emit('success');
|
emit('success');
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -94,24 +94,11 @@
|
|||||||
clickToRowSelect: true,
|
clickToRowSelect: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadMachineOptions() {
|
async function loadMachineOptions(preset?: { machineId?: string; machineName?: string }) {
|
||||||
machineLoading.value = true;
|
machineLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const optionMap = new Map<string, { label: string; value: string }>();
|
const optionMap = new Map<string, { label: string; value: string }>();
|
||||||
const raw = await mixingSpecList({ pageNo: 1, pageSize: 500 });
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A02】机台下拉合并设备台账并补全预选机台名称-----------
|
||||||
const page = (raw as Recordable)?.records != null ? raw : (raw as Recordable)?.result;
|
|
||||||
const specRecords = ((page?.records || page || []) as Recordable[]).filter(Boolean);
|
|
||||||
specRecords.forEach((row) => {
|
|
||||||
if (!row?.machineId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const value = String(row.machineId);
|
|
||||||
optionMap.set(value, {
|
|
||||||
value,
|
|
||||||
label: row.machineName || value,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!optionMap.size) {
|
|
||||||
const eqRaw = await equipmentList({ pageNo: 1, pageSize: 500 });
|
const eqRaw = await equipmentList({ pageNo: 1, pageSize: 500 });
|
||||||
const eqPage = (eqRaw as Recordable)?.records != null ? eqRaw : (eqRaw as Recordable)?.result;
|
const eqPage = (eqRaw as Recordable)?.records != null ? eqRaw : (eqRaw as Recordable)?.result;
|
||||||
const eqRecords = ((eqPage?.records || eqPage || []) as Recordable[]).filter(Boolean);
|
const eqRecords = ((eqPage?.records || eqPage || []) as Recordable[]).filter(Boolean);
|
||||||
@@ -125,7 +112,25 @@
|
|||||||
label: row.equipmentName || row.equipmentCode || value,
|
label: row.equipmentName || row.equipmentCode || value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const raw = await mixingSpecList({ pageNo: 1, pageSize: 500 });
|
||||||
|
const page = (raw as Recordable)?.records != null ? raw : (raw as Recordable)?.result;
|
||||||
|
const specRecords = ((page?.records || page || []) as Recordable[]).filter(Boolean);
|
||||||
|
specRecords.forEach((row) => {
|
||||||
|
if (!row?.machineId) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
const value = String(row.machineId);
|
||||||
|
optionMap.set(value, {
|
||||||
|
value,
|
||||||
|
label: row.machineName || optionMap.get(value)?.label || value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const presetId = preset?.machineId ? String(preset.machineId) : '';
|
||||||
|
if (presetId) {
|
||||||
|
const presetLabel = preset?.machineName || optionMap.get(presetId)?.label || presetId;
|
||||||
|
optionMap.set(presetId, { value: presetId, label: presetLabel });
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A02】机台下拉合并设备台账并补全预选机台名称-----------
|
||||||
machineOptions.value = Array.from(optionMap.values()).sort((a, b) =>
|
machineOptions.value = Array.from(optionMap.values()).sort((a, b) =>
|
||||||
a.label.localeCompare(b.label, 'zh-CN'),
|
a.label.localeCompare(b.label, 'zh-CN'),
|
||||||
);
|
);
|
||||||
@@ -202,7 +207,10 @@
|
|||||||
referenceLoading.value = false;
|
referenceLoading.value = false;
|
||||||
clearSelectedRowKeys?.();
|
clearSelectedRowKeys?.();
|
||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
await loadMachineOptions();
|
await loadMachineOptions({
|
||||||
|
machineId: data?.machineId || undefined,
|
||||||
|
machineName: data?.machineName || undefined,
|
||||||
|
});
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -93,24 +93,11 @@
|
|||||||
clickToRowSelect: true,
|
clickToRowSelect: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadMachineOptions() {
|
async function loadMachineOptions(preset?: { machineId?: string; machineName?: string }) {
|
||||||
machineLoading.value = true;
|
machineLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const optionMap = new Map<string, { label: string; value: string }>();
|
const optionMap = new Map<string, { label: string; value: string }>();
|
||||||
const raw = await mixingSpecList({ pageNo: 1, pageSize: 500 });
|
//update-begin---author:cursor ---date:20260615 for:【XSLMES-20260615-A02】机台下拉合并设备台账并补全预选机台名称-----------
|
||||||
const page = (raw as Recordable)?.records != null ? raw : (raw as Recordable)?.result;
|
|
||||||
const specRecords = ((page?.records || page || []) as Recordable[]).filter(Boolean);
|
|
||||||
specRecords.forEach((row) => {
|
|
||||||
if (!row?.machineId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const value = String(row.machineId);
|
|
||||||
optionMap.set(value, {
|
|
||||||
value,
|
|
||||||
label: row.machineName || value,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!optionMap.size) {
|
|
||||||
const eqRaw = await equipmentList({ pageNo: 1, pageSize: 500 });
|
const eqRaw = await equipmentList({ pageNo: 1, pageSize: 500 });
|
||||||
const eqPage = (eqRaw as Recordable)?.records != null ? eqRaw : (eqRaw as Recordable)?.result;
|
const eqPage = (eqRaw as Recordable)?.records != null ? eqRaw : (eqRaw as Recordable)?.result;
|
||||||
const eqRecords = ((eqPage?.records || eqPage || []) as Recordable[]).filter(Boolean);
|
const eqRecords = ((eqPage?.records || eqPage || []) as Recordable[]).filter(Boolean);
|
||||||
@@ -124,7 +111,25 @@
|
|||||||
label: row.equipmentName || row.equipmentCode || value,
|
label: row.equipmentName || row.equipmentCode || value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const raw = await mixingSpecList({ pageNo: 1, pageSize: 500 });
|
||||||
|
const page = (raw as Recordable)?.records != null ? raw : (raw as Recordable)?.result;
|
||||||
|
const specRecords = ((page?.records || page || []) as Recordable[]).filter(Boolean);
|
||||||
|
specRecords.forEach((row) => {
|
||||||
|
if (!row?.machineId) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
const value = String(row.machineId);
|
||||||
|
optionMap.set(value, {
|
||||||
|
value,
|
||||||
|
label: row.machineName || optionMap.get(value)?.label || value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const presetId = preset?.machineId ? String(preset.machineId) : '';
|
||||||
|
if (presetId) {
|
||||||
|
const presetLabel = preset?.machineName || optionMap.get(presetId)?.label || presetId;
|
||||||
|
optionMap.set(presetId, { value: presetId, label: presetLabel });
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260615 for:【XSLMES-20260615-A02】机台下拉合并设备台账并补全预选机台名称-----------
|
||||||
machineOptions.value = Array.from(optionMap.values()).sort((a, b) =>
|
machineOptions.value = Array.from(optionMap.values()).sort((a, b) =>
|
||||||
a.label.localeCompare(b.label, 'zh-CN'),
|
a.label.localeCompare(b.label, 'zh-CN'),
|
||||||
);
|
);
|
||||||
@@ -196,7 +201,10 @@
|
|||||||
selectedRow.value = null;
|
selectedRow.value = null;
|
||||||
clearSelectedRowKeys?.();
|
clearSelectedRowKeys?.();
|
||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
await loadMachineOptions();
|
await loadMachineOptions({
|
||||||
|
machineId: data?.machineId || undefined,
|
||||||
|
machineName: data?.machineName || undefined,
|
||||||
|
});
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user