update:1.支持用户自定义输入角色关系

This commit is contained in:
xiamuceer
2025-11-14 12:26:12 +08:00
parent d4f8cb2fae
commit 700340c103
+6 -5
View File
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { Card, Table, Tag, Button, Space, message, Modal, Form, Select, Slider, Input, Tabs } from 'antd'; import { Card, Table, Tag, Button, Space, message, Modal, Form, Select, Slider, Input, Tabs, AutoComplete } from 'antd';
import { PlusOutlined, TeamOutlined, UserOutlined } from '@ant-design/icons'; import { PlusOutlined, TeamOutlined, UserOutlined } from '@ant-design/icons';
import { useStore } from '../store'; import { useStore } from '../store';
import axios from 'axios'; import axios from 'axios';
@@ -384,14 +384,15 @@ export default function Relationships() {
label="关系类型" label="关系类型"
rules={[{ required: true, message: '请选择或输入关系类型' }]} rules={[{ required: true, message: '请选择或输入关系类型' }]}
> >
<Select <AutoComplete
placeholder="选择预定义类型或输入自定义" placeholder="选择预定义类型或输入自定义关系"
showSearch
allowClear
options={relationshipTypes.map(t => ({ options={relationshipTypes.map(t => ({
label: `${t.icon || ''} ${t.name} (${categoryLabels[t.category]})`, label: `${t.icon || ''} ${t.name} (${categoryLabels[t.category]})`,
value: t.name value: t.name
}))} }))}
filterOption={(inputValue, option) =>
option!.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
}
/> />
</Form.Item> </Form.Item>