feat(electron-shell): 1.8.0 执行队列、流程编排、流程定时与版本回滚

- 执行队列:多任务串行排队,可单独取消,超时自动放弃,异常退出后标记已中断

- 流程编排:画布多场景依赖图,内置确保登录/等待/通知/人工确认节点

- 流程定时:场景与流程统一配置定时(每天/工作日/每周/每月/每隔N小时)

- 流程版本历史:自动留档 20 版,画布一键回滚且回滚可撤销

- 流程配置云备份:随定时任务备份到中心机,换机自动恢复

- 总览页/场景库布局调整,通知浮窗右下角堆叠显示
This commit is contained in:
2026-10-27 13:36:38 +08:00
parent 843ff244a6
commit 4b84f9c149
25 changed files with 3980 additions and 475 deletions
@@ -0,0 +1,51 @@
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { syncPlugins, fetchMeta } from '../api'
import { store, log } from '../store'
// 插件同步:全站只有一个入口逻辑(左栏图标 / 场景库页 / 登录后自动同步共用)。
// 模块级 syncing 保证并发调用只有一次真正执行,按钮 loading 也天然一致。
const syncing = ref(false)
export function usePluginSync() {
// 拉取账号可见清单(平台在线态 / 授权 / 场景列表)
async function refreshMeta() {
const meta = await fetchMeta()
store.platforms = meta.platforms || []
store.plugins = meta.plugins || []
store.authExpired = !!meta.authExpired
store.license = meta.license || null
// 选中场景不存在(被同步清理/授权收回)时回落到第一个可用场景
if (!store.plugins.find((p) => p.id === store.selectedId)) {
store.selectedId = store.plugins[0]?.id || ''
}
}
async function syncNow() {
if (syncing.value || store.running) return
syncing.value = true
try {
const r = await syncPlugins()
const parts = []
if (r.downloaded?.length) parts.push(`新装 ${r.downloaded.length} 个`)
if (r.updated?.length) parts.push(`更新 ${r.updated.length} 个`)
if (r.removed?.length) parts.push(`清理 ${r.removed.length} 个`)
if (r.failed?.length) parts.push(`失败 ${r.failed.length} 个`)
if (parts.length) {
ElMessage.success('插件同步完成:' + parts.join(','))
const detail = [...(r.downloaded || []), ...(r.updated || []), ...(r.removed || [])].join('、')
if (detail) log('INFO', `插件同步完成:${parts.join(',')}(${detail})`)
} else {
ElMessage.info('插件已是最新')
}
if (r.failed?.length) log('ERROR', `插件同步失败:${r.failed.join('、')}`)
} catch (e) {
ElMessage.error('插件同步失败:' + (e.message || e))
} finally {
try { await refreshMeta() } catch (_) { /* 后端不可达:保留现有清单 */ }
syncing.value = false
}
}
return { syncing, syncNow, refreshMeta }
}
@@ -9,7 +9,7 @@ export const SHOW_SEARCH_MIN = 8 // 插件数超过该值才显示搜索框
const AUTO_COLLAPSE_MIN = 12 // 超过该值才默认折叠「非当前选中」的分组
export const RECENT_KEY = '__recent__'
const CAT_FALLBACK = '其他'
const RECENT_MAX = 5 // 「最近使用」置顶条数
const RECENT_MAX = 10 // 左栏「最近使用」条数(足够的常用入口,又不至于变成第二个场景库)
export function useSceneLibrary() {
const sceneQuery = ref('')
@@ -81,7 +81,8 @@ export function useSceneLibrary() {
async function loadRecentScenes() {
if (!store.current) return
try {
const r = await fetchRuns(10)
// 取多一些:同一场景连续跑几次时,去重后仍能凑够 RECENT_MAX 个不同场景
const r = await fetchRuns(30)
recentRuns.value = r.runs || []
} catch (_) { /* 后端未就绪:静默,下次刷新再补 */ }
}