后台管理功能补充
This commit is contained in:
@@ -235,7 +235,27 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<AiConfigQuickActions />
|
||||
<el-card>
|
||||
<template #header>
|
||||
<span>AI配置调用排行</span>
|
||||
</template>
|
||||
<el-table
|
||||
:data="aiConfigCallStats"
|
||||
style="width: 100%"
|
||||
size="small"
|
||||
height="300"
|
||||
:default-sort="{ prop: 'callCount', order: 'descending' }"
|
||||
>
|
||||
<el-table-column prop="configName" label="配置" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="callCount" label="调用次数" width="100" sortable />
|
||||
<el-table-column label="状态" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.isEnabled === 1" type="success" size="small">启用</el-tag>
|
||||
<el-tag v-else type="info" size="small">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -246,8 +266,7 @@ import { ref, reactive, onMounted } from 'vue'
|
||||
import { User, UserFilled, TrendCharts, ChatDotRound, Setting, CircleCheck, CircleClose, Star } from '@element-plus/icons-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import { countEnabledConfigs, countDisabledConfigs, countDefaultConfigs } from '@/api/aiconfig'
|
||||
import { getDashboardStats, getUserGrowthTrends, getRecentLogins, type DashboardStats, type UserGrowthTrend, type RecentLogin } from '@/api/dashboard'
|
||||
import AiConfigQuickActions from '@/components/AiConfigQuickActions.vue'
|
||||
import { getDashboardStats, getUserGrowthTrends, getRecentLogins, getAiConfigCallStats, type DashboardStats, type UserGrowthTrend, type RecentLogin, type AiConfigCallStatsItem } from '@/api/dashboard'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const userChartRef = ref<HTMLElement>()
|
||||
@@ -296,6 +315,7 @@ const aiStats = reactive({
|
||||
|
||||
const recentLogins = ref<RecentLogin[]>([])
|
||||
const userGrowthTrends = ref<UserGrowthTrend[]>([])
|
||||
const aiConfigCallStats = ref<AiConfigCallStatsItem[]>([])
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -338,6 +358,9 @@ const fetchDashboardData = async () => {
|
||||
|
||||
// 获取AI配置统计(保持原有逻辑)
|
||||
await fetchAiStats()
|
||||
|
||||
// 获取AI配置调用排行
|
||||
await fetchAiConfigCallStats()
|
||||
|
||||
// 更新图表数据
|
||||
updateUserChart()
|
||||
@@ -368,6 +391,18 @@ const fetchAiStats = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AI配置调用次数统计(按调用次数倒序)
|
||||
*/
|
||||
const fetchAiConfigCallStats = async () => {
|
||||
try {
|
||||
const res = await getAiConfigCallStats(10)
|
||||
aiConfigCallStats.value = res.data?.items || []
|
||||
} catch (error) {
|
||||
console.error('获取AI配置调用统计失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
let userChart: any = null
|
||||
|
||||
const initUserChart = () => {
|
||||
|
||||
Reference in New Issue
Block a user