fix: 优化一些配置

This commit is contained in:
sophie committed 2026-07-30 16:49:27 +08:00
1 parent ac7b53a523
commit eb21af5949
17 files changed
+117 -208

No files matched your search

@@ -1,9 +1,9 @@
/**
* features/admin/modules/agents/components/AgentFormModal.vue
*
* 用途:应用管理新增/编辑弹窗,集中承载 Agent 基础信息、Dify/Iframe 配置和常见问题表单。
* 用途:应用管理新增/编辑弹窗,集中承载 Agent 基础信息(含启用状态)、Dify/Iframe 配置和常见问题表单。
* 依赖:agent.types AgentFormState、schedule.types ScheduleTask、AgentToolRunProgressConfig、vue-i18n。
* 逻辑:父组件控制 visible/isEditing/isSaving 与保存;本组件直接编辑传入的 form,并通过事件通知关闭、保存、增删常见问题。
* 逻辑:父组件控制 visible/isEditing/isSaving 与保存;本组件直接编辑传入的 form(含 is_active),并通过事件通知关闭、保存、增删常见问题。
*/
<script setup lang="ts">
@@ -340,6 +340,23 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
</div>
</template>
<div class="col-span-1 md:col-span-2 space-y-2">
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.fields.isActive') }}</label>
<div class="flex flex-col gap-2 rounded-xl border border-default bg-surface-soft/40 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
<p class="text-sm leading-6 text-secondary">
{{ form.is_active ? t('admin.agent.fields.isActiveHintOn') : t('admin.agent.fields.isActiveHintOff') }}
</p>
<label class="inline-flex shrink-0 items-center gap-2 rounded-xl border border-default bg-white px-3 py-2 text-sm text-secondary">
<input
v-model="form.is_active"
type="checkbox"
class="accent-brand-600"
/>
<span>{{ t('admin.agent.fields.isActiveEnable') }}</span>
</label>
</div>
</div>
<div class="col-span-1 md:col-span-2 space-y-2">
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.fields.description') }}</label>
<input
@@ -74,7 +74,6 @@ const {
getApplicationSortMark,
handleApplicationSearchChange,
openApplicationChatLogs,
openApplicationPermissionRequests,
isLoading,
currentTable,
tableData,
@@ -139,7 +138,6 @@ const applicationSortableKeys: ApplicationSortKey[] = [
'unique_users',
'last_active_at',
'authorized_users',
'pending_requests',
'avg_score',
];
@@ -531,7 +529,7 @@ onBeforeUnmount(() => {
</div>
</div>
<div v-if="applicationSummary" class="grid grid-cols-2 gap-3 md:grid-cols-4">
<div v-if="applicationSummary" class="grid grid-cols-1 gap-3 sm:grid-cols-3">
<button type="button" class="rounded-xl border border-default bg-surface p-4 text-left" @click="setApplicationUsageFilter('all')">
<div class="text-sm text-muted">{{ t('admin.report.appOps.summaryActive') }}</div>
<div class="mt-2 text-2xl font-bold text-primary">{{ applicationSummary.active_agents }}</div>
@@ -545,25 +543,20 @@ onBeforeUnmount(() => {
<div class="text-sm text-muted">{{ t('admin.report.appOps.summaryUnused') }}</div>
<div class="mt-2 text-2xl font-bold text-primary">{{ applicationSummary.unused_agents }}</div>
</button>
<div class="rounded-xl border border-default bg-surface p-4">
<div class="text-sm text-muted">{{ t('admin.report.appOps.summaryPending') }}</div>
<div class="mt-2 text-2xl font-bold text-primary">{{ applicationSummary.pending_permission_total }}</div>
</div>
</div>
<div class="admin-report-table-wrap">
<table class="admin-report-table admin-report-table--app-ops w-full table-fixed border-collapse">
<colgroup>
<col class="w-[14%]" />
<col class="w-[7%]" />
<col class="w-[7%]" />
<col class="w-[16%]" />
<col class="w-[7%]" />
<col class="w-[7%]" />
<col class="w-[8%]" />
<col class="w-[8%]" />
<col class="w-[8%]" />
<col class="w-[18%]" />
<col class="w-[8%]" />
<col class="w-[10%]" />
<col class="w-[10%]" />
<col class="w-[10%]" />
<col class="w-[12%]" />
</colgroup>
<thead>
<tr>
@@ -588,7 +581,7 @@ onBeforeUnmount(() => {
</thead>
<tbody>
<tr v-if="applicationItems.length === 0">
<td colspan="10" class="text-center text-muted py-12">
<td colspan="9" class="text-center text-muted py-12">
{{ t('admin.report.appOps.empty') }}
</td>
</tr>
@@ -600,7 +593,6 @@ onBeforeUnmount(() => {
{{ row.last_active_at ? formatLocalDateTime(row.last_active_at) : '-' }}
</td>
<td class="px-3 py-3 text-left align-middle font-mono tabular-nums">{{ row.authorized_users }}</td>
<td class="px-3 py-3 text-left align-middle font-mono tabular-nums">{{ row.pending_requests }}</td>
<td class="px-3 py-3 text-left align-middle font-mono tabular-nums whitespace-nowrap">
{{ row.avg_score == null ? '-' : row.avg_score }}
<span v-if="row.feedback_count" class="text-xs text-muted">({{ row.feedback_count }})</span>
@@ -612,14 +604,9 @@ onBeforeUnmount(() => {
</span>
</td>
<td class="px-3 py-3 text-left align-middle">
<div class="flex flex-wrap gap-1">
<button type="button" class="btn-secondary text-xs px-2 py-1" @click="openApplicationChatLogs(row)">
{{ t('admin.report.appOps.actionLogs') }}
</button>
<button type="button" class="btn-secondary text-xs px-2 py-1" @click="openApplicationPermissionRequests(row)">
{{ t('admin.report.appOps.actionRequests') }}
</button>
</div>
<button type="button" class="btn-secondary text-xs px-2 py-1" @click="openApplicationChatLogs(row)">
{{ t('admin.report.appOps.actionLogs') }}
</button>
</td>
</tr>
</tbody>
@@ -207,18 +207,6 @@ export function useReportsAdmin() {
});
};
/**
* 下钻到权限申请列表,按 agent_id 精确过滤。
* @param row - 应用运营行
*/
const openApplicationPermissionRequests = (row: ApplicationReportItem): void => {
void router.push({
name: 'AdminReports',
params: { table: 'permission_requests' },
query: { agent_id: String(row.agent_id) },
});
};
/**
* 导出应用运营报表 Excel(仅运营字段)。
*/
@@ -237,7 +225,6 @@ export function useReportsAdmin() {
? formatLocalDateTime(row.last_active_at)
: '-',
[t('admin.report.appOps.columns.authorized_users')]: row.authorized_users,
[t('admin.report.appOps.columns.pending_requests')]: row.pending_requests,
[t('admin.report.appOps.columns.avg_score')]: row.avg_score ?? '-',
[t('admin.report.appOps.columns.feedback_count')]: row.feedback_count,
[t('admin.report.appOps.columns.tokens_used')]: row.tokens_used,
@@ -405,7 +392,7 @@ const dataSourceTable = computed<Exclude<AdminReportTableId, 'usage_analysis'>>(
});
/**
* 从路由 query 灌入列筛选(用于应用运营下钻到聊天日志 / 权限申请)。
* 从路由 query 灌入列筛选(用于应用运营下钻到聊天日志)。
*/
const applyRouteQueryFilters = (): void => {
const next: Record<string, string> = {};
@@ -1218,7 +1205,6 @@ watch([reportPageSize, sortedTableData], () => {
getApplicationSortMark,
handleApplicationSearchChange,
openApplicationChatLogs,
openApplicationPermissionRequests,
isLoading,
currentTable,
tableData,