mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
feat: 账户时间线详情页与接口完善
- 后端新增 /admin/accounts/:accountId/usage-records 接口,支持按账户聚合多 Key 记录并分页筛选、汇总统计 - 修复 API Key 时间线账户筛选跳过已删除账号,补充账户/Key 辅助解析 - 前端新增 AccountUsageRecordsView、路由及账户列表“时间线”入口,支持模型/API Key 筛选与 CSV 导出 - 补装 prettier-plugin-tailwindcss 并完成相关文件格式化
This commit is contained in:
@@ -1199,6 +1199,15 @@
|
||||
<i class="fas fa-chart-line" />
|
||||
<span class="ml-1">详情</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="canViewUsage(account)"
|
||||
class="rounded bg-purple-100 px-2.5 py-1 text-xs font-medium text-purple-700 transition-colors hover:bg-purple-200"
|
||||
title="请求时间线"
|
||||
@click="viewAccountTimeline(account)"
|
||||
>
|
||||
<i class="fas fa-clock" />
|
||||
<span class="ml-1">时间线</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="canTestAccount(account)"
|
||||
class="rounded bg-cyan-100 px-2.5 py-1 text-xs font-medium text-cyan-700 transition-colors hover:bg-cyan-200 dark:bg-cyan-900/40 dark:text-cyan-300 dark:hover:bg-cyan-800/50"
|
||||
@@ -1668,6 +1677,14 @@
|
||||
<i class="fas fa-chart-line" />
|
||||
详情
|
||||
</button>
|
||||
<button
|
||||
v-if="canViewUsage(account)"
|
||||
class="flex flex-1 items-center justify-center gap-1 rounded-lg bg-purple-50 px-3 py-2 text-xs text-purple-600 transition-colors hover:bg-purple-100"
|
||||
@click="viewAccountTimeline(account)"
|
||||
>
|
||||
<i class="fas fa-clock" />
|
||||
时间线
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="canTestAccount(account)"
|
||||
@@ -1855,6 +1872,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { showToast } from '@/utils/toast'
|
||||
import { apiClient } from '@/config/api'
|
||||
import { useConfirm } from '@/composables/useConfirm'
|
||||
@@ -1869,6 +1887,7 @@ import ActionDropdown from '@/components/common/ActionDropdown.vue'
|
||||
|
||||
// 使用确认弹窗
|
||||
const { showConfirmModal, confirmOptions, showConfirm, handleConfirm, handleCancel } = useConfirm()
|
||||
const router = useRouter()
|
||||
|
||||
// 数据状态
|
||||
const accounts = ref([])
|
||||
@@ -2100,6 +2119,13 @@ const getAccountActions = (account) => {
|
||||
color: 'indigo',
|
||||
handler: () => openAccountUsageModal(account)
|
||||
})
|
||||
actions.push({
|
||||
key: 'timeline',
|
||||
label: '请求时间线',
|
||||
icon: 'fa-clock',
|
||||
color: 'purple',
|
||||
handler: () => viewAccountTimeline(account)
|
||||
})
|
||||
}
|
||||
|
||||
// 测试账户
|
||||
@@ -2160,6 +2186,13 @@ const openAccountUsageModal = async (account) => {
|
||||
}
|
||||
}
|
||||
|
||||
const viewAccountTimeline = (account) => {
|
||||
router.push({
|
||||
path: `/accounts/${account.id}/usage-records`,
|
||||
query: { platform: account.platform || account.accountType }
|
||||
})
|
||||
}
|
||||
|
||||
const closeAccountUsageModal = () => {
|
||||
showAccountUsageModal.value = false
|
||||
accountUsageLoading.value = false
|
||||
|
||||
Reference in New Issue
Block a user