From df66245d231242431811662475be68bc6426d8f3 Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 31 Jul 2025 16:16:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9B=B6=E5=94=AE?= =?UTF-8?q?=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/smProcessFormAction.ts | 18 +- .../components/select-dialog.vue | 94 ++---- .../purchaseManagement/smErpCgBack/form.vue | 6 +- .../purchaseManagement/smErpCgDd/form.vue | 6 +- .../smErpCgInventory/form.vue | 6 +- .../purchaseManagement/smErpCgPlan/form.vue | 6 +- .../retailManagement/smErpRetailBack/form.vue | 6 +- .../smErpRetailDelivery/form.vue | 277 +++++++----------- src/views/supermarketerp/stockTaking/form.vue | 6 +- 9 files changed, 146 insertions(+), 279 deletions(-) diff --git a/src/hooks/smProcessFormAction.ts b/src/hooks/smProcessFormAction.ts index 009621d..c532850 100644 --- a/src/hooks/smProcessFormAction.ts +++ b/src/hooks/smProcessFormAction.ts @@ -3,16 +3,16 @@ import { useMessage } from "./message" export function useSmProcessFormAction() { // 校验 成功返回true 失败返回false - const formValidate = async (baseDataFormRef: any, editableTableRef: any, editableTableData: any) => { - const valid = await baseDataFormRef.value.validate().catch(() => {}) + const formValidate = async (baseFormRef: any, vxeTableRef: any, vxeTableDataLength: number) => { + const valid = await baseFormRef.value.validate().catch(() => {}) if (!valid) return false - if (editableTableData.length <= 0) { + if (vxeTableDataLength <= 0) { useMessage().warning("请选择商品") return false } - const $table = editableTableRef.value + const $table = vxeTableRef.value if ($table) { const errMap = await $table.validate(true) if (errMap) { @@ -25,13 +25,13 @@ export function useSmProcessFormAction() { } // 提交数据 成功返回 true 失败返回 false - const submitData = async (baseDataForm: any, cgPlanSpuItems: Ref, loading: Ref, putObj: any, addObj: any) => { + const submitData = async (baseDataForm: any, vxeTableItems: Ref, loading: Ref, putObj: any, addObj: any) => { try { loading.value = true const _pa = { ...baseDataForm, - items: cgPlanSpuItems.value, + items: vxeTableItems, } console.log("提交的数据:", _pa) @@ -40,10 +40,9 @@ export function useSmProcessFormAction() { if (res.code == 0) { useMessage().success(baseDataForm.id ? "修改成功" : "添加成功") return true - } else { - useMessage().error(res.msg) - return false } + useMessage().error(res.msg || baseDataForm.id ? "修改失败" : "添加失败") + return false } catch (err: any) { useMessage().error(err.msg) loading.value = false @@ -52,6 +51,7 @@ export function useSmProcessFormAction() { loading.value = false } } + return { formValidate, submitData, diff --git a/src/views/supermarketerp/components/select-dialog.vue b/src/views/supermarketerp/components/select-dialog.vue index 70baa71..198a31c 100644 --- a/src/views/supermarketerp/components/select-dialog.vue +++ b/src/views/supermarketerp/components/select-dialog.vue @@ -1,7 +1,7 @@