Commit 31a6fbdb by zhaochengxiang

代理数据源信息

parent 6d56bc75
...@@ -10,15 +10,20 @@ const { Option } = Select; ...@@ -10,15 +10,20 @@ const { Option } = Select;
const ProxyDatasourceItem = ({ value = {}, datasources = [], onChange }) => { const ProxyDatasourceItem = ({ value = {}, datasources = [], onChange }) => {
const onDatabaseChange = (id) => { const onDatabaseChange = (id) => {
const filterDatasources = datasources?.filter(item => item.id === id); if (id) {
if (filterDatasources.length > 0) { const filterDatasources = datasources?.filter(item => item.id === id);
onChange?.(filterDatasources[0]); if (filterDatasources.length > 0) {
onChange?.(filterDatasources[0]);
}
} else {
onChange?.({});
} }
} }
return ( return (
<Select <Select
value={value?.id} value={value?.id}
allowClear
onChange={onDatabaseChange} onChange={onDatabaseChange}
> >
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment