fix: 修复未匹配订单更新逻辑和前端API类型定义

- 修复 PositionCheckService 中未匹配订单更新逻辑,当仓位数量大于等于订单数量总和时也能正确处理
- 修复前端 API 类型定义,添加 remark 和 website 字段支持
- 添加 Leader 备注和网站字段支持
This commit is contained in:
WrBug
2025-12-07 05:07:58 +08:00
parent cb167d442f
commit 5c136ab0f4
22 changed files with 1639 additions and 939 deletions
+69 -7
View File
@@ -1,12 +1,14 @@
import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Card, Table, Button, Space, Tag, Popconfirm, message, List, Empty, Spin, Divider } from 'antd'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'
import { Card, Table, Button, Space, Tag, Popconfirm, message, List, Empty, Spin, Divider, Typography } from 'antd'
import { PlusOutlined, EditOutlined, DeleteOutlined, LinkOutlined, GlobalOutlined } from '@ant-design/icons'
import { useTranslation } from 'react-i18next'
import { apiService } from '../services/api'
import type { Leader } from '../types'
import { useMediaQuery } from 'react-responsive'
const { Text } = Typography
const LeaderList: React.FC = () => {
const { t, i18n } = useTranslation()
const navigate = useNavigate()
@@ -73,6 +75,16 @@ const LeaderList: React.FC = () => {
<Tag color={category === 'sports' ? 'blue' : 'green'}>{category}</Tag>
) : <Tag>{t('leaderList.all') || '全部'}</Tag>
},
{
title: t('leaderList.remark') || '备注',
dataIndex: 'remark',
key: 'remark',
render: (remark: string | undefined) => remark ? (
<Text ellipsis={{ tooltip: remark }} style={{ maxWidth: isMobile ? 100 : 200 }}>
{remark}
</Text>
) : <Text type="secondary">-</Text>
},
{
title: t('leaderList.copyTradingCount') || '跟单关系数',
dataIndex: 'copyTradingCount',
@@ -97,9 +109,19 @@ const LeaderList: React.FC = () => {
{
title: t('common.actions') || '操作',
key: 'action',
width: isMobile ? 120 : 150,
width: isMobile ? 150 : 200,
render: (_: any, record: Leader) => (
<Space size="small">
<Space size="small" wrap>
{record.website && (
<Button
type="link"
size="small"
icon={<GlobalOutlined />}
onClick={() => window.open(record.website, '_blank', 'noopener,noreferrer')}
>
{t('leaderList.openWebsite') || '打开网页'}
</Button>
)}
<Button
type="link"
size="small"
@@ -199,6 +221,35 @@ const LeaderList: React.FC = () => {
</div>
</div>
{/* 备注 */}
{leader.remark && (
<div style={{ marginBottom: '12px' }}>
<Text type="secondary" style={{ fontSize: '12px' }}>
{t('leaderList.remark') || '备注'}
</Text>
<Text style={{ fontSize: '12px', marginLeft: '4px' }}>
{leader.remark}
</Text>
</div>
)}
{/* 网站 */}
{leader.website && (
<div style={{ marginBottom: '12px' }}>
<Text type="secondary" style={{ fontSize: '12px' }}>
{t('leaderList.website') || '网站'}
</Text>
<a
href={leader.website}
target="_blank"
rel="noopener noreferrer"
style={{ fontSize: '12px', marginLeft: '4px' }}
>
<LinkOutlined /> {leader.website}
</a>
</div>
)}
<Divider style={{ margin: '12px 0' }} />
{/* 分类和跟单关系数 */}
@@ -221,13 +272,24 @@ const LeaderList: React.FC = () => {
</div>
{/* 操作按钮 */}
<div style={{ display: 'flex', gap: '8px' }}>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
{leader.website && (
<Button
type="link"
size="small"
icon={<GlobalOutlined />}
onClick={() => window.open(leader.website, '_blank', 'noopener,noreferrer')}
style={{ flex: 1, minWidth: '80px' }}
>
{t('leaderList.openWebsite') || '打开网页'}
</Button>
)}
<Button
type="link"
size="small"
icon={<EditOutlined />}
onClick={() => navigate(`/leaders/edit?id=${leader.id}`)}
style={{ flex: 1 }}
style={{ flex: 1, minWidth: '80px' }}
>
{t('common.edit') || '编辑'}
</Button>
@@ -243,7 +305,7 @@ const LeaderList: React.FC = () => {
size="small"
danger
icon={<DeleteOutlined />}
style={{ flex: 1 }}
style={{ flex: 1, minWidth: '80px' }}
>
{t('common.delete') || '删除'}
</Button>