feat: 优化用户界面和交互提示

This commit is contained in:
jxxghp
2025-02-25 21:06:43 +08:00
parent 661919f27a
commit bab46964ff
2 changed files with 10 additions and 1 deletions

View File

@@ -639,7 +639,7 @@ onMounted(fetchData)
<div class="w-auto">
<VSelect v-model="itemsPerPage" :items="pageRange" density="compact" variant="solo" flat />
</div>
<div class="w-auto text-sm">{{ pageTip.begin }}-{{ pageTip.end }} / {{ totalItems }}</div>
<div class="w-auto text-sm">{{ pageTip.begin }} - {{ pageTip.end }} / {{ totalItems }}</div>
<VPagination
v-model="currentPage"
show-first-last-page

View File

@@ -17,6 +17,9 @@ const isRefreshed = ref(false)
// 过滤关键字
const filter = ref('')
// 加载中
const loading = ref(false)
// 新增对话框
const addDialog = ref(false)
@@ -91,6 +94,7 @@ async function handleDelete(item: Workflow) {
// 开始任务
async function handleEnable(item: Workflow) {
loading.value = true
try {
const result: { [key: string]: string } = await api.post(`workflow/${item.id}/start`)
if (result.success) {
@@ -102,10 +106,12 @@ async function handleEnable(item: Workflow) {
} catch (error) {
console.error(error)
}
loading.value = false
}
// 停用任务
async function handlePause(item: Workflow) {
loading.value = true
try {
const result: { [key: string]: string } = await api.post(`workflow/${item.id}/pause`)
if (result.success) {
@@ -117,10 +123,12 @@ async function handlePause(item: Workflow) {
} catch (error) {
console.error(error)
}
loading.value = false
}
// 立即执行任务
async function handleRun(item: Workflow) {
loading.value = true
try {
const result: { [key: string]: string } = await api.post(`workflow/${item.id}/run`)
if (result.success) {
@@ -132,6 +140,7 @@ async function handleRun(item: Workflow) {
} catch (error) {
console.error(error)
}
loading.value = false
}
// 计算状态颜色