feat: 新增多插件 UI 支持及运行日志集中回传功能

本次提交包含多项功能更新:
1. 为多个插件(xq0002/0003/0004/0008/0010/0011/0020/0031_xq0032/0033/0035/0037/0045_xq0046/0047/0048)新增 UI 界面及配置支持
2. 新增运行日志集中回传功能,客户端自动上传运行日志到中心机集中存储
3. 新增插件分类字段支持,用于场景库分组管理
4. 优化 xq0034/0037/0048 等插件的功能及描述
5. 修复控制面响应兼容问题,支持新旧版本数据格式
6. 新增 xq0033 插件的状态存储模块,用于历史记录管理
7. 优化 CRM 登录窗口模式,支持全屏置顶
This commit is contained in:
2026-10-26 15:42:50 +08:00
parent 9fd687ada8
commit 843ff244a6
453 changed files with 243002 additions and 4493 deletions
@@ -1,38 +1,21 @@
<template>
<div v-if="plugin" class="plugin-page">
<!-- Hero:场景身份 + 运行状态(执行入口收口在插件界面内,壳子不再提供一键执行) -->
<section class="hero card">
<div class="hero-main">
<span class="avatar" :style="{ background: avatarBg }">{{ plugin.name.slice(0, 1) }}</span>
<div class="hero-meta">
<h2 class="p-name">{{ plugin.name }}
<span class="ver-tag">v{{ plugin.version }}</span>
</h2>
<p class="p-desc">{{ plugin.description || '暂无描述' }}</p>
<div class="p-badges">
<span v-if="plugin.platform" class="badge" :class="platformOnline ? 'on' : 'off'">
<i class="bdot"></i>{{ platformLabel }} {{ platformOnline ? '已登录' : '未登录' }}
</span>
</div>
</div>
</div>
<div class="hero-actions">
<div v-if="store.running" class="run-chip">
<span class="ring">
<svg viewBox="0 0 36 36" width="22" height="22">
<circle class="ring-bg" cx="18" cy="18" r="15.5" fill="none" stroke-width="3.5" />
<circle class="ring-fg" cx="18" cy="18" r="15.5" fill="none" stroke-width="3.5"
stroke-linecap="round" :stroke-dasharray="ringDash" transform="rotate(-90 18 18)" />
</svg>
</span>
<span>执行中 {{ store.progress }}%</span>
</div>
<el-button v-if="rollbackVer" size="small" text type="warning" class="rollback-btn"
:disabled="store.running" @click="doRollback">回滚 v{{ rollbackVer }}</el-button>
<span class="hero-tip">在插件界面内配置并执行,运行日志与历史见下方</span>
</div>
</section>
<!-- 页头:场景身份 + 平台状态 + 运行中/回滚入口(与其它一级视图共用 PageHead) -->
<PageHead eyebrow="CONSOLE · 运行台">
<template #title>
<span class="p-name">{{ plugin.name }}<span class="ver-tag">v{{ plugin.version }}</span></span>
</template>
<template #sub>{{ plugin.description || '暂无描述' }}</template>
<template #actions>
<span v-if="plugin.platform" class="badge" :class="platformOnline ? 'on' : 'off'">
<i class="bdot"></i>{{ platformLabel }} {{ platformOnline ? '已登录' : '未登录' }}
</span>
<RunIndicator v-if="store.running" variant="chip" :progress="store.progress" />
<button v-if="rollbackVer" class="btn rollback-btn" :disabled="store.running" @click="doRollback">
回滚 v{{ rollbackVer }}
</button>
</template>
</PageHead>
<!-- 结果横幅 -->
<section v-if="store.lastResult" class="banner" :class="store.lastResult.ok ? 'ok' : 'err'">
@@ -52,7 +35,7 @@
<button v-for="t in tabs" :key="t.k" class="rt-tab" :class="{ on: tab === t.k }" @click="tab = t.k">
{{ t.label }}
<span v-if="t.k === 'log' && store.logs.length" class="rt-n">{{ store.logs.length }}</span>
<i v-if="t.k === 'log' && store.running" class="rt-live"></i>
<RunIndicator v-if="t.k === 'log' && store.running" variant="dot" />
</button>
</div>
</div>
@@ -73,7 +56,10 @@
<section v-show="tab === 'history'" class="history">
<div v-if="!replay" class="hist-view">
<div class="hist-head">
<span class="hist-title">本场景最近运行</span>
<div class="hist-titles">
<span class="sec-eyebrow">HISTORY</span>
<span class="hist-title">本场景最近运行</span>
</div>
<el-button size="small" text :icon="Refresh" :loading="loadingRuns" @click="loadRuns">刷新</el-button>
</div>
<div v-if="!runs.length" class="hist-empty">
@@ -111,7 +97,7 @@
</div>
<div v-else-if="!store.plugins.length" class="empty-note">
<b>当前账号暂无可用场景</b><br>请联系管理员在控制面进行授权,授权后点击右上角刷新
<b>当前账号暂无可用场景</b><br>请联系管理员在控制面进行授权,授权后点左栏「插件同步」刷新
</div>
<div v-else class="empty-note"><b>未选择场景</b></div>
</template>
@@ -123,14 +109,9 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { store } from '../store'
import { getRun, fetchRuns, fetchMeta, listRollbacks, rollbackPlugin } from '../api'
import LogPanel from './LogPanel.vue'
const GRADS = [
'var(--grad-sky)', 'var(--grad-peach)', 'var(--grad-mint)',
'var(--grad-lilac)', 'var(--grad-honey)', 'var(--grad-blush)',
]
const idx = computed(() => Math.max(0, store.plugins.findIndex((p) => p.id === store.selectedId)))
const avatarBg = computed(() => GRADS[idx.value % GRADS.length])
import RunIndicator from './RunIndicator.vue'
import PageHead from './PageHead.vue'
import { durText, fmtTime } from '../utils/format'
const plugin = computed(() => store.plugins.find((p) => p.id === store.selectedId) || null)
@@ -217,23 +198,6 @@ watch(
function triggerLabel(t) {
return ({ manual: '手动执行', schedule: '定时任务' })[t] || t || '手动执行'
}
function durText(s) {
const n = parseInt(s, 10) || 0
if (n < 60) return n + 's'
const m = Math.floor(n / 60)
return m + '分' + (n % 60 ? (n % 60) + 's' : '')
}
function fmtTime(ts) {
if (!ts) return '—'
const d = new Date(ts * 1000)
if (isNaN(d.getTime())) return '—'
const p = (n) => String(n).padStart(2, '0')
return `${d.getMonth() + 1}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
}
// 执行进度环(SVG stroke-dasharray)
const RING_C = 2 * Math.PI * 15.5
const ringDash = computed(() => `${(store.progress / 100) * RING_C} ${RING_C}`)
const platformLabel = computed(() => {
const p = store.platforms.find((x) => x.id === plugin.value?.platform)
@@ -261,7 +225,7 @@ async function doRollback() {
try {
await ElMessageBox.confirm(
`将「${plugin.value.name}」回滚到 v${rollbackVer.value}(当前 v${plugin.value.version})。` +
'回滚后如需最新版,再次点击右上角同步即可。确定回滚?',
'回滚后如需最新版,再次点左栏「插件同步」即可。确定回滚?',
'插件回滚',
{ type: 'warning', confirmButtonText: '回滚', cancelButtonText: '取消' }
)
@@ -300,92 +264,53 @@ function closeBanner() {
.plugin-page {
display: flex;
flex-direction: column;
gap: 14px;
gap: var(--space-3);
padding: var(--page-pad);
flex: 1 1 auto; /* 填满中栏上下文区,运行台内部自己滚 */
min-height: 0;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
/* ---------- Hero ---------- */
.hero {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
padding: 22px 24px;
background: var(--hero-grad);
}
.hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.avatar {
width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0;
display: grid; place-items: center; color: var(--tile-fg);
font-size: 22px; font-weight: 700;
box-shadow: 0 10px 22px -10px rgba(var(--text-rgb), .35);
}
.hero-meta { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.p-name { margin: 0; font-size: 19px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 9px; }
/* ---------- 页头内的场景身份 ---------- */
.p-name { display: inline-flex; align-items: center; gap: var(--space-2); }
.ver-tag {
font-size: 10.5px; font-weight: 500; color: var(--text-faint);
background: var(--surface-2); border: 1px solid var(--border);
padding: 1px 8px; border-radius: 999px;
font: 500 10.5px/16px var(--f-num); color: var(--t3);
background: var(--field); border: 1px solid var(--line);
padding: 0 var(--space-2); border-radius: var(--r-pill);
}
.p-desc { margin: 0; font-size: 12.5px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.p-badges { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.badge {
display: inline-flex; align-items: center; gap: 6px;
font-size: 11px; color: var(--badge-warm-text);
background: var(--badge-warm-bg); border: 1px solid var(--badge-warm-border);
padding: 2px 10px; border-radius: 999px;
display: inline-flex; align-items: center; gap: var(--space-1-5);
font: 500 10.5px/16px var(--f-cn);
padding: 1px var(--space-2-5); border-radius: var(--r-pill);
}
.badge.on { color: var(--ok-text); background: var(--ok-weak); border-color: rgba(var(--ok-rgb), .3); }
.badge.off { color: var(--badge-off-text); }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: var(--badge-dot); }
.badge.on .bdot { background: var(--ok); }
.hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex-shrink: 0; }
/* 运行状态 chip:仅展示进度,不可点击(执行入口在插件界面内) */
.run-chip {
display: inline-flex; align-items: center; gap: 8px;
padding: 6px 15px; border-radius: 999px;
background: var(--primary-grad-3); color: var(--on-primary);
font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
box-shadow: 0 8px 18px -10px rgba(var(--primary-rgb), .8);
}
/* 进度环用 CSS 上色(SVG 表现属性不支持 var(),故不写在 stroke="" 上) */
.ring-bg { stroke: rgba(var(--on-primary-rgb), .35); }
.ring-fg { stroke: var(--on-primary); }
.ring { display: inline-flex; }
.ring-fg { transition: stroke-dasharray .25s ease; }
.hero-tip { font-size: 10.5px; color: var(--text-faint); letter-spacing: .02em; }
.rollback-btn { margin-top: -3px; }
.badge.on { color: var(--good-ink); background: var(--good-soft); }
.badge.off { color: var(--t3); background: var(--field); }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: var(--t5); }
.badge.on .bdot { background: var(--good); }
.rollback-btn { height: 28px; padding: 0 var(--space-3); font-size: 11.5px; }
/* ---------- 结果横幅 ---------- */
.banner {
display: flex; align-items: center; gap: 11px;
padding: 12px 16px; border-radius: 14px;
display: flex; align-items: center; gap: var(--space-3);
padding: var(--space-3) var(--space-4); border-radius: var(--r-card);
flex-shrink: 0;
animation: riseIn .3s var(--ease) both;
}
.banner.ok { background: var(--ok-weak); border: 1px solid rgba(var(--ok-rgb), .35); }
.banner.err { background: var(--err-weak); border: 1px solid rgba(var(--err-rgb), .4); }
.banner.ok { background: var(--good-soft); border: 1px solid var(--good-line); }
.banner.err { background: var(--danger-soft); border: 1px solid var(--danger-line); }
.b-ic {
width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--on-primary);
width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--on-primary);
}
.banner.ok .b-ic { background: var(--ok); }
.banner.err .b-ic { background: var(--err); }
.banner.ok .b-ic { background: var(--good); }
.banner.err .b-ic { background: var(--danger); }
.b-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.b-body b { font-size: 13px; color: var(--text); font-weight: 600; }
.b-body span { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-body b { font-size: 12.5px; color: var(--t1); font-weight: 600; }
.b-body span { font-size: 11.5px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-close {
border: none; background: transparent; color: rgba(var(--text-rgb), .4);
border: none; background: transparent; color: var(--t4);
cursor: pointer; font-size: 12px; padding: 4px; border-radius: 50%;
}
.b-close:hover { color: var(--text); background: rgba(var(--on-primary-rgb), .6); }
.b-close:hover { color: var(--t1); background: var(--field); }
/* ---------- 运行台(标签页容器) ---------- */
.run-tabs {
@@ -393,80 +318,79 @@ function closeBanner() {
display: flex; flex-direction: column; overflow: hidden;
}
.rt-head {
display: flex; align-items: center; justify-content: space-between; gap: 10px;
padding: 0 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
display: flex; align-items: center; justify-content: space-between; gap: var(--space-2-5);
padding: 0 var(--space-3); border-bottom: 1px solid var(--line-soft); flex-shrink: 0;
}
.rt-tabs { display: flex; align-items: center; gap: 2px; }
.rt-tab {
display: inline-flex; align-items: center; gap: 6px;
display: inline-flex; align-items: center; gap: var(--space-1-5);
border: none; background: transparent; cursor: pointer; font-family: inherit;
padding: 11px 14px; font-size: 13px; color: var(--text-sub);
padding: var(--space-3) var(--space-3); font: 500 12.5px/18px var(--f-cn); color: var(--t3);
border-bottom: 2px solid transparent; margin-bottom: -1px;
transition: color .13s, border-color .13s;
transition: color var(--dur), border-color var(--dur);
}
.rt-tab:hover { color: var(--text); }
.rt-tab.on { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.rt-tab:hover { color: var(--t1); }
.rt-tab.on { color: var(--brand-ink); font-weight: 600; border-bottom-color: var(--brand); }
.rt-n {
font-size: 10.5px; color: var(--text-faint); background: var(--surface-2);
border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
font: 500 10px/16px var(--f-num); color: var(--t3);
background: var(--field); border-radius: var(--r-pill); padding: 0 var(--space-2);
}
.rt-tab.on .rt-n { color: var(--primary); background: var(--primary-weak); border-color: var(--primary-line); }
.rt-live { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: rtBlink 1s infinite; }
@keyframes rtBlink { 50% { opacity: .2; } }
.rt-tab.on .rt-n { color: var(--brand-ink); background: var(--brand-soft); }
.rt-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rt-log { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* ---------- 专属界面插件 ---------- */
.ui-pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 14px 16px 16px; }
.ui-pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: var(--space-3) var(--space-4) var(--space-4); }
.pui-frame {
display: block; width: 100%; flex: 1 1 auto; min-height: 340px;
border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
border: 1px solid var(--line); border-radius: var(--r-sub); background: var(--surface);
}
/* ---------- 历史运行 ---------- */
.history { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.hist-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.hist-head {
display: flex; align-items: center; justify-content: space-between; gap: 10px;
padding: 10px 16px 6px; flex-shrink: 0;
display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2-5);
padding: var(--space-2-5) var(--space-4) var(--space-1-5); flex-shrink: 0;
}
.hist-title { font-size: 12.5px; font-weight: 600; color: var(--text-sub); }
.hist-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-title { font: 600 12px/17px var(--f-cn); color: var(--t2); }
.hist-empty {
flex: 1 1 auto; display: grid; place-items: center;
color: var(--text-faint); font-size: 12.5px; padding: 30px 20px; text-align: center;
color: var(--t4); font-size: 12px; padding: var(--space-6) var(--space-5); text-align: center;
}
.hist-list { flex: 1 1 auto; min-height: 0; overflow: auto; list-style: none; margin: 4px 8px 10px; padding: 0; }
.hist-list { flex: 1 1 auto; min-height: 0; overflow: auto; list-style: none; margin: var(--space-1) var(--space-2) var(--space-2-5); padding: 0; }
.hist-item {
display: flex; align-items: center; gap: 11px;
padding: 10px 12px; border-radius: 12px; cursor: pointer;
transition: background .13s ease;
display: flex; align-items: center; gap: var(--space-3);
padding: var(--space-2) var(--space-3); border-radius: var(--r-row); cursor: pointer;
transition: background var(--dur);
}
.hist-item:hover { background: var(--surface-2); }
.hist-item:hover { background: var(--field); }
.hist-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hist-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }
.hist-dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-weak); }
.hist-dot.ok { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.hist-dot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.hist-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-meta b { font-size: 13px; color: var(--text); font-weight: 600; }
.hist-time { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.hist-state { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.hist-state.ok { color: var(--ok); }
.hist-state.err { color: var(--err); }
.hist-arrow { color: var(--text-faint); font-size: 13px; flex-shrink: 0; }
.hist-meta b { font: 600 12.5px/18px var(--f-cn); color: var(--t1); }
.hist-time { font: 400 10.5px/15px var(--f-num); color: var(--t4); }
.hist-state { font: 600 11.5px/16px var(--f-cn); flex-shrink: 0; }
.hist-state.ok { color: var(--good-ink); }
.hist-state.err { color: var(--danger-ink); }
.hist-arrow { color: var(--t5); font-size: 13px; flex-shrink: 0; }
.hist-replay { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.replay-head {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line-soft); flex-shrink: 0;
}
.replay-tags { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.replay-tags { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.replay-tag {
font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums;
background: var(--surface-2); border: 1px solid var(--border);
padding: 1px 9px; border-radius: 999px;
font: 400 10.5px/16px var(--f-num); color: var(--t3);
background: var(--field); border: 1px solid var(--line);
padding: 0 var(--space-2); border-radius: var(--r-pill);
}
.replay-sum {
font-size: 11.5px; color: var(--text-sub); white-space: nowrap;
font-size: 11px; color: var(--t2); white-space: nowrap;
overflow: hidden; text-overflow: ellipsis; max-width: 340px;
}