From b82bb858d0d18b755745cb9d51f022fb60c5a8ac Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 30 Mar 2026 11:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E9=A2=86=E6=96=99=E5=87=BA=E5=BA=93=E5=8D=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=92=8C=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构了领料出库单的操作逻辑,合并了提交和完成操作的处理方式,简化了代码结构。新增了表单提交前的修改检查,确保数据一致性。同时,优化了删除操作的实现,提升用户体验。 --- .../productissue/ProductIssueDetailForm.vue | 5 +- .../productissue/ProductIssueDetailList.vue | 8 +- .../mes/wm/productissue/ProductIssueForm.vue | 111 ++++++++++++++---- src/views/mes/wm/productissue/index.vue | 35 ++---- 4 files changed, 104 insertions(+), 55 deletions(-) diff --git a/src/views/mes/wm/productissue/ProductIssueDetailForm.vue b/src/views/mes/wm/productissue/ProductIssueDetailForm.vue index b9fbcb409..ddc17aadc 100644 --- a/src/views/mes/wm/productissue/ProductIssueDetailForm.vue +++ b/src/views/mes/wm/productissue/ProductIssueDetailForm.vue @@ -102,7 +102,6 @@ const formLoading = ref(false) // 表单的加载中 const formType = ref('') // 表单的类型:create / update const currentLineId = ref() // 当前操作的行 ID const quantityMax = ref(undefined) // 数量上限(在库数量) -const formRef = ref() // 表单 Ref const formData = ref({ id: undefined as number | undefined, lineId: undefined as number | undefined, @@ -121,6 +120,7 @@ const formRules = reactive({ materialStockId: [{ required: true, message: '请选择库存记录', trigger: 'change' }], quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }] }) +const formRef = ref() // 表单 Ref /** 库存选中回调 —— 自动回填仓库/库区/库位/批次/数量 */ const handleStockChange = (stock: WmMaterialStockVO | undefined) => { @@ -162,7 +162,6 @@ const open = async (type: string, lineId: number, itemId?: number, detailId?: nu formData.value.itemId = itemId } } -defineExpose({ open }) /** 提交表单 */ const submitForm = async () => { @@ -209,4 +208,6 @@ const resetForm = () => { quantityMax.value = undefined formRef.value?.resetFields() } + +defineExpose({ open }) diff --git a/src/views/mes/wm/productissue/ProductIssueDetailList.vue b/src/views/mes/wm/productissue/ProductIssueDetailList.vue index e06fe1e00..591a42060 100644 --- a/src/views/mes/wm/productissue/ProductIssueDetailList.vue +++ b/src/views/mes/wm/productissue/ProductIssueDetailList.vue @@ -8,7 +8,7 @@ props.formType === 'stock') // 是否为拣货模式 + const loading = ref(false) // 列表的加载中 const list = ref([]) // 明细列表 @@ -58,7 +60,6 @@ const getList = async () => { loading.value = false } } -defineExpose({ getList }) /** 删除拣货明细 */ const handleDelete = async (detailId: number) => { @@ -70,8 +71,9 @@ const handleDelete = async (detailId: number) => { } catch {} } -/** 初始化:延迟加载,展开时才触发 */ +/** 初始化 */ onMounted(() => { getList() }) +defineExpose({ getList }) diff --git a/src/views/mes/wm/productissue/ProductIssueForm.vue b/src/views/mes/wm/productissue/ProductIssueForm.vue index 2b4591546..44e4c8241 100644 --- a/src/views/mes/wm/productissue/ProductIssueForm.vue +++ b/src/views/mes/wm/productissue/ProductIssueForm.vue @@ -6,6 +6,7 @@ :rules="formRules" label-width="110px" v-loading="formLoading" + :disabled="isDetail" > @@ -16,7 +17,7 @@ :disabled="isHeaderReadonly" > @@ -70,13 +71,24 @@ @@ -84,22 +96,42 @@ diff --git a/src/views/mes/wm/productissue/index.vue b/src/views/mes/wm/productissue/index.vue index 0873dbc3d..d15e67d38 100644 --- a/src/views/mes/wm/productissue/index.vue +++ b/src/views/mes/wm/productissue/index.vue @@ -116,7 +116,7 @@ @@ -145,7 +145,7 @@ @@ -236,26 +236,6 @@ const openForm = (type: string, id?: number) => { formRef.value.open(type, id) } -/** 提交按钮操作 */ -const handleSubmit = async (id: number) => { - try { - await message.confirm('确认提交该领料单进入审批流程吗?') - await WmProductIssueApi.submitProductIssue(id) - message.success('提交成功') - await getList() - } catch {} -} - -/** 删除按钮操作 */ -const handleDelete = async (id: number) => { - try { - await message.delConfirm() - await WmProductIssueApi.deleteProductIssue(id) - message.success(t('common.delSuccess')) - await getList() - } catch {} -} - /** 取消按钮操作 */ const handleCancel = async (id: number) => { try { @@ -266,12 +246,12 @@ const handleCancel = async (id: number) => { } catch {} } -/** 完成按钮操作 */ -const handleFinish = async (id: number) => { +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { try { - await message.confirm('确认完成该领料单并执行出库吗?') - await WmProductIssueApi.finishProductIssue(id) - message.success('完成成功') + await message.delConfirm() + await WmProductIssueApi.deleteProductIssue(id) + message.success(t('common.delSuccess')) await getList() } catch {} } @@ -289,6 +269,7 @@ const handleExport = async () => { } } +/** 初始化 */ onMounted(() => { getList() })