feat: 添加部门管理功能、主题切换和多语言支持

refactor(dashboard): 重构用户管理页面和路由结构

feat(server): 实现部门管理API和RBAC增强功能

docs: 更新用户手册和管理员指南文档

style: 统一图标使用和组件命名规范

test: 添加部门服务和数据隔离测试用例

chore: 更新依赖和配置文件
This commit is contained in:
2026-03-28 22:52:12 +08:00
parent 22308fe042
commit d327706087
87 changed files with 21372 additions and 4806 deletions

View File

@@ -92,10 +92,10 @@ const PLATFORM_CONFIG: Record<string, { color: string; text: string; icon: React
};
const STATUS_CONFIG: Record<string, { color: string; text: string }> = {
ACTIVE: { color: 'success', text: '已连接' },
INACTIVE: { color: 'default', text: '未连接' },
EXPIRED: { color: 'warning', text: '已过期' },
ERROR: { color: 'error', text: '错误' },
active: { color: 'success', text: '已连接' },
inactive: { color: 'default', text: '未连接' },
expired: { color: 'warning', text: '已过期' },
error: { color: 'error', text: '错误' },
};
const PlatformAuth: React.FC = () => {
@@ -125,13 +125,18 @@ const PlatformAuth: React.FC = () => {
}
};
const handleConnect = async (values: { platform: Platform; accountName: string; accountId: string; shopId?: string }) => {
const handleConnect = async (values: { platform: Platform; appId: string; appSecret: string; config?: Record<string, any> }) => {
try {
const tenantId = localStorage.getItem('tenantId') || 'default';
const result = await platformAuthDataSource.connect({
platform: values.platform,
accountName: values.accountName,
accountId: values.accountId,
shopId: values.shopId,
accountName: values.appId,
accountId: values.appId,
config: {
appId: values.appId,
appSecret: values.appSecret,
...values.config,
},
});
if (result.authUrl) {
@@ -212,19 +217,13 @@ const PlatformAuth: React.FC = () => {
},
},
{
title: '店铺名称',
dataIndex: 'accountName',
key: 'accountName',
title: 'App ID',
dataIndex: 'accountId',
key: 'accountId',
width: 200,
},
{
title: '账号ID',
dataIndex: 'accountId',
key: 'accountId',
width: 150,
},
{
title: '状态',
title: '配置状态',
dataIndex: 'status',
key: 'status',
width: 120,
@@ -233,6 +232,7 @@ const PlatformAuth: React.FC = () => {
return <Badge status={config.color as any} text={config.text} />;
},
},
{
title: '最后同步',
dataIndex: 'lastSyncAt',
@@ -253,7 +253,7 @@ const PlatformAuth: React.FC = () => {
width: 220,
render: (_, record) => (
<Space>
{record.status === 'ACTIVE' && (
{ record.status === 'active' && (
<>
<Button
type="link"
@@ -273,7 +273,7 @@ const PlatformAuth: React.FC = () => {
</Button>
</>
)}
{record.status === 'EXPIRED' && (
{record.status === 'expired' && (
<>
<Button
type="link"
@@ -292,7 +292,7 @@ const PlatformAuth: React.FC = () => {
/>
</>
)}
{record.status === 'INACTIVE' && (
{record.status === 'inactive' && (
<Button
type="link"
size="small"
@@ -309,7 +309,7 @@ const PlatformAuth: React.FC = () => {
</Button>
)}
{record.status === 'ERROR' && (
{record.status === 'error' && (
<>
<Button
type="link"
@@ -335,8 +335,8 @@ const PlatformAuth: React.FC = () => {
return (
<div>
<Title level={4}></Title>
<Text type="secondary">API授权</Text>
<Title level={4}></Title>
<Text type="secondary">App ID和App Secret配置</Text>
<Divider />
@@ -390,7 +390,7 @@ const PlatformAuth: React.FC = () => {
<Card>
<div style={{ marginBottom: 16 }}>
<Button type="primary" icon={<PlusOutlined />} onClick={() => setModalVisible(true)}>
</Button>
</div>
@@ -405,7 +405,7 @@ const PlatformAuth: React.FC = () => {
</Card>
<Modal
title="添加平台授权"
title="添加平台开发者配置"
open={modalVisible}
onCancel={() => {
setModalVisible(false);
@@ -430,14 +430,11 @@ const PlatformAuth: React.FC = () => {
))}
</Select>
</Form.Item>
<Form.Item name="accountName" label="店铺名称" rules={[{ required: true, message: '请输入店铺名称' }]}>
<Input placeholder="输入店铺名称" />
<Form.Item name="appId" label="App ID" rules={[{ required: true, message: '请输入平台开发者App ID' }]}>
<Input placeholder="输入平台开发者App ID" />
</Form.Item>
<Form.Item name="accountId" label="账号ID" rules={[{ required: true, message: '请输入账号ID' }]}>
<Input placeholder="输入平台账号ID" />
</Form.Item>
<Form.Item name="shopId" label="店铺ID可选">
<Input placeholder="输入店铺ID" />
<Form.Item name="appSecret" label="App Secret" rules={[{ required: true, message: '请输入平台开发者App Secret' }]}>
<Input.Password placeholder="输入平台开发者App Secret" />
</Form.Item>
</Form>
</Modal>