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
+12
View File
@@ -481,3 +481,15 @@ export interface DownloaderInfo {
// 剩余空间 // 剩余空间
free_space:number free_space:number
} }
// 定时服务信息
export interface ScheduleInfo {
// ID
id: string
// 名称
name: string
// 状态
status: string
// 下次运行时间
next_run: string
}
+25 -8
View File
@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import api from "@/api";
import { ScheduleInfo } from "@/api/types";
const salesByCountries = [ const salesByCountries = [
{ {
abbr: "站", abbr: "站",
@@ -36,6 +38,23 @@ const salesByCountries = [
color: "secondary", 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> </script>
<template> <template>
@@ -46,25 +65,23 @@ const salesByCountries = [
<VCardText> <VCardText>
<VList class="card-list"> <VList class="card-list">
<VListItem v-for="data in salesByCountries" :key="data.country"> <VListItem v-for="item in schedulerList" :key="item.id">
<template #prepend> <template #prepend>
<VAvatar size="40" variant="tonal" :color="data.color" class="me-3"> <VAvatar size="40" variant="tonal" color="" class="me-3">
{{ data.abbr }} {{ item.name[0] }}
</VAvatar> </VAvatar>
</template> </template>
<VListItemTitle class="mb-1"> <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> </VListItemTitle>
<VListItemSubtitle class="text-xs"> <VListItemSubtitle class="text-xs"> {{ item.next_run }}</VListItemSubtitle>
{{ data.country }}
</VListItemSubtitle>
<template #append> <template #append>
<div> <div>
<h4 class="font-weight-medium"> <h4 class="font-weight-medium">
{{ data.sales }} {{ item.status }}
</h4> </h4>
</div> </div>
</template> </template>