feat(file-check): 新增历史检核报告检索功能及相关 API

This commit is contained in:
hugo committed 2026-06-16 13:32:00 +08:00
1 parent 29a7704d46
commit f6fe56f205
16 files changed
+1060 -163

No files matched your search

@@ -66,21 +66,17 @@ const admin = useSchedulesAdminContext();
>
<button class="w-full text-left" @click="admin.openScheduleRunSubmenu(s.id)">
<div class="min-h-[96px]">
<div class="flex items-center justify-between gap-3">
<div class="truncate text-base font-semibold text-primary">{{ s.name }}</div>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<div class="truncate text-base font-semibold text-primary">{{ s.name }}</div>
<div class="mt-0.5 truncate text-xs text-muted" :title="s.schedule_no">{{ s.schedule_no }}</div>
</div>
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold"
:class="s.enabled ? 'bg-emerald-100 text-emerald-700' : 'bg-surface-strong text-secondary'">
{{ s.enabled ? $t('admin.schedule.enabled') : $t('admin.schedule.disabled') }}
</span>
</div>
<div class="mt-2 text-sm text-muted">{{ $t('admin.schedule.scheduleNo') }}:{{ s.schedule_no }}</div>
<div class="mt-1 text-sm text-muted">Cron:{{ s.cron_expr }}</div>
<div
v-if="s.schedule_type === 'platform_app' && s.platform_api_path"
class="mt-1 text-sm text-muted"
>
{{ $t('admin.schedule.config') }}:{{ s.platform_api_path }}
</div>
<div class="mt-2 text-sm text-muted">Cron:{{ s.cron_expr }}</div>
<div class="mt-1 text-sm text-muted">{{ $t('admin.schedule.owner') }}:{{ s.owner_username || s.owner_user_id }}</div>
</div>
</button>
@@ -123,7 +119,7 @@ const admin = useSchedulesAdminContext();
{{ $t('admin.schedule.actions.run') }}
</button>
<button
v-if="s.platform_api_path && s.data_source_type !== 'external_api'"
v-if="s.data_source_type !== 'external_api'"
class="inline-flex items-center gap-1 rounded-xl border border-violet-200 px-3 py-2 text-xs font-medium text-violet-700 transition-colors hover:bg-violet-50"
@click.stop="admin.openTestRunDialog(s)"
>
@@ -89,7 +89,7 @@ const admin = useSchedulesAdminContext();
<Rocket class="h-3 w-3" />
</button>
<button
v-if="s.platform_api_path && s.data_source_type !== 'external_api'"
v-if="s.data_source_type !== 'external_api'"
class="inline-flex items-center justify-center rounded-xl border border-violet-200 p-1.5 text-xs font-medium text-violet-700 transition-colors hover:bg-violet-50"
:title="$t('admin.schedule.actions.test')"
@click.stop="admin.openTestRunDialog(s)"
@@ -148,12 +148,19 @@ const admin = useSchedulesAdminContext();
</button>
</div>
<div class="admin-table-wrap max-h-[calc(100vh-20rem)] rounded-xl border border-subtle scrollbar-thin">
<table class="admin-table min-w-[1270px] table-fixed text-xs">
<table
class="admin-table table-fixed text-xs"
:style="{ minWidth: `${admin.scheduleRunColumnDefs.reduce((sum, col) => sum + col.width, 0)}px` }"
>
<colgroup>
<col
v-for="col in admin.scheduleRunColumnDefs"
:key="col.key"
:style="{ width: `${col.width}px` }"
:style="{
width: `${col.width}px`,
minWidth: `${col.width}px`,
maxWidth: `${col.width}px`,
}"
/>
</colgroup>
<thead class="sticky top-0 z-10 admin-table-sticky-head">
@@ -161,9 +168,9 @@ const admin = useSchedulesAdminContext();
<th
v-for="(col, colIndex) in admin.scheduleRunColumnDefs"
:key="col.key"
class="group relative whitespace-nowrap admin-table-sticky-head px-4 py-3 text-xs font-semibold uppercase select-none"
class="group relative max-w-0 overflow-hidden admin-table-sticky-head px-4 py-3 text-xs font-semibold uppercase select-none"
>
<span class="whitespace-nowrap">{{ col.label }}</span>
<span class="block truncate pr-2" :title="col.label">{{ col.label }}</span>
<span
class="absolute inset-y-0 -right-1 z-10 w-2 cursor-col-resize"
@mousedown.prevent="admin.startScheduleColResize(colIndex, $event)"
@@ -185,29 +192,31 @@ const admin = useSchedulesAdminContext();
:key="r.id"
class="text-secondary transition"
>
<td class="whitespace-nowrap px-4 py-2.5" :title="r.run_no">{{ r.run_no }}</td>
<td class="whitespace-nowrap px-4 py-2.5" :title="admin.formatDateTime(r.started_at)">{{ admin.formatDateTime(r.started_at) }}</td>
<td class="whitespace-nowrap px-4 py-2.5" :title="admin.formatDateTime(r.finished_at)">{{ admin.formatDateTime(r.finished_at) }}</td>
<td class="whitespace-nowrap px-4 py-2.5">
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold"
:class="admin.getScheduleRunStatusBadge(r.status).cls">
{{ admin.getScheduleRunStatusBadge(r.status).label }}
</span>
<span v-if="r.error_message" class="ml-1 text-xs text-muted" :title="r.error_message">...</span>
<td class="max-w-0 truncate px-4 py-2.5" :title="r.run_no">{{ r.run_no }}</td>
<td class="max-w-0 truncate px-4 py-2.5" :title="admin.formatDateTime(r.started_at)">{{ admin.formatDateTime(r.started_at) }}</td>
<td class="max-w-0 truncate px-4 py-2.5" :title="admin.formatDateTime(r.finished_at)">{{ admin.formatDateTime(r.finished_at) }}</td>
<td class="max-w-0 overflow-hidden px-4 py-2.5">
<div class="flex min-w-0 items-center gap-1 overflow-hidden">
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold"
:class="admin.getScheduleRunStatusBadge(r.status).cls">
{{ admin.getScheduleRunStatusBadge(r.status).label }}
</span>
<span v-if="r.error_message" class="min-w-0 truncate text-xs text-muted" :title="r.error_message">...</span>
</div>
</td>
<td class="whitespace-nowrap px-4 py-2.5">{{ r.total_count }}</td>
<td class="whitespace-nowrap px-4 py-2.5">{{ r.success_count }}</td>
<td class="whitespace-nowrap px-4 py-2.5">{{ r.failed_count }}</td>
<td class="whitespace-nowrap px-4 py-2.5">
<span v-if="r.wecom_notified" class="inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-xs text-emerald-600">
<td class="max-w-0 truncate px-4 py-2.5">{{ r.total_count }}</td>
<td class="max-w-0 truncate px-4 py-2.5">{{ r.success_count }}</td>
<td class="max-w-0 truncate px-4 py-2.5">{{ r.failed_count }}</td>
<td class="max-w-0 overflow-hidden px-4 py-2.5">
<span v-if="r.wecom_notified" class="inline-flex max-w-full shrink-0 items-center gap-1 truncate text-xs text-emerald-600" :title="$t('admin.schedule.notified')">
<svg class="h-3.5 w-3.5 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
{{ $t('admin.schedule.notified') }}
</span>
<span v-else-if="r.wecom_notify_error" class="whitespace-nowrap text-xs text-amber-500" :title="r.wecom_notify_error">{{ $t('admin.schedule.notifyError') }}</span>
<span v-else-if="r.wecom_notify_error" class="block truncate text-xs text-amber-500" :title="r.wecom_notify_error">{{ $t('admin.schedule.notifyError') }}</span>
<span v-else class="text-xs text-muted">-</span>
</td>
<td class="whitespace-nowrap px-4 py-2.5">
<div class="flex items-center">
<td class="max-w-0 overflow-hidden px-4 py-2.5">
<div class="flex min-w-0 items-center overflow-hidden">
<a
v-if="r.total_count > 0"
href="#"
@@ -220,8 +229,8 @@ const admin = useSchedulesAdminContext();
<span v-if="r.total_count === 0" class="text-muted">-</span>
</div>
</td>
<td class="whitespace-nowrap px-4 py-2.5">
<div class="flex items-center">
<td class="max-w-0 overflow-hidden px-4 py-2.5">
<div class="flex min-w-0 items-center overflow-hidden">
<button
v-if="(r.step_logs && r.step_logs.length > 0) || r.dify_execution_snapshot || r.kb_sync_status"
@click="admin.expandedScheduleRunId = admin.expandedScheduleRunId === r.id ? null : r.id"
@@ -240,8 +249,8 @@ const admin = useSchedulesAdminContext();
v-if="admin.expandedScheduleRun"
:key="'expanded-' + admin.expandedScheduleRunId"
>
<td colspan="10" class="px-4 py-3 bg-surface-soft/60">
<div class="space-y-3">
<td colspan="10" class="w-full max-w-none px-4 py-3 bg-surface-soft/60">
<div class="min-w-0 w-full max-w-full space-y-3">
<div
v-if="admin.expandedScheduleRun.kb_sync_status"
class="rounded-xl border border-emerald-200 bg-emerald-50/50 p-3 text-xs text-secondary"
@@ -263,14 +272,17 @@ const admin = useSchedulesAdminContext();
v-if="admin.expandedScheduleRun.dify_execution_snapshot"
class="rounded-xl border border-indigo-200 bg-indigo-50/50 p-3"
>
<div class="mb-2 flex items-center justify-between">
<h5 class="text-xs font-bold uppercase text-indigo-800">{{ $t('admin.schedule.difySnapshot.title') }}</h5>
<span class="text-[10px] text-indigo-600/80">
{{ admin.expandedScheduleRun.dify_execution_snapshot.captured_at || '-' }}
</span>
<div class="mb-2 flex flex-wrap items-start justify-between gap-x-4 gap-y-1">
<h5 class="min-w-0 text-xs font-bold uppercase text-indigo-800">{{ $t('admin.schedule.difySnapshot.title') }}</h5>
<time
class="shrink-0 whitespace-nowrap text-[10px] text-indigo-600/80"
:title="admin.expandedScheduleRun.dify_execution_snapshot.captured_at || '-'"
>
{{ admin.formatDateTime(admin.expandedScheduleRun.dify_execution_snapshot.captured_at) }}
</time>
</div>
<div v-if="admin.expandedScheduleRun.dify_execution_snapshot.dify_enabled" class="space-y-2 text-xs text-secondary">
<div>
<div class="break-words">
<span class="font-semibold text-muted">{{ $t('admin.schedule.difySnapshot.agent') }}:</span>
{{ admin.expandedScheduleRun.dify_execution_snapshot.dify_agent_name || '-' }}
<span class="text-muted">{{ $t('admin.schedule.difySnapshot.agentId', { id: admin.expandedScheduleRun.dify_execution_snapshot.dify_agent_id ?? '-' }) }}</span>
@@ -59,9 +59,9 @@ export function createScheduleAdminState() {
const scheduleRunStartedAfter = ref('');
const scheduleRunStartedBefore = ref('');
const scheduleRunColumnDefs = ref([
{ key: 'run_no', label: '', width: 280, min: 60 },
{ key: 'started_at', label: '', width: 190, min: 60 },
{ key: 'finished_at', label: '', width: 190, min: 60 },
{ key: 'run_no', label: '', width: 280, min: 120 },
{ key: 'started_at', label: '', width: 200, min: 148 },
{ key: 'finished_at', label: '', width: 200, min: 148 },
{ key: 'status', label: '', width: 130, min: 50 },
{ key: 'total_count', label: '', width: 70, min: 40 },
{ key: 'success_count', label: '', width: 70, min: 40 },
@@ -114,7 +114,6 @@ export function useScheduleAdminForm(
scheduleEditingId.value = task.id;
scheduleCreateForm.value = {
name: task.name || '',
platform_api_path: task.platform_api_path || '',
dify_agent_id: task.dify_agent_id || null,
owner_user_id: task.owner_user_id || null,
wait_seconds: task.wait_seconds || 0,
@@ -23,7 +23,6 @@ export interface ScheduleCronDesigner {
/** 创建/编辑定时任务主表单 */
export interface ScheduleCreateForm {
name: string;
platform_api_path: string;
data_source_type: 'database' | 'external_api';
dify_agent_id: number | null;
owner_user_id: number | null;
@@ -87,7 +86,6 @@ export function createDefaultCronDesigner(): ScheduleCronDesigner {
export function createDefaultScheduleCreateForm(): ScheduleCreateForm {
return {
name: '',
platform_api_path: '',
data_source_type: 'database',
dify_agent_id: null,
owner_user_id: null,