From 7f70f61ea560d4a56f6da6199ec238dc619b1466 Mon Sep 17 00:00:00 2001 From: zhou999 Date: Thu, 18 Aug 2022 15:30:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:[=E7=A9=BF=E6=A2=AD=E6=A1=86]=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=AE=BE=E7=BD=AE=E9=A1=B9=E7=9A=84=E5=9B=9E=E5=A1=AB?= =?UTF-8?q?=E6=95=88=E6=9E=9C=20amis-saas-6031?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I512f442dba6524233b9b109f73bc82f68b50a4f7 --- .../amis-editor/src/plugin/Form/Transfer.tsx | 28 ++++++++----------- .../src/renderer/TransferTableControl.tsx | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/amis-editor/src/plugin/Form/Transfer.tsx b/packages/amis-editor/src/plugin/Form/Transfer.tsx index bdc2004ac..b77e9e52d 100644 --- a/packages/amis-editor/src/plugin/Form/Transfer.tsx +++ b/packages/amis-editor/src/plugin/Form/Transfer.tsx @@ -35,24 +35,9 @@ export class TransferPlugin extends BasePlugin { { label: '曹操', value: 'caocao' - }, - { - label: '钟无艳', - value: 'zhongwuyan' - }, - { - label: '李白', - value: 'libai' - }, - { - label: '韩信', - value: 'hanxin' - }, - { - label: '云中君', - value: 'yunzhongjun' } - ] + ], + selectMode: 'list' }; previewSchema: any = { type: 'form', @@ -187,6 +172,14 @@ export class TransferPlugin extends BasePlugin { required: true }), getSchemaTpl('label'), + getSchemaTpl('valueFormula', { + rendererSchema: { + ...context?.schema, + type: 'select', + multiple: true + }, + visibleOn: 'data.options.length > 0', + }), getSchemaTpl('labelRemark'), getSchemaTpl('remark'), getSchemaTpl('placeholder'), @@ -221,6 +214,7 @@ export class TransferPlugin extends BasePlugin { ], onChange: (value: any, origin: any, item: any, form: any) => { form.setValueByName('options', undefined); + form.setValueByName('value', ""); } }, diff --git a/packages/amis-editor/src/renderer/TransferTableControl.tsx b/packages/amis-editor/src/renderer/TransferTableControl.tsx index 5eb7acba1..2c5185720 100644 --- a/packages/amis-editor/src/renderer/TransferTableControl.tsx +++ b/packages/amis-editor/src/renderer/TransferTableControl.tsx @@ -300,7 +300,7 @@ const renderInput = ( export default class TransferTableOption extends React.Component { addColumns() { - const { columns = [{ type: 'text' }] } = this.props.data; + const { columns = [{ type: 'text', name: 'label' }] } = this.props.data; return { type: 'action', actionType: 'dialog',