From 4d8a60690aca6adfa43df501d4a7b4cb8755f9cb Mon Sep 17 00:00:00 2001 From: liuyuanjin <1107290929@qq.com> Date: Fri, 18 Jul 2025 14:36:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B5=84=E4=BA=A7=E8=B0=83=E5=89=82?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=AD=97=E6=AE=B5=E7=BB=91=E5=AE=9A=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mallTemplateModal/index.tsx | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/executor/design/mallTemplateModal/index.tsx b/src/executor/design/mallTemplateModal/index.tsx index f7a2262e7..3105b001b 100644 --- a/src/executor/design/mallTemplateModal/index.tsx +++ b/src/executor/design/mallTemplateModal/index.tsx @@ -44,16 +44,27 @@ const RenderCard = (props: IRenderCard) => { setTarget(splitField); const ids = [form?.id, hot?.id].filter(Boolean); if (ids.length === 0) return; - try { - const res = await Promise.all( + const formLists = await Promise.all( ids.map((id) => current.directory.resource.formColl.find([id])), ); - const fields = _.uniqBy( - res.flatMap((item) => item?.[0]?.attributes || []), - 'id', - ).filter((attr: any) => ['数值型', '货币型'].includes(attr.valueType)); - setFields(fields); + const allForms = formLists.flat(); + const attrResults = await Promise.all( + allForms.map((form) => + current.directory.resource.attributeColl.loadResult({ + options: { + match: { + formId: { _eq_: form.id }, + }, + }, + }), + ), + ); + const allAttrs = attrResults + .flatMap((res) => res?.data || []) + .filter((attr: any) => ['数值型', '货币型'].includes(attr.valueType)); + const uniqueFields = _.uniqBy(allAttrs, 'id'); + setFields(uniqueFields); } catch (error) { console.error('获取字段失败:', error); } @@ -80,7 +91,7 @@ const RenderCard = (props: IRenderCard) => {
{ - props.keyword === 'splitField' && setTarget(undefined) + props.keyword === 'splitField' && setTarget(undefined); props.current.update({ ...props.current.metadata, params: { -- Gitee