From dd9fd6e2840caae72c8a981ab9636a63ae49b5bb Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 4 Oct 2025 16:48:03 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90erp?= =?UTF-8?q?=20=E7=B3=BB=E7=BB=9F=E3=80=91sale=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=EF=BC=88=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E2=80=9C=E4=BC=98=E6=83=A0=E5=90=8E=E9=87=91=E9=A2=9D=E2=80=9D?= =?UTF-8?q?=E6=9C=AA=E8=AE=A1=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/erp/sale/out/data.ts | 9 +++++++++ .../src/views/erp/sale/out/modules/form.vue | 17 +---------------- apps/web-antd/src/views/erp/sale/return/data.ts | 9 +++++++++ .../src/views/erp/sale/return/modules/form.vue | 17 +---------------- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/apps/web-antd/src/views/erp/sale/out/data.ts b/apps/web-antd/src/views/erp/sale/out/data.ts index f1ee55c44..50c353560 100644 --- a/apps/web-antd/src/views/erp/sale/out/data.ts +++ b/apps/web-antd/src/views/erp/sale/out/data.ts @@ -162,6 +162,15 @@ export function useFormSchema(formType: string): VbenFormSchema[] { formatter: erpPriceInputFormatter, disabled: true, }, + dependencies: { + triggerFields: ['totalPrice', 'otherPrice'], + componentProps: (values) => { + const totalPrice = values.totalPrice || 0; + const otherPrice = values.otherPrice || 0; + values.discountedPrice = totalPrice - otherPrice; + return {}; + }, + }, }, { fieldName: 'otherPrice', diff --git a/apps/web-antd/src/views/erp/sale/out/modules/form.vue b/apps/web-antd/src/views/erp/sale/out/modules/form.vue index 365551916..de7b89222 100644 --- a/apps/web-antd/src/views/erp/sale/out/modules/form.vue +++ b/apps/web-antd/src/views/erp/sale/out/modules/form.vue @@ -21,7 +21,6 @@ const formData = ref< ErpSaleOutApi.SaleOut & { accountId?: number; customerId?: number; - discountedPrice?: number; discountPercent?: number; fileUrl?: string; order?: ErpSaleOrderApi.SaleOrder; @@ -40,7 +39,6 @@ const formData = ref< discountPrice: 0, totalPrice: 0, otherPrice: 0, - discountedPrice: 0, items: [], }); const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail' @@ -167,20 +165,7 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { - formData.value = { - id: undefined, - no: undefined, - accountId: undefined, - outTime: undefined, - remark: undefined, - fileUrl: undefined, - discountPercent: 0, - customerId: undefined, - discountPrice: 0, - totalPrice: 0, - otherPrice: 0, - items: [], - }; + formData.value = undefined; return; } // 加载数据 diff --git a/apps/web-antd/src/views/erp/sale/return/data.ts b/apps/web-antd/src/views/erp/sale/return/data.ts index d451e2388..7f6b4d9f9 100644 --- a/apps/web-antd/src/views/erp/sale/return/data.ts +++ b/apps/web-antd/src/views/erp/sale/return/data.ts @@ -161,6 +161,15 @@ export function useFormSchema(formType: string): VbenFormSchema[] { formatter: erpPriceInputFormatter, disabled: true, }, + dependencies: { + triggerFields: ['totalPrice', 'otherPrice'], + componentProps: (values) => { + const totalPrice = values.totalPrice || 0; + const otherPrice = values.otherPrice || 0; + values.discountedPrice = totalPrice - otherPrice; + return {}; + }, + }, }, { fieldName: 'otherPrice', diff --git a/apps/web-antd/src/views/erp/sale/return/modules/form.vue b/apps/web-antd/src/views/erp/sale/return/modules/form.vue index 617f4cf96..7c357be4f 100644 --- a/apps/web-antd/src/views/erp/sale/return/modules/form.vue +++ b/apps/web-antd/src/views/erp/sale/return/modules/form.vue @@ -25,7 +25,6 @@ const formData = ref< ErpSaleReturnApi.SaleReturn & { accountId?: number; customerId?: number; - discountedPrice?: number; discountPercent?: number; fileUrl?: string; order?: ErpSaleOrderApi.SaleOrder; @@ -44,7 +43,6 @@ const formData = ref< discountPrice: 0, totalPrice: 0, otherPrice: 0, - discountedPrice: 0, items: [], }); const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail' @@ -171,20 +169,7 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { - formData.value = { - id: undefined, - no: undefined, - accountId: undefined, - returnTime: undefined, - remark: undefined, - fileUrl: undefined, - discountPercent: 0, - customerId: undefined, - discountPrice: 0, - totalPrice: 0, - otherPrice: 0, - items: [], - }; + formData.value = undefined; return; } // 加载数据