es lint fix

This commit is contained in:
thofx
2023-07-22 16:09:07 +08:00
parent 48749b29fe
commit 018778488a
80 changed files with 3994 additions and 2981 deletions
+46 -25
View File
@@ -1,42 +1,45 @@
<script lang="ts" setup>
import { formatSeconds } from "@/@core/utils/formatters";
import api from "@/api";
import { Process } from "@/api/types";
import { formatSeconds } from '@/@core/utils/formatters'
import api from '@/api'
import type { Process } from '@/api/types'
// 表头
const headers = ["进程ID", "进程名称", "运行时间", "内存占用"];
const headers = ['进程ID', '进程名称', '运行时间', '内存占用']
// 数据列表
const processList = ref<Process[]>([]);
const processList = ref<Process[]>([])
// 定时器
let refreshTimer: NodeJS.Timer | null = null;
let refreshTimer: NodeJS.Timer | null = null
// 调用API加载数据
const loadProcessList = async () => {
async function loadProcessList() {
try {
const res: Process[] = await api.get("dashboard/processes");
processList.value = res;
} catch (e) {
console.log(e);
const res: Process[] = await api.get('dashboard/processes')
processList.value = res
}
};
catch (e) {
console.log(e)
}
}
onMounted(() => {
loadProcessList();
loadProcessList()
// 启动定时器
refreshTimer = setInterval(() => {
loadProcessList();
}, 5000);
});
loadProcessList()
}, 5000)
})
// 组件卸载时停止定时器
onUnmounted(() => {
if (refreshTimer) {
clearInterval(refreshTimer);
refreshTimer = null;
clearInterval(refreshTimer)
refreshTimer = null
}
});
})
</script>
<template>
@@ -51,20 +54,38 @@ onUnmounted(() => {
>
<thead>
<tr>
<th v-for="header in headers" :key="header" :id="header">
<th
v-for="header in headers"
:id="header"
:key="header"
>
{{ header }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in processList" :key="row.pid">
<td class="text-sm" v-text="row.pid" />
<tr
v-for="row in processList"
:key="row.pid"
>
<td
class="text-sm"
v-text="row.pid"
/>
<!-- name -->
<td>
<h6 class="text-sm font-weight-medium">{{ row.name }}</h6>
<h6 class="text-sm font-weight-medium">
{{ row.name }}
</h6>
</td>
<td class="text-sm" v-text="formatSeconds(row.run_time)" />
<td class="text-sm" v-text="`${row.memory} MB`" />
<td
class="text-sm"
v-text="formatSeconds(row.run_time)"
/>
<td
class="text-sm"
v-text="`${row.memory} MB`"
/>
</tr>
</tbody>
</VTable>