74 lines
3.0 KiB
Vue
74 lines
3.0 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted, ref } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { listWorkspaceScheduleRuns, workspaceRunExcelUrl, type ScheduleRun } from '../api/schedule';
|
|
|
|
const { t } = useI18n();
|
|
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 || t('scheduleRuns.msg.loadFailed');
|
|
} finally {
|
|
isLoading.value = false;
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
void loadRuns();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="admin-table-section mt-6 p-5">
|
|
<div class="mb-4 flex items-center justify-between">
|
|
<h3 class="section-title">{{ t('scheduleRuns.title') }}</h3>
|
|
<button type="button" class="btn-secondary btn-sm" @click="loadRuns">
|
|
{{ t('scheduleRuns.refresh') }}
|
|
</button>
|
|
</div>
|
|
<p class="section-desc mb-3">{{ t('scheduleRuns.tip') }}</p>
|
|
<div v-if="isLoading" class="py-6 text-sm text-muted">{{ t('scheduleRuns.loading') }}</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-muted">{{ t('scheduleRuns.empty') }}</div>
|
|
<div v-else class="admin-table-wrap">
|
|
<table class="admin-table min-w-[920px] text-sm">
|
|
<thead>
|
|
<tr>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.runNo') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.schedule') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.start') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.end') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.status') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.total') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.success') }}</th>
|
|
<th class="px-2 py-2">{{ t('scheduleRuns.columns.failed') }}</th>
|
|
<th class="px-2 py-2">Excel</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="run in runs" :key="run.id">
|
|
<td class="px-2 py-2 text-secondary">{{ run.run_no }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.schedule_name || '-' }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.started_at || '-' }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.finished_at || '-' }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.status }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.total_count }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.success_count }}</td>
|
|
<td class="px-2 py-2 text-secondary">{{ run.failed_count }}</td>
|
|
<td class="px-2 py-2">
|
|
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</template>
|