fix(admin): 修改一些样式和布局

This commit is contained in:
sophie committed 2026-06-22 19:31:14 +08:00
1 parent 82ad4323f8
commit 7300098ff9
1 file changed
+60 -51
@@ -109,14 +109,21 @@ onMounted(() => {
<Bot class="w-12 h-12 mx-auto text-muted mb-3" />
<p class="text-lg text-secondary">{{ t('admin.agent.noAgents') }}</p>
</div>
<table v-else class="admin-table">
<table v-else class="admin-table table-fixed w-full">
<colgroup>
<col class="w-72" />
<col class="w-[4.5rem]" />
<col class="w-32" />
<col class="w-[5.5rem]" />
<col />
</colgroup>
<thead>
<tr>
<th class="px-8 py-4 text-sm">{{ t('admin.agent.headers.name') }}</th>
<th class="px-8 py-4 text-sm">{{ t('admin.agent.headers.type') }}</th>
<th class="px-8 py-4 text-sm">{{ t('admin.agent.headers.config') }}</th>
<th class="px-8 py-4 text-sm">{{ t('admin.agent.headers.status') }}</th>
<th class="px-8 py-4 text-sm text-right">{{ t('admin.agent.headers.actions') }}</th>
<th class="px-4 py-4 text-sm">{{ t('admin.agent.headers.name') }}</th>
<th class="px-2 py-4 text-sm">{{ t('admin.agent.headers.type') }}</th>
<th class="px-2 py-4 text-sm">{{ t('admin.agent.headers.config') }}</th>
<th class="px-2 py-4 text-sm">{{ t('admin.agent.headers.status') }}</th>
<th class="px-4 py-4 text-sm text-right">{{ t('admin.agent.headers.actions') }}</th>
</tr>
</thead>
<tbody>
@@ -127,66 +134,68 @@ onMounted(() => {
:class="{ 'bg-blue-50/50': selectedAgentId === agent.id }"
@click="openEditDialog(agent)"
>
<td class="px-8 py-5">
<div class="font-bold text-primary text-base">{{ agent.name }}</div>
<div class="section-desc mt-1">{{ agent.description }}</div>
<td class="px-4 py-5 max-w-72">
<div class="font-bold text-primary text-base truncate" :title="agent.name">{{ agent.name }}</div>
<div class="section-desc mt-1 truncate" :title="agent.description">{{ agent.description }}</div>
</td>
<td class="px-8 py-5">
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-surface-soft text-primary uppercase tracking-wide">
<td class="px-2 py-5 whitespace-nowrap">
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium bg-surface-soft text-primary uppercase tracking-wide">
{{ agent.type }}
</span>
</td>
<td class="px-8 py-5 font-mono text-xs text-muted max-w-xs truncate">
<span v-if="agent.type === 'api'" class="flex items-center gap-1">
<td class="px-2 py-5 font-mono text-xs text-muted max-w-32 truncate">
<span v-if="agent.type === 'api'" class="truncate" :title="String(agent.dify_app_id)">
<span class="text-muted">{{ t('admin.agent.idLabel') }}:</span> {{ agent.dify_app_id }}
</span>
<span v-else class="flex items-center gap-1" :title="String(agent.extra_config?.iframe_url || '')">
<span v-else class="truncate block" :title="String(agent.extra_config?.iframe_url || '')">
<span class="text-muted">{{ t('admin.agent.urlLabel') }}:</span> {{ agent.extra_config?.iframe_url }}
</span>
</td>
<td class="px-8 py-5">
<td class="px-2 py-5 whitespace-nowrap">
<span
class="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border"
class="inline-flex shrink-0 items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border whitespace-nowrap"
:class="agent.is_active ? 'bg-green-50 text-green-700 border-green-100' : 'bg-surface-soft text-secondary border-default'"
>
<span class="w-2 h-2 rounded-full" :class="agent.is_active ? 'bg-green-500' : 'bg-surface-strong'" />
<span class="w-2 h-2 shrink-0 rounded-full" :class="agent.is_active ? 'bg-green-500' : 'bg-surface-strong'" />
{{ agent.is_active ? t('admin.status.active') : t('admin.status.disabled') }}
</span>
</td>
<td class="px-8 py-5 text-right flex justify-end gap-2">
<button
type="button"
class="inline-flex items-center gap-1.5 rounded-lg bg-blue-50 px-3 py-2 text-sm font-medium text-blue-600 transition-all hover:bg-blue-100"
:title="t('admin.edit')"
@click.stop="openEditDialog(agent)"
>
<SquarePen class="w-4 h-4" />
{{ t('admin.edit') }}
</button>
<button
type="button"
class="p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all"
:title="t('admin.agent.manageAccess')"
@click.stop="openPermissionModal(agent)"
>
<Users class="w-5 h-5" />
</button>
<button
type="button"
class="p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
:title="t('admin.agent.test')"
@click.stop="openTestModal(agent)"
>
{{ t('admin.agent.test') }}
</button>
<button
type="button"
class="p-2 text-muted hover:text-red-600 hover:bg-red-50 rounded-lg transition-all"
:title="t('admin.agent.delete')"
@click.stop="deleteAgent(agent.id)"
>
<Trash2 class="w-5 h-5" />
</button>
<td class="px-4 py-5 text-right whitespace-nowrap">
<div class="inline-flex items-center justify-end gap-2">
<button
type="button"
class="inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg bg-blue-50 px-3 py-2 text-sm font-medium text-blue-600 transition-all hover:bg-blue-100"
:title="t('admin.edit')"
@click.stop="openEditDialog(agent)"
>
<SquarePen class="w-4 h-4 shrink-0" />
{{ t('admin.edit') }}
</button>
<button
type="button"
class="inline-flex shrink-0 items-center justify-center p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all"
:title="t('admin.agent.manageAccess')"
@click.stop="openPermissionModal(agent)"
>
<Users class="w-5 h-5 shrink-0" />
</button>
<button
type="button"
class="inline-flex shrink-0 items-center whitespace-nowrap p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
:title="t('admin.agent.test')"
@click.stop="openTestModal(agent)"
>
{{ t('admin.agent.test') }}
</button>
<button
type="button"
class="inline-flex shrink-0 items-center justify-center p-2 text-muted hover:text-red-600 hover:bg-red-50 rounded-lg transition-all"
:title="t('admin.agent.delete')"
@click.stop="deleteAgent(agent.id)"
>
<Trash2 class="w-5 h-5 shrink-0" />
</button>
</div>
</td>
</tr>
</tbody>