refactor(install): 重构下载安装队列逻辑,拆分并发控制

1.  将下载与安装流程分离,实现并发下载限制与单安装实例控制
2.  新增任务阶段枚举,替换原有activeDownloads计数逻辑
3.  优化取消任务的处理流程,区分运行中和排队中的任务
4.  修复下载队列显示的统计错误,改为展示已完成任务数
5.  调整日志格式与代码注释,提升可读性
This commit is contained in:
2026-07-13 23:06:05 +08:00
parent 6328f178d3
commit b233fea4d5
2 changed files with 149 additions and 86 deletions
+3 -5
View File
@@ -15,7 +15,7 @@
v-if="downloads.length"
class="rounded-full bg-slate-100 px-2 py-0.5 text-xs font-medium text-slate-500 dark:bg-slate-800/70 dark:text-slate-300"
>
({{ activeDownloads }}/{{ downloads.length }})
({{ completedDownloads }}/{{ downloads.length }})
</span>
</div>
<div class="flex items-center gap-2">
@@ -148,10 +148,8 @@ const emit = defineEmits<{
const isExpanded = ref(false);
const activeDownloads = computed(() => {
return props.downloads.filter(
(d) => d.status === "downloading" || d.status === "installing",
).length;
const completedDownloads = computed(() => {
return props.downloads.filter((d) => d.status === "completed").length;
});
const toggleExpand = () => {