feat:仪表盘不活跃时不刷新 && 网盘整理联动刮削

This commit is contained in:
jxxghp
2024-06-24 09:13:22 +08:00
parent 8efeb77102
commit 6fad85e957
8 changed files with 71 additions and 7 deletions

View File

@@ -4,6 +4,15 @@ import { useTheme } from 'vuetify'
import { hexToRgb } from '@layouts/utils'
import api from '@/api'
// 输入参数
const props = defineProps({
// 是否允许刷新数据
allowRefresh: {
type: Boolean,
default: true,
},
})
const vuetifyTheme = useTheme()
const currentTheme = controlledComputed(
@@ -94,6 +103,7 @@ const chartOptions = controlledComputed(
// 调用API接口获取最新CPU使用率
async function getCpuUsage() {
if (!props.allowRefresh) return
try {
// 请求数据
current.value = (await api.get('dashboard/cpu')) ?? 0

View File

@@ -5,6 +5,15 @@ import { hexToRgb } from '@layouts/utils'
import api from '@/api'
import { formatBytes } from '@/@core/utils/formatters'
// 输入参数
const props = defineProps({
// 是否允许刷新数据
allowRefresh: {
type: Boolean,
default: true,
},
})
const vuetifyTheme = useTheme()
const currentTheme = controlledComputed(
@@ -100,6 +109,7 @@ const chartOptions = controlledComputed(
// 调用API接口获取最新内存使用量
async function getMemorgUsage() {
if (!props.allowRefresh) return
try {
// 请求数据
;[usedMemory.value, memoryUsage.value] = await api.get('dashboard/memory')

View File

@@ -2,6 +2,15 @@
import api from '@/api'
import type { ScheduleInfo } from '@/api/types'
// 输入参数
const props = defineProps({
// 是否允许刷新数据
allowRefresh: {
type: Boolean,
default: true,
},
})
// 定时服务列表
const schedulerList = ref<ScheduleInfo[]>([])
@@ -10,6 +19,9 @@ let refreshTimer: NodeJS.Timeout | null = null
// 调用API加载定时服务列表
async function loadSchedulerList() {
if (!props.allowRefresh) {
return
}
try {
const res: ScheduleInfo[] = await api.get('dashboard/schedule')

View File

@@ -3,6 +3,15 @@ import { formatFileSize } from '@/@core/utils/formatters'
import api from '@/api'
import type { DownloaderInfo } from '@/api/types'
// 输入参数
const props = defineProps({
// 是否允许刷新数据
allowRefresh: {
type: Boolean,
default: true,
},
})
// 定时器
let refreshTimer: NodeJS.Timeout | null = null
@@ -35,6 +44,10 @@ const infoItems = ref([
// 调用API查询下载器数据
async function loadDownloaderInfo() {
if (!props.allowRefresh) {
return
}
try {
const res: DownloaderInfo = await api.get('dashboard/downloader')