From 9f849608db27d12d0570556a0b1384e093c4d120 Mon Sep 17 00:00:00 2001 From: AoXuan Date: Fri, 15 Aug 2025 01:24:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(scheduler):=20=E5=AE=9E=E7=8E=B0=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=E5=8F=B0=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增调度台标签页功能,支持多个调度台同时运行 - 优化任务执行界面布局,增加任务队列和用户队列显示 - 添加快速开始任务功能,可在当前调度台直接启动任务 - 实现任务完成后自动执行指定操作(如关机、睡眠等) - 优化任务日志显示样式,增加信息过滤和分类 - 调整任务控制按钮位置,提高操作便利性 --- frontend/electron/services/pythonService.ts | 6 +- frontend/src/views/Scheduler.vue | 811 ++++++++++++++------ 2 files changed, 598 insertions(+), 219 deletions(-) diff --git a/frontend/electron/services/pythonService.ts b/frontend/electron/services/pythonService.ts index 4591ba5..252fc89 100644 --- a/frontend/electron/services/pythonService.ts +++ b/frontend/electron/services/pythonService.ts @@ -463,7 +463,11 @@ export async function startBackend(appRoot: string): Promise<{ success: boolean; // 启动后端进程 const backendProcess = spawn(pythonPath, [mainPyPath], { cwd: appRoot, - stdio: 'pipe' + stdio: 'pipe', + env: { + ...process.env, + PYTHONIOENCODING: 'utf-8' // 设置Python输出编码为UTF-8 + } }) diff --git a/frontend/src/views/Scheduler.vue b/frontend/src/views/Scheduler.vue index 5d08b77..c7feac6 100644 --- a/frontend/src/views/Scheduler.vue +++ b/frontend/src/views/Scheduler.vue @@ -1,78 +1,225 @@ @@ -520,10 +872,37 @@ onUnmounted(() => { flex-direction: column; } +.scheduler-tabs { + flex: 1; + overflow: hidden; +} + .header-actions { display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + padding: 16px; + border-radius: 8px; + border: 1px solid var(--ant-color-border); +} + +.left-actions { + display: flex; + align-items: center; gap: 12px; - margin-bottom: 24px; +} + +.right-actions { + display: flex; + gap: 12px; + align-items: center; +} + +.completion-label { + font-size: 14px; + color: var(--ant-color-text); + white-space: nowrap; } .execution-area { @@ -543,33 +922,75 @@ onUnmounted(() => { overflow-y: auto; } -.task-output { +.task-detail-layout { + display: flex; + height: 400px; + gap: 1px; border: 1px solid var(--ant-color-border); border-radius: 6px; overflow: hidden; } -.output-header { +.realtime-logs-panel { + display: flex; + flex-direction: column; +} + +.panel-hea der { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; - background-color: var(--ant-color-fill-quaternary); border-bottom: 1px solid var(--ant-color-border); font-size: 12px; font-weight: 500; + color: var(--ant-color-text); } -.output-content { - height: 300px; +.panel-content { + flex: 1; overflow-y: auto; padding: 8px; - background-color: var(--ant-color-bg-container); +} + +.log-content { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-size: 12px; line-height: 1.4; } +.queue-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 6px 8px; + margin-bottom: 4px; + border-radius: 4px; + font-size: 12px; +} + +.queue-item-name { + flex: 1; + color: var(--ant-color-text); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.queue-item-status { + font-size: 11px; + padding: 2px 6px; + border-radius: 3px; + font-weight: 500; +} + +.empty-queue { + text-align: center; + color: var(--ant-color-text-tertiary); + font-size: 12px; + padding: 20px; +} + .log-line { display: flex; margin-bottom: 2px; @@ -602,50 +1023,4 @@ onUnmounted(() => { .log-error .log-message { color: var(--ant-color-error); } - -/* 已创建任务区域样式 */ -.created-task-section { - margin-bottom: 24px; -} - -.task-card { - border: 1px solid var(--ant-color-border); - border-radius: 8px; -} - -.task-info { - display: flex; - justify-content: space-between; - align-items: center; -} - -.task-details h4 { - margin: 0 0 8px 0; - font-size: 16px; - font-weight: 600; - color: var(--ant-color-text); -} - -.task-meta { - margin: 0; - font-size: 12px; - color: var(--ant-color-text-secondary); - display: flex; - gap: 16px; -} - -.task-meta span { - display: inline-block; -} - -/* 深色模式适配 */ -@media (prefers-color-scheme: dark) { - .output-content { - background-color: var(--ant-color-bg-elevated); - } - - .task-card { - background-color: var(--ant-color-bg-elevated); - } -} \ No newline at end of file