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:
@@ -1,27 +1,40 @@
|
||||
<template>
|
||||
<div class="paccs">
|
||||
<div v-for="p in platStatus" :key="p.id" class="pacc card">
|
||||
<div class="p-top">
|
||||
<span class="p-dot" :class="{ on: p.online }"></span>
|
||||
<span class="p-name">{{ p.label }}</span>
|
||||
<span class="p-state" :class="{ on: p.online }">{{ p.online ? '已登录' : '未登录' }}</span>
|
||||
<div class="plat-page">
|
||||
<PageHead eyebrow="PLATFORMS · 平台账号" title="平台账号" sub="账号密码仅保存在本机;登录后场景按当前账号身份执行" />
|
||||
<div class="paccs">
|
||||
<div v-if="!platStatus.length" class="pacc pacc-loading card">
|
||||
<span class="spin"></span>
|
||||
<b>{{ loading ? '正在读取平台清单…' : '暂无可用平台' }}</b>
|
||||
<span>{{ loading ? '首次启动需校验平台登录态,请稍候' : '请稍后重试或联系管理员' }}</span>
|
||||
</div>
|
||||
<div class="p-user" :class="{ none: !p.has_creds }">{{ p.has_creds ? p.user : '未配置个人账号' }}</div>
|
||||
<div class="p-acts">
|
||||
<el-button v-if="!p.online" size="small" :loading="busy === p.id" @click="login(p.id)">
|
||||
{{ busy === p.id ? '登录中…' : '登录' }}
|
||||
</el-button>
|
||||
<el-button v-else size="small" plain type="danger" :disabled="!!busy" @click="logout(p.id)">
|
||||
登出
|
||||
</el-button>
|
||||
<el-button size="small" text @click="openEdit(p)">配置账号</el-button>
|
||||
<div v-for="p in platStatus" :key="p.id" class="pacc card" :class="{ on: p.online }">
|
||||
<div class="p-top">
|
||||
<span class="p-dot" :class="{ on: p.online }"></span>
|
||||
<span class="p-name">{{ p.label }}</span>
|
||||
<span class="p-state" :class="{ on: p.online, waiting: p.has_creds === null }">
|
||||
{{ p.has_creds === null ? (failed ? '校验失败' : '校验中') : p.online ? '已登录' : '未登录' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="p-user" :class="{ none: p.has_creds === false, waiting: p.has_creds === null }">
|
||||
{{ p.has_creds === null ? (failed ? '登录态校验失败' : '正在校验登录态…') : p.has_creds ? p.user : '未配置个人账号' }}
|
||||
</div>
|
||||
<div class="p-acts">
|
||||
<el-button v-if="!p.online" size="small" :loading="busy === p.id" @click="login(p.id)">
|
||||
{{ busy === p.id ? '登录中…' : '登录' }}
|
||||
</el-button>
|
||||
<el-button v-else size="small" plain type="danger" :disabled="!!busy" @click="logout(p.id)">
|
||||
登出
|
||||
</el-button>
|
||||
<el-button size="small" text :disabled="p.has_creds === null" @click="openEdit(p)">配置账号</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="p-hint">账号密码仅本机加密保存;登录后场景按<b>你的身份</b>执行。</p>
|
||||
<p v-if="failed" class="pacc-note">
|
||||
登录态校验未完成(平台无响应或网络异常)
|
||||
<button type="button" class="pacc-retry" :disabled="loading" @click="refresh">重新校验</button>
|
||||
</p>
|
||||
|
||||
<!-- 账号配置弹窗(必须 append-to-body:本组件位于 HomePage 的 .block 内,其
|
||||
container-type: inline-size 隐含 contain: layout,会把 position:fixed 的遮罩
|
||||
劫持为卡片包含块,导致弹窗"钉"在平台账号区域而不是全屏居中) -->
|
||||
<!-- 账号配置弹窗(必须 append-to-body:避免被容器包含块劫持 fixed 定位) -->
|
||||
<el-dialog v-model="dlg" :title="`配置 ${editLabel} 账号`" width="380px" align-center
|
||||
append-to-body class="pacc-dlg">
|
||||
<el-form label-width="72px" @submit.prevent>
|
||||
@@ -46,9 +59,16 @@ import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { store, log } from '../store'
|
||||
import { loginPlatform, logoutPlatform, getPlatformStatus, savePlatformCreds } from '../api'
|
||||
import PageHead from './PageHead.vue'
|
||||
|
||||
// 当前账号的平台状态(按账号隔离:各自 HR/OA 账号密码 + 各自会话)
|
||||
const platStatus = ref([]) // [{id, label, online, has_creds, user}]
|
||||
// 先用 meta 下发的平台清单即时铺出卡片(has_creds=null 表示"校验中"),
|
||||
// 状态接口返回后再补齐登录态与已存账号,避免等待外网校验时整页空白。
|
||||
const platStatus = ref(
|
||||
store.platforms.map((p) => ({ id: p.id, label: p.label, online: !!p.online, has_creds: null, user: '' }))
|
||||
)
|
||||
const loading = ref(true) // 状态接口是否仍在进行
|
||||
const failed = ref(false) // 状态接口失败(网络/平台无响应)
|
||||
const dlg = ref(false) // 配置弹窗开关
|
||||
const editing = ref(null) // 正在配置的平台对象
|
||||
const form = reactive({ user: '', pass: '' })
|
||||
@@ -59,15 +79,23 @@ const editLabel = computed(() => (editing.value ? editing.value.label : ''))
|
||||
const hasCreds = computed(() => !!(editing.value && editing.value.has_creds))
|
||||
|
||||
async function refresh() {
|
||||
loading.value = true
|
||||
failed.value = false
|
||||
try {
|
||||
const r = await getPlatformStatus()
|
||||
platStatus.value = (r && r.platforms) || []
|
||||
const list = (r && r.platforms) || []
|
||||
if (list.length) platStatus.value = list
|
||||
// 同步全局平台在线态(首页统计/场景徽章按当前账号展示)
|
||||
for (const ps of platStatus.value) {
|
||||
const p = store.platforms.find((x) => x.id === ps.id)
|
||||
if (p) p.online = ps.online
|
||||
}
|
||||
} catch (_) { /* 静默 */ }
|
||||
} catch (e) {
|
||||
failed.value = true
|
||||
log('ERROR', `平台状态校验失败:${e.message || e}`)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(refresh)
|
||||
@@ -134,33 +162,57 @@ async function logout(id) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.paccs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
|
||||
.pacc { padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.p-top { display: flex; align-items: center; gap: 8px; }
|
||||
.plat-page { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--page-pad); flex-shrink: 0; }
|
||||
.paccs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-2-5); }
|
||||
.pacc {
|
||||
padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-2);
|
||||
background: linear-gradient(160deg, var(--subtle) 0%, var(--surface) 64%);
|
||||
}
|
||||
.pacc.on { background: linear-gradient(160deg, var(--good-soft) 0%, var(--surface) 64%); }
|
||||
.p-top { display: flex; align-items: center; gap: var(--space-2); }
|
||||
.p-dot {
|
||||
flex: none; width: 8px; height: 8px; border-radius: 50%;
|
||||
background: var(--sep-warm);
|
||||
background: var(--t5);
|
||||
}
|
||||
.p-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(var(--ok-rgb), .16); }
|
||||
.p-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
|
||||
.p-dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
|
||||
.p-name { font: 600 13px/18px var(--f-cn); color: var(--t1); }
|
||||
.p-state {
|
||||
margin-left: auto; font-size: 11px; color: var(--text-faint);
|
||||
padding: 2px 9px; border-radius: 999px; background: var(--surface-2);
|
||||
margin-left: auto; font: 500 10.5px/16px var(--f-cn); color: var(--t3);
|
||||
padding: 1px var(--space-2); border-radius: var(--r-pill); background: var(--field);
|
||||
}
|
||||
.p-state.on { color: var(--ok); background: var(--ok-weak); }
|
||||
.p-state.on { color: var(--good-ink); background: var(--good-soft); }
|
||||
.p-user {
|
||||
font-size: 11.5px; color: var(--text); font-variant-numeric: tabular-nums;
|
||||
font: 400 11.5px/16px var(--f-num); color: var(--t2);
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
.p-user.none { color: var(--text-faint); }
|
||||
.p-acts { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
|
||||
.p-user.none { color: var(--t4); }
|
||||
.p-user.waiting { color: var(--t4); }
|
||||
.p-acts { display: flex; align-items: center; gap: var(--space-1-5); margin-top: 2px; }
|
||||
.p-acts .el-button + .el-button { margin-left: 0; }
|
||||
.p-hint {
|
||||
grid-column: 1 / -1;
|
||||
margin: 2px 0 0; font-size: 11px; color: var(--text-faint); line-height: 1.7;
|
||||
}
|
||||
.p-hint b { color: var(--text-sub); }
|
||||
|
||||
/* 与首页常用场景共用同一容器查询断点:窄容器时同步降为 1 列,保证上下卡片始终对齐 */
|
||||
@container (max-width: 380px) { .paccs { grid-template-columns: 1fr; } }
|
||||
/* 校验中:避免空白页,给出明确的进度反馈 */
|
||||
.pacc-loading {
|
||||
grid-column: 1 / -1; min-height: 132px;
|
||||
align-items: center; justify-content: center; text-align: center;
|
||||
color: var(--t3); font-size: 12px;
|
||||
}
|
||||
.pacc-loading b { font: 600 13px/18px var(--f-cn); color: var(--t2); }
|
||||
.pacc-loading span { font-size: 11.5px; color: var(--t4); }
|
||||
.spin {
|
||||
width: 14px; height: 14px; border-radius: 50%;
|
||||
border: 2px solid var(--brand-track); border-top-color: var(--brand);
|
||||
animation: pacc-spin .8s linear infinite;
|
||||
}
|
||||
@keyframes pacc-spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* 校验失败提示(可手动重试) */
|
||||
.pacc-note {
|
||||
display: flex; align-items: center; gap: var(--space-2);
|
||||
margin: 0; font: 400 11.5px/16px var(--f-cn); color: var(--t4);
|
||||
}
|
||||
.pacc-retry {
|
||||
border: 0; background: none; padding: 0; cursor: pointer;
|
||||
font: 500 11.5px/16px var(--f-cn); color: var(--brand);
|
||||
}
|
||||
.pacc-retry:disabled { color: var(--t4); cursor: default; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user