feat: 新增平台客服角色与客服查询菜单

This commit is contained in:
2026-11-09 18:18:19 +08:00
parent 38cbb37a08
commit 08884270b7
23 changed files with 1075 additions and 106 deletions
@@ -11,6 +11,7 @@ export interface TokenStatusLogDrawerProps {
open: boolean
token: RockTokenItem | null
onClose: () => void
loadLogs?: (tokenId: number) => Promise<RockTokenStatusLog[]>
}
const EVENT_META: Record<string, { label: string; color: string }> = {
@@ -66,6 +67,7 @@ export function TokenStatusLogDrawer({
open,
token,
onClose,
loadLogs,
}: TokenStatusLogDrawerProps) {
const screens = Grid.useBreakpoint()
const isMobile = !screens.md
@@ -78,14 +80,16 @@ export function TokenStatusLogDrawer({
setLoading(true)
setError('')
try {
const res = await rockApi.listTokenStatusLogs(token.id)
setLogs(res.list || [])
const list = loadLogs
? await loadLogs(token.id)
: (await rockApi.listTokenStatusLogs(token.id)).list || []
setLogs(list)
} catch (e) {
setError(e instanceof Error ? e.message : '加载状态历史失败')
} finally {
setLoading(false)
}
}, [token])
}, [token, loadLogs])
useEffect(() => {
if (!open || !token) return
@@ -5,6 +5,7 @@ import {
EyeOutlined,
FileTextOutlined,
HistoryOutlined,
MessageOutlined,
StopOutlined,
SyncOutlined,
UndoOutlined,
@@ -80,6 +81,7 @@ export interface TokenColumnHandlers {
usingWarnDays: number
usingDangerDays: number
boundWarnDays: number
readOnly?: boolean
refreshingTokenId: number | null
onRefreshBinding: (id: number) => void
openingUpstreamId: number | null
@@ -100,6 +102,7 @@ export function buildTokenColumns({
usingWarnDays,
usingDangerDays,
boundWarnDays,
readOnly,
refreshingTokenId,
onRefreshBinding,
openingUpstreamId,
@@ -362,14 +365,31 @@ export function buildTokenColumns({
title: '备注',
width: 44,
align: 'center',
render: (_, record) => (
<TokenRemarkCell
record={record}
onUpdateRemark={onUpdateRemark}
onMarkAbnormal={onMarkAbnormal}
compact
/>
),
render: (_, record) =>
readOnly ? (
record.remark ? (
<Tooltip
title={
<div style={{ maxWidth: 280, whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
{record.remark}
</div>
}
>
<span style={{ display: 'inline-flex', cursor: 'default' }}>
<MessageOutlined style={{ color: '#1677ff', fontSize: 16 }} />
</span>
</Tooltip>
) : (
<Text type="secondary">-</Text>
)
) : (
<TokenRemarkCell
record={record}
onUpdateRemark={onUpdateRemark}
onMarkAbnormal={onMarkAbnormal}
compact
/>
),
},
{
title: '凭证',
@@ -448,24 +468,28 @@ export function buildTokenColumns({
)
},
},
{
title: '原始',
width: 44,
align: 'center',
render: (_, record) =>
record.raw_data ? (
<Tooltip title="查看原始数据">
<Button
size="small"
type="text"
icon={<FileTextOutlined />}
onClick={() => onViewRawData(record)}
/>
</Tooltip>
) : (
<Text type="secondary">-</Text>
),
},
...(readOnly
? []
: [
{
title: '原始',
width: 44,
align: 'center' as const,
render: (_: unknown, record: RockTokenItem) =>
record.raw_data ? (
<Tooltip title="查看原始数据">
<Button
size="small"
type="text"
icon={<FileTextOutlined />}
onClick={() => onViewRawData(record)}
/>
</Tooltip>
) : (
<Text type="secondary">-</Text>
),
},
]),
{
title: '操作',
key: 'action',
@@ -513,6 +537,14 @@ export function buildTokenColumns({
历史
</Button>
)
if (readOnly) {
return (
<Space size={4} wrap>
{upstreamButton}
{historyButton}
</Space>
)
}
if (record.status === 'mismatch') {
return (
<Space size={4} wrap>