feat: add task management and progress reporting

- Implemented task and subtask structures with progress tracking.
- Added reporting functionality to log progress at various stages in hotel room status management scripts.
- Created a task store to manage tasks and their states, including persistence to local storage.
- Updated UI components to display task lists and handle task actions (retry, remove).
- Removed deprecated TaskCard and TaskList components, replacing them with a new structure for better maintainability.
- Enhanced script execution service to emit progress events for UI updates.
This commit is contained in:
DEV_DSW
2026-04-16 16:59:49 +08:00
parent b1f589a674
commit 210e8eb363
24 changed files with 788 additions and 237 deletions

9
global.d.ts vendored
View File

@@ -48,6 +48,11 @@ declare global {
return: void
}
// 任务事件
[IPC_EVENTS.TASK_PROGRESS]: { params: [payload: any]; return: void; }
[IPC_EVENTS.TASK_STARTED]: { params: [payload: any]; return: void; }
[IPC_EVENTS.TASK_COMPLETED]: { params: [payload: any]; return: void; }
// 主题事件
[IPC_EVENTS.THEME_MODE_UPDATED]: {
params: [isDark: boolean]
@@ -157,6 +162,10 @@ declare global {
},
// 执行脚本
executeScript: (options: any) => Promise<{success: boolean, error?: string}>,
// 任务事件
onTaskProgress: (cb: (payload: any) => void) => () => void;
onTaskStarted: (cb: (payload: any) => void) => () => void;
onTaskCompleted: (cb: (payload: any) => void) => () => void;
// 打开渠道
openChannel: (channels: any) => Promise<{success: boolean, error?: string}>,
// 脚本管理