This commit is contained in:
jxxghp
2023-07-10 19:18:38 +08:00
parent 48ddbaec2f
commit 1ea1af1f7e
2 changed files with 37 additions and 8 deletions

View File

@@ -481,3 +481,15 @@ export interface DownloaderInfo {
// 剩余空间
free_space:number
}
// 定时服务信息
export interface ScheduleInfo {
// ID
id: string
// 名称
name: string
// 状态
status: string
// 下次运行时间
next_run: string
}

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import api from "@/api";
import { ScheduleInfo } from "@/api/types";
const salesByCountries = [
{
abbr: "站",
@@ -36,6 +38,23 @@ const salesByCountries = [
color: "secondary",
},
];
// 定时服务列表
const schedulerList = ref<ScheduleInfo[]>([]);
// 调用API加载定时服务列表
const loadSchedulerList = async () => {
try {
const res: ScheduleInfo[] = await api.get("dashboard/schedule");
schedulerList.value = res;
} catch (e) {
console.log(e);
}
};
onMounted(() => {
loadSchedulerList();
});
</script>
<template>
@@ -46,25 +65,23 @@ const salesByCountries = [
<VCardText>
<VList class="card-list">
<VListItem v-for="data in salesByCountries" :key="data.country">
<VListItem v-for="item in schedulerList" :key="item.id">
<template #prepend>
<VAvatar size="40" variant="tonal" :color="data.color" class="me-3">
{{ data.abbr }}
<VAvatar size="40" variant="tonal" color="" class="me-3">
{{ item.name[0] }}
</VAvatar>
</template>
<VListItemTitle class="mb-1">
<span class="text-sm font-weight-medium">{{ data.amount }}</span>
<span class="text-sm font-weight-medium">{{ item.name }}</span>
</VListItemTitle>
<VListItemSubtitle class="text-xs">
{{ data.country }}
</VListItemSubtitle>
<VListItemSubtitle class="text-xs"> {{ item.next_run }}</VListItemSubtitle>
<template #append>
<div>
<h4 class="font-weight-medium">
{{ data.sales }}
{{ item.status }}
</h4>
</div>
</template>