refactor: 优化任务列表展示方式

This commit is contained in:
overtrue
2024-12-22 16:28:16 +08:00
parent 2eb4cc9d51
commit 0bbc1985b7
+12 -1
View File
@@ -21,7 +21,7 @@
</div>
<n-progress type="line" :height="2" :percentage="percentage" :show-indicator="false" :processing="percentage < 100" />
</div>
<n-tabs type="line" animated>
<n-tabs type="line" animated :value="tab">
<n-tab-pane :tab="`待处理(${pending.length})`" name="pending">
<object-upload-task-list :tasks="pending" />
</n-tab-pane>
@@ -56,6 +56,17 @@ const uploading = computed(() => tasks.value.filter(task => task.status === 'upl
const completed = computed(() => tasks.value.filter(task => task.status === 'completed'))
const failed = computed(() => tasks.value.filter(task => task.status === 'failed'))
const tab = ref('pending')
// 根据任务执行状态切换任务列表,如果有进行中的任务则默认展示进行中,否则展示已完成
watch([pending, uploading], () => {
if (uploading.value.length > 0) {
tab.value = 'uploading'
} else {
tab.value = 'completed'
}
})
const toggleDrawer = () => {
showDrawer.value = !showDrawer.value
}