总计: ${stats.total}
@@ -926,7 +930,7 @@ async function showBatchQueueDetail(queueId) {
batchQueuesState.currentQueueId = queueId;
if (title) {
- title.textContent = `批量任务队列 - ${queue.id}`;
+ title.textContent = '批量任务队列';
}
// 更新按钮显示
@@ -940,7 +944,8 @@ async function showBatchQueueDetail(queueId) {
cancelBtn.style.display = (queue.status === 'running' || queue.status === 'paused') ? 'inline-block' : 'none';
}
if (deleteBtn) {
- deleteBtn.style.display = (queue.status === 'completed' || queue.status === 'cancelled') ? 'inline-block' : 'none';
+ // 允许删除待执行、已完成或已取消状态的队列
+ deleteBtn.style.display = (queue.status === 'pending' || queue.status === 'completed' || queue.status === 'cancelled') ? 'inline-block' : 'none';
}
// 渲染任务列表
@@ -1059,7 +1064,7 @@ async function cancelBatchQueue() {
}
}
-// 删除批量任务队列
+// 删除批量任务队列(从详情模态框)
async function deleteBatchQueue() {
const queueId = batchQueuesState.currentQueueId;
if (!queueId) return;
@@ -1086,6 +1091,37 @@ async function deleteBatchQueue() {
}
}
+// 从列表删除批量任务队列
+async function deleteBatchQueueFromList(queueId) {
+ if (!queueId) return;
+
+ if (!confirm('确定要删除这个批量任务队列吗?此操作不可恢复。')) {
+ return;
+ }
+
+ try {
+ const response = await apiFetch(`/api/batch-tasks/${queueId}`, {
+ method: 'DELETE',
+ });
+
+ if (!response.ok) {
+ const result = await response.json().catch(() => ({}));
+ throw new Error(result.error || '删除批量任务队列失败');
+ }
+
+ // 如果当前正在查看这个队列的详情,关闭详情模态框
+ if (batchQueuesState.currentQueueId === queueId) {
+ closeBatchQueueDetailModal();
+ }
+
+ // 刷新队列列表
+ refreshBatchQueues();
+ } catch (error) {
+ console.error('删除批量任务队列失败:', error);
+ alert('删除批量任务队列失败: ' + error.message);
+ }
+}
+
// 关闭批量任务队列详情模态框
function closeBatchQueueDetailModal() {
const modal = document.getElementById('batch-queue-detail-modal');
@@ -1464,3 +1500,4 @@ window.showAddBatchTaskModal = showAddBatchTaskModal;
window.closeAddBatchTaskModal = closeAddBatchTaskModal;
window.saveAddBatchTask = saveAddBatchTask;
window.deleteBatchTaskFromElement = deleteBatchTaskFromElement;
+window.deleteBatchQueueFromList = deleteBatchQueueFromList;
diff --git a/web/templates/index.html b/web/templates/index.html
index 82d52eab..25fd4b31 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -1163,11 +1163,13 @@