排程管理及排程记录查看功能
This commit is contained in:
1 parent
3b31867319
commit
08776feef2
28 files changed
+3040
-8
No files matched your search
@@ -0,0 +1,71 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { listWorkspaceScheduleRuns, workspaceRunExcelUrl, type ScheduleRun } from '../api/schedule';
|
||||
|
||||
const isLoading = ref(false);
|
||||
const error = ref('');
|
||||
const runs = ref<ScheduleRun[]>([]);
|
||||
|
||||
const loadRuns = async () => {
|
||||
isLoading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
runs.value = await listWorkspaceScheduleRuns();
|
||||
} catch (e: any) {
|
||||
error.value = e?.message || '加载排程记录失败';
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
void loadRuns();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900">排程记录</h3>
|
||||
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50" @click="loadRuns">
|
||||
刷新
|
||||
</button>
|
||||
</div>
|
||||
<p class="mb-3 text-xs text-slate-500">仅展示你是 owner 或在通知名单中的记录</p>
|
||||
<div v-if="isLoading" class="py-6 text-sm text-slate-500">加载中...</div>
|
||||
<div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div>
|
||||
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">暂无可见记录</div>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<table class="w-full min-w-[920px] text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-slate-200 text-left text-slate-500">
|
||||
<th class="px-2 py-2">执行单号</th>
|
||||
<th class="px-2 py-2">排程</th>
|
||||
<th class="px-2 py-2">开始</th>
|
||||
<th class="px-2 py-2">结束</th>
|
||||
<th class="px-2 py-2">状态</th>
|
||||
<th class="px-2 py-2">处理</th>
|
||||
<th class="px-2 py-2">成功</th>
|
||||
<th class="px-2 py-2">失败</th>
|
||||
<th class="px-2 py-2">Excel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="run in runs" :key="run.id" class="border-b border-slate-100 text-slate-700">
|
||||
<td class="px-2 py-2">{{ run.run_no }}</td>
|
||||
<td class="px-2 py-2">{{ run.schedule_name || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.started_at || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.finished_at || '-' }}</td>
|
||||
<td class="px-2 py-2">{{ run.status }}</td>
|
||||
<td class="px-2 py-2">{{ run.total_count }}</td>
|
||||
<td class="px-2 py-2">{{ run.success_count }}</td>
|
||||
<td class="px-2 py-2">{{ run.failed_count }}</td>
|
||||
<td class="px-2 py-2">
|
||||
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">查看Excel</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user