feat: 完成插件管理系统产品化P0闭环落地
此提交实现完整的插件管理产品化闭环: 1. 中心机新增Ed25519密钥、审计/运行上报表、插件扩展字段,实现票据/管控清单签发、鉴权下载能力 2. 部署端新增设备级单活调度器、用户私有插件库、离线/联网校验链、插件下载安装流程 3. 控制面与部署前端同步更新UI与接口适配,新增审计页、插件管理增强功能 4. 修复两个工作流脚本的过滤与Excel导出问题,优化打包依赖与日志面板 5. 新增完整架构设计与实施文档
This commit is contained in:
@@ -1,94 +1,112 @@
|
||||
<template>
|
||||
<LoginPage v-if="!store.current" :app-name="store.appName" @ok="onLogin" />
|
||||
<el-container class="console" v-else>
|
||||
<el-header class="topbar" height="56px">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
<strong>{{ store.appName }}</strong>
|
||||
<span>中心机控制面</span>
|
||||
<n-config-provider :theme-overrides="themeOverrides" :locale="zhCN" :date-locale="dateZhCN">
|
||||
<LoginPage v-if="!store.current" :app-name="store.appName" @ok="onLogin" />
|
||||
<div class="console" v-else>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
<strong>{{ store.appName }}</strong>
|
||||
<span>中心机 · 控制面</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<n-dropdown trigger="click" :options="acctOptions" @select="onCommand">
|
||||
<div class="acct">
|
||||
<span class="avatar">{{ initial }}</span>
|
||||
<span class="acct-name">{{ store.current }}</span>
|
||||
<n-tag v-if="store.isAdmin" size="small" round :bordered="false" type="primary" class="admin-tag">管理员</n-tag>
|
||||
<n-icon class="caret" :size="13"><ArrowDown /></n-icon>
|
||||
</div>
|
||||
</n-dropdown>
|
||||
</header>
|
||||
|
||||
<div class="body">
|
||||
<aside class="aside">
|
||||
<div class="aside-inner">
|
||||
<n-menu class="menu" :value="activeKey" :options="menuOptions" :root-indent="0" @update:value="onMenu" />
|
||||
</div>
|
||||
<div class="aside-foot">
|
||||
<span>37du 自动化</span>
|
||||
<span class="ver">v0.1.0</span>
|
||||
</div>
|
||||
</aside>
|
||||
<main class="main">
|
||||
<component :is="viewComp" :key="route" />
|
||||
</main>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<el-dropdown trigger="click" @command="onCommand">
|
||||
<span class="acct">
|
||||
<el-icon><UserFilled /></el-icon>
|
||||
{{ store.current }}
|
||||
<el-tag v-if="store.isAdmin" size="small" type="primary" effect="light" round>管理员</el-tag>
|
||||
<el-icon class="caret"><ArrowDown /></el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="pwd">修改密码</el-dropdown-item>
|
||||
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-header>
|
||||
|
||||
<el-container class="body">
|
||||
<el-aside width="180px" class="aside">
|
||||
<el-menu :default-active="route" router class="menu" @select="onMenu">
|
||||
<el-menu-item index="#/overview">
|
||||
<el-icon><Odometer /></el-icon><span>概览</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/plugins">
|
||||
<el-icon><Box /></el-icon><span>插件管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/accounts">
|
||||
<el-icon><User /></el-icon><span>账号管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/grants">
|
||||
<el-icon><Key /></el-icon><span>权限授权</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-main class="main">
|
||||
<component :is="viewComp" :key="route" />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
||||
<PasswordDialog v-model="pwdOpen" />
|
||||
</div>
|
||||
<PasswordDialog v-model="pwdOpen" />
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { UserFilled, ArrowDown, Odometer, Box, User, Key } from '@element-plus/icons-vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import { themeOverrides, zhCN, dateZhCN, message } from './naive'
|
||||
import LoginPage from './components/LoginPage.vue'
|
||||
import PasswordDialog from './components/PasswordDialog.vue'
|
||||
import OverviewView from './views/OverviewView.vue'
|
||||
import PluginManageView from './views/PluginManageView.vue'
|
||||
import AccountManageView from './views/AccountManageView.vue'
|
||||
import GrantManageView from './views/GrantManageView.vue'
|
||||
import StatsView from './views/StatsView.vue'
|
||||
import AuditView from './views/AuditView.vue'
|
||||
import { store, clearSession } from './store'
|
||||
import { adminMe } from './api'
|
||||
|
||||
const menuOptions = [
|
||||
{ label: '概览', key: 'overview' },
|
||||
{ label: '数据看板', key: 'stats' },
|
||||
{ label: '插件管理', key: 'plugins' },
|
||||
{ label: '账号管理', key: 'accounts' },
|
||||
{ label: '权限授权', key: 'grants' },
|
||||
{ label: '审计报表', key: 'audit' },
|
||||
]
|
||||
const acctOptions = [
|
||||
{ label: '修改密码', key: 'pwd' },
|
||||
{ type: 'divider', key: 'd1' },
|
||||
{ label: '退出登录', key: 'logout' },
|
||||
]
|
||||
|
||||
// 轻量 hash 路由:StaticFiles(html=True) 下刷新安全,零后端改动
|
||||
const route = ref(location.hash && VIEWS[location.hash] ? location.hash : '#/overview')
|
||||
const KEY = {
|
||||
'#/overview': 'overview',
|
||||
'#/stats': 'stats',
|
||||
'#/plugins': 'plugins',
|
||||
'#/accounts': 'accounts',
|
||||
'#/grants': 'grants',
|
||||
'#/audit': 'audit',
|
||||
}
|
||||
const VIEWS = {
|
||||
'#/overview': OverviewView,
|
||||
'#/stats': StatsView,
|
||||
'#/plugins': PluginManageView,
|
||||
'#/accounts': AccountManageView,
|
||||
'#/grants': GrantManageView,
|
||||
'#/audit': AuditView,
|
||||
}
|
||||
const route = ref(VIEWS[location.hash] ? location.hash : '#/overview')
|
||||
window.addEventListener('hashchange', () => {
|
||||
if (VIEWS[location.hash]) route.value = location.hash
|
||||
})
|
||||
const viewComp = computed(() => VIEWS[route.value] || OverviewView)
|
||||
const activeKey = computed(() => KEY[route.value] || 'overview')
|
||||
|
||||
function onMenu(index) {
|
||||
location.hash = index
|
||||
route.value = index
|
||||
function onMenu(key) {
|
||||
const h = '#/' + key
|
||||
location.hash = h
|
||||
route.value = h
|
||||
}
|
||||
|
||||
const initial = computed(() => (store.current || '')[0]?.toUpperCase() || '?')
|
||||
|
||||
const pwdOpen = ref(false)
|
||||
function onCommand(cmd) {
|
||||
if (cmd === 'pwd') pwdOpen.value = true
|
||||
else if (cmd === 'logout') {
|
||||
clearSession()
|
||||
ElMessage.success('已退出登录')
|
||||
message.success('已退出登录')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,23 +127,89 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.console { height: 100vh; background: #f5f7fa; }
|
||||
.topbar { display: flex; align-items: center; gap: 16px; background: #fff;
|
||||
border-bottom: 1px solid var(--el-border-color-light); }
|
||||
.brand { display: flex; align-items: center; gap: 11px; }
|
||||
.logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
|
||||
background: var(--el-color-primary); color: #fff; font-size: 13px; font-weight: 800; }
|
||||
.brand-meta { display: flex; flex-direction: column; line-height: 1.25; }
|
||||
.brand-meta strong { font-size: 14px; color: var(--el-text-color-primary); }
|
||||
.brand-meta span { font-size: 11px; color: var(--el-text-color-secondary); }
|
||||
.spacer { flex: 1; }
|
||||
.acct { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
|
||||
color: var(--el-text-color-primary); cursor: pointer; outline: none; }
|
||||
.acct .caret { font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.console { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
|
||||
|
||||
.body { min-height: 0; }
|
||||
.aside { background: #fff; border-right: 1px solid var(--el-border-color-light); padding-top: 10px; }
|
||||
.menu { border-right: none; }
|
||||
.menu .el-menu-item { height: 44px; }
|
||||
.main { padding: 18px 20px; overflow: auto; }
|
||||
/* ---------- 顶栏:磨砂玻璃 ---------- */
|
||||
.topbar {
|
||||
height: 64px; flex-shrink: 0;
|
||||
display: flex; align-items: center; gap: 16px;
|
||||
padding: 0 24px;
|
||||
background: rgba(255, 255, 255, .72);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border-bottom: 1px solid var(--cp-border);
|
||||
position: relative; z-index: 20;
|
||||
}
|
||||
.topbar::after {
|
||||
content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
|
||||
background: linear-gradient(90deg, transparent, rgba(59, 108, 255, .35), rgba(34, 199, 232, .35), transparent);
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 12px; }
|
||||
.logo {
|
||||
width: 38px; height: 38px; border-radius: 12px;
|
||||
display: grid; place-items: center; position: relative;
|
||||
background: linear-gradient(135deg, #3b6cff 0%, #22c7e8 130%);
|
||||
color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .5px;
|
||||
box-shadow: 0 6px 16px -6px rgba(59, 108, 255, .6);
|
||||
}
|
||||
.logo::after { content: ''; position: absolute; inset: 2px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .28); }
|
||||
.brand-meta { display: flex; flex-direction: column; line-height: 1.25; }
|
||||
.brand-meta strong { font-size: 15px; color: var(--cp-ink); letter-spacing: .2px; }
|
||||
.brand-meta span { font-size: 11px; color: var(--cp-ink-3); letter-spacing: .4px; }
|
||||
.spacer { flex: 1; }
|
||||
|
||||
.acct {
|
||||
display: flex; align-items: center; gap: 9px; cursor: pointer;
|
||||
padding: 6px 10px; border-radius: 12px; transition: background .18s;
|
||||
}
|
||||
.acct:hover { background: rgba(59, 108, 255, .07); }
|
||||
.avatar {
|
||||
width: 30px; height: 30px; border-radius: 50%;
|
||||
display: grid; place-items: center;
|
||||
background: linear-gradient(135deg, #3b6cff, #22c7e8);
|
||||
color: #fff; font-size: 13px; font-weight: 700;
|
||||
}
|
||||
.acct-name { font-size: 13px; font-weight: 600; color: var(--cp-ink); }
|
||||
.admin-tag { margin-left: 2px; }
|
||||
.caret { color: var(--cp-ink-3); }
|
||||
|
||||
/* ---------- 主体:悬浮侧栏 + 内容区 ---------- */
|
||||
.body { flex: 1; display: flex; gap: 18px; padding: 18px 24px 24px; min-height: 0; }
|
||||
.aside {
|
||||
width: 208px; flex-shrink: 0;
|
||||
display: flex; flex-direction: column;
|
||||
background: rgba(255, 255, 255, .78);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
border: 1px solid var(--cp-border);
|
||||
border-radius: 18px;
|
||||
box-shadow: var(--cp-card-shadow);
|
||||
padding: 14px 10px;
|
||||
}
|
||||
.aside-inner { flex: 1; }
|
||||
.aside-foot {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 12px 12px 4px; margin-top: 8px;
|
||||
border-top: 1px dashed var(--cp-border);
|
||||
font-size: 11px; color: var(--cp-ink-3);
|
||||
}
|
||||
.main { flex: 1; min-width: 0; overflow: auto; padding: 4px 4px 8px; }
|
||||
|
||||
/* 页面切换过渡:轻微上浮淡入 */
|
||||
.view-fade-enter-active { transition: opacity .22s ease, transform .22s ease; }
|
||||
.view-fade-leave-active { transition: opacity .12s ease; }
|
||||
.view-fade-enter-from { opacity: 0; transform: translateY(8px); }
|
||||
.view-fade-leave-to { opacity: 0; }
|
||||
|
||||
/* ---------- 侧栏菜单:干净的标准导航,配色由 naive 主题统一控制 ---------- */
|
||||
.menu { padding: 2px; }
|
||||
.menu :deep(.n-menu-item) { margin-bottom: 4px; }
|
||||
.menu :deep(.n-menu-item-content) {
|
||||
/* 无图标时 naive 给 `padding-left:0` 的内联样式,需 !important 压过,
|
||||
否则文字贴左边界、跑出圆角底色区域 */
|
||||
padding-left: 16px !important;
|
||||
padding-right: 16px !important;
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user