From 3c8a4e5181a3f7e9861b419d12292186492bb90e Mon Sep 17 00:00:00 2001 From: lvxiaojiao Date: Wed, 9 Aug 2023 19:56:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A4=8D=E9=80=89=E6=A1=86=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E5=8D=95=E9=80=89=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/plugin/Form/Checkboxes.tsx | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/packages/amis-editor/src/plugin/Form/Checkboxes.tsx b/packages/amis-editor/src/plugin/Form/Checkboxes.tsx index 1f188c5b0..d7f4c58d5 100644 --- a/packages/amis-editor/src/plugin/Form/Checkboxes.tsx +++ b/packages/amis-editor/src/plugin/Form/Checkboxes.tsx @@ -249,33 +249,44 @@ export class CheckboxesControlPlugin extends BasePlugin { originalValue: node.schema?.value // 记录原始值,循环引用检测需要 }; - if (node.schema?.extractValue) { + if (node.schema?.joinValues === false) { dataSchema = { - type: 'array', - title: node.schema?.label || node.schema?.name - }; - } else if (node.schema?.joinValues === false) { - dataSchema = { - type: 'array', + ...dataSchema, + type: 'object', title: node.schema?.label || node.schema?.name, - items: { - type: 'object', - title: '成员', - properties: { - label: { - type: 'string', - title: '文本' - }, - value: { - type, - title: '值' - } + properties: { + label: { + type: 'string', + title: '文本' + }, + value: { + type, + title: '值' } - }, - originalValue: dataSchema.originalValue + } }; } + if (node.schema?.multiple) { + if (node.schema?.extractValue) { + dataSchema = { + type: 'array', + title: node.schema?.label || node.schema?.name + }; + } else if (node.schema?.joinValues === false) { + dataSchema = { + type: 'array', + title: node.schema?.label || node.schema?.name, + items: { + type: 'object', + title: '成员', + properties: dataSchema.properties + }, + originalValue: dataSchema.originalValue + }; + } + } + return dataSchema; } }