+
+
+
+
+
{{ t('admin.report.title', { table: getReportTableLabel(currentTable) }) }}
+
{{ t('admin.report.usageIntro') }}
+
+
+
+ {{ t('admin.report.dateFrom') }}
+
+
+
+ {{ t('admin.report.dateTo') }}
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.usage') }}
-
{{ t('admin.report.usageIntro') }}
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.usageTotalSessions') }}
-
-
-
{{ usageReport.total }}
-
-
-
- {{ t('admin.report.usageActiveUsers') }}
-
-
-
{{ usageUserTotal }}
-
{{ t('admin.report.usageByUserTopHint', { limit: usageUserTopLimit }) }}
-
-
-
- {{ t('admin.report.usageActiveAgents') }}
-
-
-
{{ usageActiveAgentCount }}
-
-
-
-
-
-
-
{{ t('admin.report.usageTrend') }}
-
-
-
-
-
-
{{ formatUsageDayLabel(day.date) }}
-
-
-
{{ t('admin.report.usageTrendEmpty') }}
-
-
-
-
-
{{ t('admin.report.usageInsights') }}
-
-
-
-
-
-
{{ t('admin.report.usageLowAgents') }}
-
-
-
- {{ t('admin.report.usageLowAgentsHint', { max: usageLowAgentMaxChats, limit: usageLowAgentListLimit }) }}
-
-
-
-
-
- {{ item.agent }}
- {{ item.count }}
-
-
-
{{ t('admin.report.usageLowAgentsEmpty') }}
-
-
-
-
{{ t('admin.report.usageSpikeDays') }}
-
-
-
- {{ t('admin.report.usageSpikeDaysHint', {
- min: usageSpikeDayMinChats,
- multiplier: usageSpikeDayAvgMultiplier,
- limit: usageSpikeDayListLimit,
- }) }}
-
-
-
-
-
- {{ item.date }}
- {{ item.count }}
-
-
-
{{ t('admin.report.usageSpikeDaysEmpty') }}
-
-
-
-
-
-
-
-
-
{{ t('admin.report.byDepartment') }}
-
{{ t('admin.report.usageByDepartmentHint') }}
-
-
-
- {{ d.department || t('admin.report.unknownDepartment') }}
- {{ d.chat_count }}
-
-
- {{ t('admin.report.usageByDepartmentEmpty') }}
-
-
-
-
-
-
{{ t('admin.report.usageHourHeatmap') }}
- {{ t('admin.report.usageHourHeatmapHint') }}
-
-
-
-
-
{{ h % 6 === 0 || h === 23 ? `${h}:00` : '' }}
-
-
- {{ getWorkdayLabel(usageReport.hour_heatmap.weekdays[wIdx] ?? 0) }}
-
-
-
-
-
-
{{ t('admin.report.usageHourHeatmapEmpty') }}
-
-
-
-
-
-
-
{{ t('admin.report.byAgent') }}
-
{{ t('admin.report.usageByAgentHint') }}
-
-
-
- {{ a.agent }}
- {{ a.count }}
-
-
- {{ t('admin.report.usageByAgentEmpty') }}
-
-
-
-
-
-
-
{{ t('admin.report.byUser') }}
-
{{ t('admin.report.usageByUserTopHint', { limit: usageUserTopLimit }) }}
-
-
-
- {{ formatUsageUserLabel(u) }}
- {{ u.count }}
-
-
- {{ t('admin.report.usageByUserEmpty') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- |
- {{ t('admin.report.appOps.columns.category') }} |
- {{ t('admin.report.appOps.columns.is_active') }} |
- {{ t('admin.report.appOps.columns.actions') }} |
-
-
-
-
- |
- {{ t('admin.report.appOps.empty') }}
- |
-
-
- |
- {{ row.name }}
-
- {{ t('admin.report.appOps.authorizedUnused') }}
-
- |
- {{ row.chat_count }} |
- {{ row.unique_users }} |
-
- {{ row.last_active_at ? formatLocalDateTime(row.last_active_at) : '-' }}
- |
- {{ row.authorized_users }} |
-
- {{ row.avg_score == null ? '-' : row.avg_score }}
- ({{ row.feedback_count }})
- |
- {{ row.category || '-' }} |
-
-
- {{ row.is_active ? t('admin.report.appOps.statusActive') : t('admin.report.appOps.statusInactive') }}
-
- |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.tableSettings') }}
-
-
-
-
-
-
-
-
-
-
- {{ t('admin.report.advancedSortRules') }}
-
-
-
{{ t('admin.report.noAdvancedSort') }}
-
-
-
{{ ridx + 1 }}.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.opsOverview.title') }}
-
{{ t('admin.report.opsOverview.intro') }}
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.opsOverview.kpi.totalChats') }}
-
-
-
{{ opsOverview.kpi.total_chats }}
-
-
-
- {{ t('admin.report.opsOverview.kpi.activeUsers') }}
-
-
-
{{ opsOverview.kpi.active_users }}
-
-
-
- {{ t('admin.report.opsOverview.kpi.activeAgents') }}
-
-
-
{{ opsOverview.kpi.active_agents }}
-
-
-
- {{ t('admin.report.opsOverview.kpi.pendingFollowup') }}
-
-
-
{{ opsOverview.kpi.pending_feedback }}
-
-
-
-
-
-
{{ t('admin.report.opsOverview.trendTitle') }}
-
-
- {{ formatChangePct() }}
-
-
-
-
-
-
{{ formatUsageDayLabel(day.date) }}
-
-
-
{{ t('admin.report.opsOverview.trendEmpty') }}
-
-
-
-
-
-
{{ t('admin.report.opsOverview.topApps') }}
-
-
-
-
- {{ a.name }}
- {{ a.chat_count }}
-
-
-
{{ t('admin.report.opsOverview.empty') }}
-
-
-
-
{{ t('admin.report.opsOverview.lowUseApps') }}
-
-
-
-
- {{ a.name }}
- {{ a.chat_count }}
-
-
-
{{ t('admin.report.opsOverview.empty') }}
-
-
-
-
-
-
-
{{ t('admin.report.opsOverview.empty') }}
-
-
-
-
-
-
-
-
-
{{ t('admin.report.issueAnalysis.kpi.highFreq') }}
-
{{ issueAnalysis.kpi.high_freq_clusters }}
-
{{ t('admin.report.issueAnalysis.kpi.highFreqHint', { ratio: issueAnalysis.kpi.top10_ratio }) }}
-
-
-
{{ t('admin.report.issueAnalysis.kpi.attention') }}
-
{{ issueAnalysis.kpi.attention_signals }}
-
{{ t('admin.report.issueAnalysis.kpi.attentionHint') }}
-
-
-
{{ t('admin.report.issueAnalysis.kpi.review') }}
-
{{ issueAnalysis.kpi.review_signals }}
-
{{ t('admin.report.issueAnalysis.kpi.reviewHint') }}
-
-
-
{{ t('admin.report.issueAnalysis.kpi.emptyAnswer') }}
-
{{ issueAnalysis.kpi.empty_answers }}
-
{{ t('admin.report.issueAnalysis.kpi.emptyAnswerHint') }}
-
-
-
{{ t('admin.report.issueAnalysis.kpi.topApp') }}
-
{{ issueAnalysis.kpi.top_risk_app.name }}
-
{{ t('admin.report.issueAnalysis.kpi.topAppHint', { ratio: issueAnalysis.kpi.top_risk_app.attention_ratio }) }}
-
-
-
-
-
-
-
{{ t('admin.report.issueAnalysis.priorityTitle') }}
-
-
-
-
-
- | {{ t('admin.report.issueAnalysis.colTopic') }} |
- {{ t('admin.report.issueAnalysis.colCount') }} |
- {{ t('admin.report.issueAnalysis.colApps') }} |
- {{ t('admin.report.issueAnalysis.colAttention') }} |
- {{ t('admin.report.issueAnalysis.colReasons') }} |
- {{ t('admin.report.issueAnalysis.colChecks') }} |
-
-
-
-
- | {{ q.topic }} |
- {{ q.count }} |
- {{ q.apps }} |
-
- {{ q.attention_count }}
- |
-
-
- {{ getChatLogRiskReasonLabel(r) }}
-
- |
-
-
- {{ getChatLogRiskCheckLabel(c) }}
-
- |
-
-
- | {{ t('admin.report.issueAnalysis.empty') }} |
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.noData', { table: getReportTableLabel(currentTable) }) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.chatLog.tops.questions') }}
-
-
-
{{ item.label }}
-
-
{{ item.count }}
-
-
{{ t('admin.report.chatLog.tops.empty') }}
-
-
-
-
{{ t('admin.report.chatLog.tops.answers') }}
-
-
-
{{ item.label }}
-
-
{{ item.count }}
-
-
{{ t('admin.report.chatLog.tops.empty') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.feedback.summary.pending') }}
-
{{ feedbackSummary.pending_count }}
-
{{ t('admin.report.feedback.summary.pendingHint') }}
-
-
-
{{ t('admin.report.feedback.summary.closed') }}
-
{{ feedbackSummary.closed_this_month }}
-
{{ t('admin.report.feedback.summary.closedHint') }}
-
-
-
{{ t('admin.report.feedback.summary.topApp') }}
-
{{ feedbackSummary.top_app.name }}
-
{{ t('admin.report.feedback.summary.topAppHint', { count: feedbackSummary.top_app.count }) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.report.chatLog.title') }}
-
-
-
-
-
- {{ t('admin.report.chatLog.riskStatus') }}
-
- {{ getChatLogRiskStatusLabel(chatLogDetailRow.risk_status) }}
-
- {{ t('admin.report.chatLog.riskScore') }}
-
- {{ chatLogDetailRow.risk_score ?? '-' }}
-
-
-
-
-
-
{{ t('admin.report.chatLog.meta.app') }}{{ chatLogDetailRow.agent_name || '-' }}
-
{{ t('admin.report.chatLog.meta.user') }}{{ chatLogDetailRow.real_name || chatLogDetailRow.username || '-' }}
-
{{ t('admin.report.chatLog.meta.createdAt') }}{{ chatLogDetailRow.created_at ? formatLocalDateTime(chatLogDetailRow.created_at) : '-' }}
-
{{ t('admin.report.chatLog.meta.chatLogId') }}#{{ chatLogDetailRow.id ?? '-' }}
-
{{ t('admin.report.chatLog.meta.rating') }}{{ chatLogDetailRow.feedback_score ?? '-' }}
-
{{ t('admin.report.chatLog.meta.negativeFeedback') }}{{ chatLogDetailRow.negative_feedback_count ?? 0 }}
-
-
-
-
{{ t('admin.report.chatLog.question') }}
-
{{ chatLogDetailRow.query || '-' }}
-
-
-
-
{{ t('admin.report.chatLog.answer') }}
-
{{ chatLogDetailRow.answer || '-' }}
-
-
-
-
{{ t('admin.report.chatLog.reasons') }}
-
-
- {{ getChatLogRiskReasonLabel(r) }}
-
- {{ t('admin.report.chatLog.noReason') }}
-
-
-
-
-
{{ t('admin.report.chatLog.checks') }}
-
-
-
- ✓
- {{ getChatLogRiskCheckLabel(c) }}
-
-
-
{{ t('admin.report.chatLog.noCheck') }}
-
-
-
-
-
-
-
-
-
+
+ {{ t('admin.report.chatLog.close') }}
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/reports/composables/useReportsAdmin.ts b/frontend/src/features/admin/modules/reports/composables/useReportsAdmin.ts
index d4c501e8..2b4f8890 100644
--- a/frontend/src/features/admin/modules/reports/composables/useReportsAdmin.ts
+++ b/frontend/src/features/admin/modules/reports/composables/useReportsAdmin.ts
@@ -1,8 +1,8 @@
/**
* features/admin/modules/reports/composables/useReportsAdmin.ts
* 用途:管理后台报表(多表浏览、筛选、排序、chat_logs 批量删除、使用分析与应用运营看板)。
- * 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router。
- * 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,均复用 PaginationBar;
+ * 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router、element-plus(ElMessageBox)。
+ * 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,页码状态交给页面的 ElPagination;
* 低使用应用优先消费后端 low_agents(含零使用启用应用),与应用运营口径对齐;
* 统计范围统一为开始/结束日期(默认近 30 天),经 start_date/end_date 传给后端,聊天日志走 created_from/created_to;
* 趋势 by_day 前端按日期升序兜底;问题分析优先问题表前端分页;非表页切换时清空通用表状态防幽灵分页。
@@ -10,6 +10,7 @@
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
+import { ElMessageBox } from 'element-plus';
import * as XLSX from 'xlsx';
import {
batchDeleteAdminChatLogs,
@@ -655,30 +656,6 @@ export function useReportsAdmin() {
};
const isLoading = ref(true);
- const showDeleteConfirmDialog = ref(false);
- const deleteConfirmMessage = ref('');
- let deleteConfirmAction: (() => Promise
| void) | null = null;
-
- const openDeleteConfirm = (message: string, action: () => Promise | void): void => {
- deleteConfirmMessage.value = message;
- deleteConfirmAction = action;
- showDeleteConfirmDialog.value = true;
- };
-
- const closeDeleteConfirm = (): void => {
- showDeleteConfirmDialog.value = false;
- deleteConfirmAction = null;
- };
-
- const confirmDelete = async (): Promise => {
- if (!deleteConfirmAction) return;
- try {
- await deleteConfirmAction();
- } finally {
- closeDeleteConfirm();
- }
- };
-
const resolveTableFromRoute = (): AdminReportTableId => {
const table = route.params.table;
if (typeof table === 'string' && (ADMIN_REPORT_TABLES as readonly string[]).includes(table)) {
@@ -1575,25 +1552,41 @@ const toggleAllReportRows = () => {
selectedReportRowIds.value = Array.from(merged);
};
-const batchDeleteChatLogs = async () => {
+/**
+ * 批量删除已勾选的聊天日志。
+ * 核心逻辑:先弹出 Element 确认框;取消则直接返回。确认后按当前选中 id 调用原批量删除接口并刷新列表与总数。
+ * @returns 无。取消确认时不请求接口。
+ */
+const batchDeleteChatLogs = async (): Promise => {
if (!isChatLogsTable.value) return;
if (selectedReportRowIds.value.length === 0) return;
const targetRowIds = [...selectedReportRowIds.value];
- openDeleteConfirm(`Delete ${targetRowIds.length} selected chat logs?`, async () => {
- isDeletingChatLogs.value = true;
- try {
- const data = await batchDeleteAdminChatLogs(targetRowIds);
- msg.success(`Deleted ${data.deleted_count ?? 0} chat logs.`);
- selectedReportRowIds.value = [];
- await loadTableData();
- chatLogsTotal.value = await loadTableCount('chat_logs');
- } catch (e) {
- console.error(e);
- msg.error((e as Error).message || t('admin.msg.failed'));
- } finally {
- isDeletingChatLogs.value = false;
- }
- });
+ try {
+ await ElMessageBox.confirm(
+ t('admin.report.deleteSelected', { count: targetRowIds.length }),
+ t('common.deleteDialog.defaultTitle'),
+ {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ },
+ );
+ } catch {
+ return;
+ }
+ isDeletingChatLogs.value = true;
+ try {
+ const data = await batchDeleteAdminChatLogs(targetRowIds);
+ msg.success(`Deleted ${data.deleted_count ?? 0} chat logs.`);
+ selectedReportRowIds.value = [];
+ await loadTableData();
+ chatLogsTotal.value = await loadTableCount('chat_logs');
+ } catch (e) {
+ console.error(e);
+ msg.error((e as Error).message || t('admin.msg.failed'));
+ } finally {
+ isDeletingChatLogs.value = false;
+ }
};
watch(currentTable, async () => {
@@ -1913,8 +1906,6 @@ watch([reportPageSize, issueQuestionTotal], () => {
reportRangeStart,
reportRangeEnd,
reportPageButtons,
- showDeleteConfirmDialog,
- deleteConfirmMessage,
loadAll,
handleFilterChange,
resetChatLogsColumns,
@@ -1941,6 +1932,5 @@ watch([reportPageSize, issueQuestionTotal], () => {
goToReportPage,
prevReportPage,
nextReportPage,
- confirmDelete,
};
}
diff --git a/frontend/src/features/admin/modules/training-config/TrainingConfigPage.vue b/frontend/src/features/admin/modules/training-config/TrainingConfigPage.vue
index 1413f0b8..eab05172 100644
--- a/frontend/src/features/admin/modules/training-config/TrainingConfigPage.vue
+++ b/frontend/src/features/admin/modules/training-config/TrainingConfigPage.vue
@@ -1,36 +1,56 @@
-
-
-
{{ t('admin.trainingConfig.eyebrow') }}
-
-
-
{{ t('admin.trainingConfig.title') }}
-
{{ t('admin.trainingConfig.subtitle') }}
+
+
+
+ {{ t('admin.trainingConfig.title') }}
+ {{ t('admin.trainingConfig.subtitle') }}
+
+
+
+
+
+
{{ t('admin.trainingConfig.empty') }}
+
+ {{ t('admin.trainingConfig.addType') }}
+
-
{{ t('admin.trainingConfig.pageHint') }}
-
-
-
-
-
-
{{ stat.label }}
{{ stat.value }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ form.name }}
-
- {{ t(`admin.trainingConfig.status.${form.status}`) }}
-
-
-
{{ t('admin.trainingConfig.headerMeta', { type: selected.training_type, version: form.version }) }}
-
+
+