update:1.后端新增API配置预设管理接口,支持API配置预设并保存到数据库 2.前端Settings页面重构为Tab布局,新增配置预设管理功能页面 3.优化角色/组织更新逻辑,修复组织字段同步问题 4.更新组织管理-组织成员UI显示,支持翻页显示和跳转
This commit is contained in:
@@ -612,8 +612,12 @@ export default function Characters() {
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item label="主要成员" name="organization_members">
|
||||
<Input placeholder="如:张三、李四、王五" />
|
||||
<Form.Item
|
||||
label="势力等级"
|
||||
name="power_level"
|
||||
tooltip="0-100的数值,表示组织的影响力"
|
||||
>
|
||||
<InputNumber min={0} max={100} style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -626,6 +630,10 @@ export default function Characters() {
|
||||
<TextArea rows={2} placeholder="描述组织的宗旨和目标..." />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="主要成员" name="organization_members">
|
||||
<Input placeholder="如:张三、李四、王五" />
|
||||
</Form.Item>
|
||||
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Form.Item label="所在地" name="location">
|
||||
|
||||
+500
-466
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom';
|
||||
import { Card, Table, Tag, Button, Space, message, Modal, Form, Select, InputNumber, Input, Descriptions } from 'antd';
|
||||
import { PlusOutlined, TeamOutlined, UserOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { useStore } from '../store';
|
||||
import { useCharacterSync } from '../store/hooks';
|
||||
import axios from 'axios';
|
||||
|
||||
interface Organization {
|
||||
@@ -41,6 +42,7 @@ interface Character {
|
||||
export default function Organizations() {
|
||||
const { projectId } = useParams<{ projectId: string }>();
|
||||
const { currentProject } = useStore();
|
||||
const { refreshCharacters } = useCharacterSync();
|
||||
const [organizations, setOrganizations] = useState<Organization[]>([]);
|
||||
const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null);
|
||||
const [members, setMembers] = useState<OrganizationMember[]>([]);
|
||||
@@ -216,7 +218,7 @@ export default function Organizations() {
|
||||
<span>{name}</span>
|
||||
</Space>
|
||||
),
|
||||
width: isMobile ? 80 : undefined,
|
||||
width: isMobile ? 100 : undefined,
|
||||
},
|
||||
{
|
||||
title: '职位',
|
||||
@@ -225,50 +227,53 @@ export default function Organizations() {
|
||||
render: (position: string, record: OrganizationMember) => (
|
||||
<Tag color="blue">{position} {!isMobile && `(级别 ${record.rank})`}</Tag>
|
||||
),
|
||||
width: isMobile ? 120 : undefined,
|
||||
},
|
||||
{
|
||||
title: '忠诚度',
|
||||
dataIndex: 'loyalty',
|
||||
key: 'loyalty',
|
||||
render: (loyalty: number) => (
|
||||
<span style={{ color: loyalty >= 70 ? 'green' : loyalty >= 40 ? 'orange' : 'red' }}>
|
||||
{loyalty}%
|
||||
</span>
|
||||
),
|
||||
width: isMobile ? 80 : undefined,
|
||||
},
|
||||
...(!isMobile ? [
|
||||
{
|
||||
title: '忠诚度',
|
||||
dataIndex: 'loyalty',
|
||||
key: 'loyalty',
|
||||
render: (loyalty: number) => (
|
||||
<span style={{ color: loyalty >= 70 ? 'green' : loyalty >= 40 ? 'orange' : 'red' }}>
|
||||
{loyalty}%
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '贡献度',
|
||||
dataIndex: 'contribution',
|
||||
key: 'contribution',
|
||||
render: (contribution: number) => `${contribution}%`,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
render: (status: string) => (
|
||||
<Tag color={getStatusColor(status)}>{getStatusText(status)}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '加入时间',
|
||||
dataIndex: 'joined_at',
|
||||
key: 'joined_at',
|
||||
render: (time: string) => time || '-',
|
||||
}
|
||||
] : []),
|
||||
{
|
||||
title: '贡献度',
|
||||
dataIndex: 'contribution',
|
||||
key: 'contribution',
|
||||
render: (contribution: number) => `${contribution}%`,
|
||||
width: isMobile ? 80 : undefined,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
render: (status: string) => (
|
||||
<Tag color={getStatusColor(status)}>{getStatusText(status)}</Tag>
|
||||
),
|
||||
width: isMobile ? 80 : undefined,
|
||||
},
|
||||
{
|
||||
title: '加入时间',
|
||||
dataIndex: 'joined_at',
|
||||
key: 'joined_at',
|
||||
render: (time: string) => time || '-',
|
||||
width: isMobile ? 120 : undefined,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_: unknown, record: OrganizationMember) => (
|
||||
<Space>
|
||||
<Space size={isMobile ? 0 : 'small'}>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<EditOutlined />}
|
||||
onClick={() => handleEditMember(record)}
|
||||
style={isMobile ? { padding: '4px' } : undefined}
|
||||
>
|
||||
{isMobile ? '' : '编辑'}
|
||||
</Button>
|
||||
@@ -278,12 +283,13 @@ export default function Organizations() {
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleRemoveMember(record.id)}
|
||||
style={isMobile ? { padding: '4px' } : undefined}
|
||||
>
|
||||
{isMobile ? '删除' : '移除'}
|
||||
{isMobile ? '' : '移除'}
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
width: isMobile ? 60 : undefined,
|
||||
width: isMobile ? 50 : undefined,
|
||||
fixed: isMobile ? 'right' as const : undefined,
|
||||
},
|
||||
];
|
||||
@@ -419,9 +425,24 @@ export default function Organizations() {
|
||||
columns={memberColumns}
|
||||
dataSource={members}
|
||||
rowKey="id"
|
||||
pagination={isMobile ? { simple: true, pageSize: 10 } : false}
|
||||
pagination={
|
||||
members.length > 5
|
||||
? {
|
||||
defaultPageSize: 5,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: !isMobile,
|
||||
showTotal: (total) => `共 ${total} 名成员`,
|
||||
pageSizeOptions: [5, 10, 20],
|
||||
simple: isMobile,
|
||||
position: ['bottomCenter'],
|
||||
}
|
||||
: false
|
||||
}
|
||||
size="small"
|
||||
scroll={isMobile ? { x: 'max-content', y: 400 } : undefined}
|
||||
scroll={{
|
||||
x: isMobile ? 'max-content' : undefined,
|
||||
y: members.length > 10 ? 500 : undefined,
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
</Space>
|
||||
@@ -653,7 +674,20 @@ export default function Organizations() {
|
||||
await axios.put(`/api/organizations/${selectedOrg.id}`, values);
|
||||
message.success('组织信息更新成功');
|
||||
setIsEditOrgModalOpen(false);
|
||||
loadOrganizations();
|
||||
editOrgForm.resetFields();
|
||||
|
||||
// 重新获取更新后的组织列表
|
||||
const res = await axios.get(`/api/organizations/project/${projectId}`);
|
||||
setOrganizations(res.data);
|
||||
|
||||
// 更新当前选中的组织详情
|
||||
const updatedOrg = res.data.find((org: Organization) => org.id === selectedOrg.id);
|
||||
if (updatedOrg) {
|
||||
setSelectedOrg(updatedOrg);
|
||||
}
|
||||
|
||||
// 刷新全局 store
|
||||
await refreshCharacters();
|
||||
} catch (error) {
|
||||
message.error('更新失败');
|
||||
console.error(error);
|
||||
|
||||
+1045
-515
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user