From 752de2b58a78cd76133357aca5b2fac195fd2634 Mon Sep 17 00:00:00 2001 From: chenos Date: Sat, 2 Jan 2021 09:31:33 +0800 Subject: [PATCH] fix(app): can not open modal when only allow linking to one record --- .../form.fields/drawer-select/index.tsx | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) 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 ba771e069..bce72ee13 100644 --- a/packages/app/src/components/form.fields/drawer-select/index.tsx +++ b/packages/app/src/components/form.fields/drawer-select/index.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { connect } from '@formily/react-schema-renderer' -import { Select, Drawer, Button } from 'antd' +import { Select, Drawer, Button, Space } from 'antd' import { mapStyledProps, mapTextComponent, @@ -31,7 +31,7 @@ function DrawerSelectComponent(props) { const { target, multiple, associatedName, labelField, valueField = 'id', value, onChange } = props; const [selectedKeys, selectedValue] = transform({value, multiple, labelField, valueField }); const [visible, setVisible] = useState(false); - const [selectedRowKeys, setSelectedRowKeys] = useState(selectedKeys); + const [selectedRowKeys, setSelectedRowKeys] = useState(multiple ? selectedKeys : [selectedKeys]); const [selectedRows, setSelectedRows] = useState(selectedValue); const [options, setOptions] = useState(selectedValue); // console.log('valuevaluevaluevaluevaluevalue', value); @@ -71,12 +71,22 @@ function DrawerSelectComponent(props) { setVisible(false); }} footer={[ - +
+ + + + +
+ ]} >