From 89650750b161e68d7b4b26060ffe2e77bbb8cd24 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 1 Jan 2021 17:20:31 +0800 Subject: [PATCH] fix(app): unable to associate a record --- .../app/src/components/form.fields/drawer-select/index.tsx | 3 ++- packages/app/src/components/views/Table.tsx | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/form.fields/drawer-select/index.tsx b/packages/app/src/components/form.fields/drawer-select/index.tsx index fc0f8ca01..ba771e069 100644 --- a/packages/app/src/components/form.fields/drawer-select/index.tsx +++ b/packages/app/src/components/form.fields/drawer-select/index.tsx @@ -85,7 +85,8 @@ function DrawerSelectComponent(props) { isFieldComponent={true} selectedRowKeys={selectedRowKeys} onSelected={(values) => { - const [selectedKeys, selectedValue] = transform({value: values, multiple, labelField, valueField }); + // 需要返回的是 array + const [selectedKeys, selectedValue] = transform({value: values, multiple: true, labelField, valueField }); setSelectedRows(selectedValue); setSelectedRowKeys(selectedKeys); // console.log('valuevaluevaluevaluevaluevalue', {values, selectedKeys, selectedValue}); diff --git a/packages/app/src/components/views/Table.tsx b/packages/app/src/components/views/Table.tsx index 50bddfca3..94ccb95dc 100644 --- a/packages/app/src/components/views/Table.tsx +++ b/packages/app/src/components/views/Table.tsx @@ -27,6 +27,7 @@ export function Table(props: TableProps) { associatedKey, isFieldComponent, onSelected, + multiple, selectedRowKeys: srk, } = props; const { name: viewName, fields, actionDefaultParams = {}, defaultTabName, rowKey = 'id', actions = [], paginated = true, defaultPerPage = 10 } = schema; @@ -74,6 +75,7 @@ export function Table(props: TableProps) { const tableProps: any = {}; if (actions.length) { tableProps.rowSelection = { + type: multiple ? 'checkbox' : 'radio', selectedRowKeys, onChange, }