From 2426f891e79ac5cfd8bdeb2e6bc82545e74129f9 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 13 Jan 2026 12:13:22 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd/ele=E3=80=91?= =?UTF-8?q?=E5=B0=86=E6=96=87=E7=AB=A0=E7=9A=84=E5=95=86=E5=93=81=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=AD=97=E6=AE=B5=E4=BB=8E=E6=89=8B=E5=8A=A8=E8=BE=93?= =?UTF-8?q?=E5=85=A5=20SPU=20=E7=BC=96=E5=8F=B7=E6=94=B9=E4=B8=BA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20SpuShowcase=20=E7=BB=84=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mall/promotion/article/data.ts | 4 ---- .../views/mall/promotion/article/modules/form.vue | 12 +++++++++++- .../web-ele/src/views/mall/promotion/article/data.ts | 4 ---- .../views/mall/promotion/article/modules/form.vue | 12 +++++++++++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/apps/web-antd/src/views/mall/promotion/article/data.ts b/apps/web-antd/src/views/mall/promotion/article/data.ts index 9f10b9377..5af659775 100644 --- a/apps/web-antd/src/views/mall/promotion/article/data.ts +++ b/apps/web-antd/src/views/mall/promotion/article/data.ts @@ -96,14 +96,10 @@ export function useFormSchema(): VbenFormSchema[] { defaultValue: true, }, { - // TODO: @puhui999:商品关联 fieldName: 'spuId', label: '商品关联', component: 'Input', formItemClass: 'col-span-2', - componentProps: { - placeholder: '请输入商品 SPU 编号', - }, }, { fieldName: 'sort', diff --git a/apps/web-antd/src/views/mall/promotion/article/modules/form.vue b/apps/web-antd/src/views/mall/promotion/article/modules/form.vue index b8a8487b8..0e73e0eca 100644 --- a/apps/web-antd/src/views/mall/promotion/article/modules/form.vue +++ b/apps/web-antd/src/views/mall/promotion/article/modules/form.vue @@ -14,6 +14,7 @@ import { updateArticle, } from '#/api/mall/promotion/article'; import { $t } from '#/locales'; +import { SpuShowcase } from '#/views/mall/product/spu/components'; import { useFormSchema } from '../data'; @@ -41,6 +42,10 @@ const [Form, formApi] = useVbenForm({ const [Modal, modalApi] = useVbenModal({ async onConfirm() { + // 同步商品选择到表单,确保验证时能获取到值 + if (formData.value?.spuId) { + await formApi.setFieldValue('spuId', formData.value.spuId); + } const { valid } = await formApi.validate(); if (!valid) { return; @@ -82,6 +87,11 @@ const [Modal, modalApi] = useVbenModal({ diff --git a/apps/web-ele/src/views/mall/promotion/article/data.ts b/apps/web-ele/src/views/mall/promotion/article/data.ts index 487fa0e0f..b4e4bb614 100644 --- a/apps/web-ele/src/views/mall/promotion/article/data.ts +++ b/apps/web-ele/src/views/mall/promotion/article/data.ts @@ -92,14 +92,10 @@ export function useFormSchema(): VbenFormSchema[] { defaultValue: true, }, { - // TODO: @puhui999:商品关联 fieldName: 'spuId', label: '商品关联', component: 'Input', formItemClass: 'col-span-2', - componentProps: { - placeholder: '请输入商品 SPU 编号', - }, }, { fieldName: 'sort', diff --git a/apps/web-ele/src/views/mall/promotion/article/modules/form.vue b/apps/web-ele/src/views/mall/promotion/article/modules/form.vue index fd3aad79d..754ba967a 100644 --- a/apps/web-ele/src/views/mall/promotion/article/modules/form.vue +++ b/apps/web-ele/src/views/mall/promotion/article/modules/form.vue @@ -14,6 +14,7 @@ import { updateArticle, } from '#/api/mall/promotion/article'; import { $t } from '#/locales'; +import { SpuShowcase } from '#/views/mall/product/spu/components'; import { useFormSchema } from '../data'; @@ -41,6 +42,10 @@ const [Form, formApi] = useVbenForm({ const [Modal, modalApi] = useVbenModal({ async onConfirm() { + // 同步商品选择到表单,确保验证时能获取到值 + if (formData.value?.spuId) { + await formApi.setFieldValue('spuId', formData.value.spuId); + } const { valid } = await formApi.validate(); if (!valid) { return; @@ -82,6 +87,11 @@ const [Modal, modalApi] = useVbenModal({