重构: tool_registry拆分及多批改进

This commit is contained in:
2026-06-19 00:10:14 +08:00
parent a2871a66e0
commit 60b01d03ee
33 changed files with 703 additions and 247 deletions

View File

@@ -33,7 +33,7 @@
</div>
<div class="modal-actions">
<button class="btn btn-ghost" @click="showNewTaskModal = false">{{ $t('common.cancel') }}</button>
<button class="btn btn-primary" @click="submitNewTask" :disabled="!newTaskTitle.trim()">{{ $t('projectDetail.confirmCreate') }}</button>
<button class="btn btn-primary" @click="submitNewTask" :disabled="submitting || !newTaskTitle.trim()">{{ $t('projectDetail.confirmCreate') }}</button>
</div>
</div>
</div>
@@ -208,6 +208,7 @@
:key="idx"
class="btn"
:class="idx === 0 ? 'btn-primary' : 'btn-ghost'"
:disabled="submitting"
@click="handleApproval(option)"
>
{{ option }}
@@ -319,19 +320,27 @@ const newTaskTitle = ref('')
const newTaskDesc = ref('')
const newTaskBranch = ref('')
// 异步操作禁用态(IPC 期间防双击重复提交):submitNewTask 创建任务期间禁用确认按钮
const submitting = ref(false)
async function submitNewTask() {
if (!newTaskTitle.value.trim()) return
const r = await store.createTask({
project_id: projectId.value,
title: newTaskTitle.value.trim(),
description: newTaskDesc.value.trim(),
branch_name: newTaskBranch.value.trim() || undefined,
})
if (!r) return // 失败已 toast,保持弹窗不关
showNewTaskModal.value = false
newTaskTitle.value = ''
newTaskDesc.value = ''
newTaskBranch.value = ''
submitting.value = true
try {
const r = await store.createTask({
project_id: projectId.value,
title: newTaskTitle.value.trim(),
description: newTaskDesc.value.trim(),
branch_name: newTaskBranch.value.trim() || undefined,
})
if (!r) return // 失败已 toast,保持弹窗不关
showNewTaskModal.value = false
newTaskTitle.value = ''
newTaskDesc.value = ''
newTaskBranch.value = ''
} finally {
submitting.value = false
}
}
// ── 同步 ──
@@ -406,8 +415,13 @@ async function handleImportDir() {
// ── 审批处理 ──
async function handleApproval(decision: string) {
await store.approveHumanApproval([decision])
showApprovalDialog.value = false
submitting.value = true
try {
await store.approveHumanApproval([decision])
showApprovalDialog.value = false
} finally {
submitting.value = false
}
}
// F-260615-01: 多选审批