mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:45:18 +00:00
fix(app): can not open modal when only allow linking to one record
This commit is contained in:
parent
34895d3843
commit
752de2b58a
@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { connect } from '@formily/react-schema-renderer'
|
import { connect } from '@formily/react-schema-renderer'
|
||||||
import { Select, Drawer, Button } from 'antd'
|
import { Select, Drawer, Button, Space } from 'antd'
|
||||||
import {
|
import {
|
||||||
mapStyledProps,
|
mapStyledProps,
|
||||||
mapTextComponent,
|
mapTextComponent,
|
||||||
@ -31,7 +31,7 @@ function DrawerSelectComponent(props) {
|
|||||||
const { target, multiple, associatedName, labelField, valueField = 'id', value, onChange } = props;
|
const { target, multiple, associatedName, labelField, valueField = 'id', value, onChange } = props;
|
||||||
const [selectedKeys, selectedValue] = transform({value, multiple, labelField, valueField });
|
const [selectedKeys, selectedValue] = transform({value, multiple, labelField, valueField });
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState(selectedKeys);
|
const [selectedRowKeys, setSelectedRowKeys] = useState(multiple ? selectedKeys : [selectedKeys]);
|
||||||
const [selectedRows, setSelectedRows] = useState(selectedValue);
|
const [selectedRows, setSelectedRows] = useState(selectedValue);
|
||||||
const [options, setOptions] = useState(selectedValue);
|
const [options, setOptions] = useState(selectedValue);
|
||||||
// console.log('valuevaluevaluevaluevaluevalue', value);
|
// console.log('valuevaluevaluevaluevaluevalue', value);
|
||||||
@ -71,12 +71,22 @@ function DrawerSelectComponent(props) {
|
|||||||
setVisible(false);
|
setVisible(false);
|
||||||
}}
|
}}
|
||||||
footer={[
|
footer={[
|
||||||
<Button type={'primary'} onClick={() => {
|
<div
|
||||||
setOptions(selectedRows);
|
style={{
|
||||||
// console.log('valuevaluevaluevaluevaluevalue', {selectedRowKeys});
|
textAlign: 'right',
|
||||||
onChange(multiple ? selectedRowKeys : selectedRowKeys.shift());
|
}}
|
||||||
setVisible(false);
|
>
|
||||||
}}>确定</Button>
|
<Space>
|
||||||
|
<Button onClick={() => setVisible(false)}>取消</Button>
|
||||||
|
<Button type={'primary'} onClick={() => {
|
||||||
|
setOptions(selectedRows);
|
||||||
|
// console.log('valuevaluevaluevaluevaluevalue', {selectedRowKeys});
|
||||||
|
onChange(multiple ? selectedRowKeys : selectedRowKeys.shift());
|
||||||
|
setVisible(false);
|
||||||
|
}}>确定</Button>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<ViewFactory
|
<ViewFactory
|
||||||
|
Loading…
Reference in New Issue
Block a user