feat: 新增xq0031_xq0032 ERP报表导出插件,完成功能与基建更新
1. 新增xq0031_xq0032插件:包含前后端源码、打包脚本、配置文件与插件元数据 2. 新增内网文件服务器组件:exe、启停脚本、打包脚本与配置 3. 新增敏感凭证RSA加密下发能力与存储结构 4. 新增大文件源管理表与相关API 5. 优化登录流程与会话管理,新增Chrome自动化安装工具链 6. 清理废弃插件与示例代码 7. 更新版本号至1.1.3,完善安装包与.gitignore配置
This commit is contained in:
Binary file not shown.
@@ -30,7 +30,7 @@
|
||||
<aside class="aside">
|
||||
<div class="aside-inner">
|
||||
<el-menu :default-active="activeKey" @select="onMenu">
|
||||
<el-menu-item v-for="m in menuOptions" :key="m.key" :index="m.key">
|
||||
<el-menu-item v-for="m in menu" :key="m.key" :index="m.key">
|
||||
<el-icon><component :is="m.icon" /></el-icon>
|
||||
<span>{{ m.label }}</span>
|
||||
</el-menu-item>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { ArrowDown, Lock, SwitchButton, Odometer, TrendCharts, Box, User, Key, Document } from '@element-plus/icons-vue'
|
||||
import { ArrowDown, Lock, SwitchButton, Odometer, TrendCharts, Box, User, Key, Document, Files } from '@element-plus/icons-vue'
|
||||
import { ElMessage as message } from 'element-plus'
|
||||
import LoginPage from './components/LoginPage.vue'
|
||||
import PasswordDialog from './components/PasswordDialog.vue'
|
||||
@@ -59,6 +59,8 @@ 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 CredsManageView from './views/CredsManageView.vue'
|
||||
import FileSourceManageView from './views/FileSourceManageView.vue'
|
||||
import { store, clearSession } from './store'
|
||||
import { adminMe } from './api'
|
||||
|
||||
@@ -68,8 +70,11 @@ const menuOptions = [
|
||||
{ label: '插件管理', key: 'plugins', icon: Box },
|
||||
{ label: '账号管理', key: 'accounts', icon: User },
|
||||
{ label: '权限授权', key: 'grants', icon: Key },
|
||||
{ label: '敏感凭证', key: 'creds', icon: Lock, admin: true },
|
||||
{ label: '大文件源', key: 'files', icon: Files, admin: true },
|
||||
{ label: '审计报表', key: 'audit', icon: Document },
|
||||
]
|
||||
const menu = computed(() => menuOptions.filter(m => !m.admin || store.isAdmin))
|
||||
|
||||
// 轻量 hash 路由:静态站刷新安全,零后端改动
|
||||
const KEY = {
|
||||
@@ -78,6 +83,8 @@ const KEY = {
|
||||
'#/plugins': 'plugins',
|
||||
'#/accounts': 'accounts',
|
||||
'#/grants': 'grants',
|
||||
'#/creds': 'creds',
|
||||
'#/files': 'files',
|
||||
'#/audit': 'audit',
|
||||
}
|
||||
const VIEWS = {
|
||||
@@ -86,6 +93,8 @@ const VIEWS = {
|
||||
'#/plugins': PluginManageView,
|
||||
'#/accounts': AccountManageView,
|
||||
'#/grants': GrantManageView,
|
||||
'#/creds': CredsManageView,
|
||||
'#/files': FileSourceManageView,
|
||||
'#/audit': AuditView,
|
||||
}
|
||||
const route = ref(VIEWS[location.hash] ? location.hash : '#/overview')
|
||||
|
||||
@@ -5,7 +5,17 @@ async function req(url, opts) {
|
||||
const res = await fetch(url, opts)
|
||||
if (!res.ok) {
|
||||
let msg = `HTTP ${res.status}`
|
||||
try { msg = (await res.json()).detail || msg } catch (_) {}
|
||||
try {
|
||||
const detail = (await res.json()).detail
|
||||
// FastAPI 422 的 detail 是 [{loc,msg,type},…] 数组;普通错误是字符串/含 msg 的对象
|
||||
if (typeof detail === 'string') msg = detail
|
||||
else if (Array.isArray(detail)) {
|
||||
msg = detail.map((d) => {
|
||||
const where = Array.isArray(d.loc) ? d.loc.filter((p) => p !== 'body').join('.') : ''
|
||||
return where ? `${where}: ${d.msg}` : (d.msg || JSON.stringify(d))
|
||||
}).join(';')
|
||||
} else if (detail && typeof detail === 'object') msg = detail.msg || JSON.stringify(detail)
|
||||
} catch (_) { /* 非 JSON 响应,保留 HTTP 状态码提示 */ }
|
||||
throw new Error(msg)
|
||||
}
|
||||
return res.json()
|
||||
@@ -114,6 +124,40 @@ export async function adminReports(limit = 300) {
|
||||
export async function adminStats() {
|
||||
return req('/api/admin/stats', { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminCredsList() {
|
||||
return req('/api/admin/creds/manage', { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminCredsSeed(body) {
|
||||
return req('/api/admin/creds/seed', {
|
||||
method: 'POST',
|
||||
headers: adminHeaders({ 'Content-Type': 'application/json' }),
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
export async function adminFileSources(category = '') {
|
||||
const qs = category ? '?category=' + encodeURIComponent(category) : ''
|
||||
return req('/api/admin/file-sources' + qs, { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminFileSourceCreate(body) {
|
||||
return req('/api/admin/file-sources', {
|
||||
method: 'POST',
|
||||
headers: adminHeaders({ 'Content-Type': 'application/json' }),
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
export async function adminFileSourcePatch(id, body) {
|
||||
return req(`/api/admin/file-sources/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: adminHeaders({ 'Content-Type': 'application/json' }),
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
export async function adminFileSourceDelete(id) {
|
||||
return req(`/api/admin/file-sources/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: adminHeaders({ 'Content-Type': 'application/json' })
|
||||
})
|
||||
}
|
||||
export async function adminUpload(pluginId, name, version, file) {
|
||||
const fd = new FormData()
|
||||
fd.append('upload', file)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
// 图标沿用 @element-plus/icons-vue(纯 SVG 组件)
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import App from './App.vue'
|
||||
@@ -11,4 +12,5 @@ const app = createApp(App)
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
app.use(ElementPlus).mount('#app')
|
||||
// 中文语言包:日期选择器等组件的月份/按钮文案默认是英文,必须显式指定 locale
|
||||
app.use(ElementPlus, { locale: zhCn }).mount('#app')
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>敏感凭证 <span class="badge">Creds</span></h3>
|
||||
<p>执行机敏感凭证的明文源(钉钉开放平台)。保存后客户端下次启动用 RSA 私钥解密拉取;留空 = 该键不下发</p>
|
||||
</div>
|
||||
<el-button :loading="busy" :icon="Refresh" @click="refresh">刷新</el-button>
|
||||
</div>
|
||||
|
||||
<div class="cp-card panel cp-rise">
|
||||
<el-table :data="rows" v-loading="busy" size="default" style="width: 100%">
|
||||
<el-table-column prop="account" label="执行机账号" width="150">
|
||||
<template #default="{ row }">
|
||||
<span class="mono">{{ row.account }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="公钥" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.has_pubkey ? 'success' : 'info'" size="small" effect="light">
|
||||
{{ row.has_pubkey ? '已上报' : '未上报' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-for="k in keyCols" :key="k.key" :label="k.label" min-width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="mono dim" :class="{ empty: !row.creds[k.key] }">{{ row.creds[k.key] || '(未配置)' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updated_at" label="更新时间" width="170" />
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" :icon="EditPen" @click="openEdit(row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无账号,客户端启动注册后自动出现" :image-size="80" />
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dlg" :title="`编辑凭证 · ${editing?.account || ''}`" width="540px">
|
||||
<div class="form">
|
||||
<div class="fitem" v-for="k in keyCols" :key="k.key">
|
||||
<label>{{ k.label }} <span class="dim mono">({{ k.key }})</span></label>
|
||||
<el-input v-model="form[k.key]" :type="k.key.includes('SECRET') ? 'password' : 'text'"
|
||||
:show-password="k.key.includes('SECRET')" placeholder="留空 = 不下发该键" />
|
||||
</div>
|
||||
<p class="tip">值仅管理台可见;保存后客户端下次启动拉取更新(离线用本地加密缓存)。</p>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="dlg = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="save">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { Refresh, EditPen } from '@element-plus/icons-vue'
|
||||
import { ElMessage as message } from 'element-plus'
|
||||
import { adminCredsList, adminCredsSeed } from '../api'
|
||||
|
||||
const KEY_COLS = [
|
||||
{ key: 'DINGTALK_APPKEY', label: 'AppKey' },
|
||||
{ key: 'DINGTALK_APPSECRET', label: 'AppSecret' },
|
||||
{ key: 'DINGTALK_AGENT_ID', label: 'AgentId' },
|
||||
{ key: 'DINGTALK_CORP_ID', label: 'CorpId' },
|
||||
]
|
||||
|
||||
const keyCols = KEY_COLS
|
||||
const busy = ref(false)
|
||||
const rows = ref([])
|
||||
const dlg = ref(false)
|
||||
const saving = ref(false)
|
||||
const editing = ref(null)
|
||||
const form = ref({})
|
||||
|
||||
async function refresh() {
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminCredsList()
|
||||
rows.value = r.accounts || []
|
||||
} catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
|
||||
function openEdit(row) {
|
||||
editing.value = row
|
||||
form.value = {}
|
||||
keyCols.forEach(c => { form.value[c.key] = row.creds?.[c.key] || '' })
|
||||
dlg.value = true
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!editing.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
const values = {}
|
||||
keyCols.forEach(c => { if (form.value[c.key]) values[c.key] = String(form.value[c.key]).trim() })
|
||||
const r = await adminCredsSeed({ account: editing.value.account, values })
|
||||
message.success(`已保存 ${r.seeded_keys.length} 个键(留空键已清除)`)
|
||||
dlg.value = false
|
||||
await refresh()
|
||||
} catch (e) { message.error('保存失败:' + (e.message || e)) }
|
||||
finally { saving.value = false }
|
||||
}
|
||||
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.panel { padding: 22px 24px 26px; }
|
||||
.form { display: flex; flex-direction: column; gap: 16px; }
|
||||
.fitem { display: flex; flex-direction: column; gap: 7px; }
|
||||
.fitem label { font-size: 13px; font-weight: 700; color: var(--cp-ink-1); }
|
||||
.fitem .dim { font-weight: 500; font-size: 12px; }
|
||||
.empty { color: var(--cp-ink-3); }
|
||||
.tip { font-size: 12px; color: var(--cp-ink-3); margin: 2px 0 0; }
|
||||
</style>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>大文件源 <span class="badge">File Sources</span></h3>
|
||||
<p>内网大文件(壳子/Chrome 等)直链登记。中心机只存链接,文件本身走内网文件服务器</p>
|
||||
</div>
|
||||
<div class="head-actions">
|
||||
<el-select v-model="filter" placeholder="按分类过滤" style="width: 150px" clearable @change="refresh">
|
||||
<el-option v-for="c in categories" :key="c" :label="c" :value="c" />
|
||||
</el-select>
|
||||
<el-button :loading="busy" :icon="Refresh" @click="refresh">刷新</el-button>
|
||||
<el-button type="primary" :icon="Plus" @click="openCreate">登记链接</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cp-card panel cp-rise">
|
||||
<el-table :data="rows" v-loading="busy" size="default" style="width: 100%">
|
||||
<el-table-column prop="category" label="分类" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="catType(row.category)" size="small" effect="light">{{ row.category }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="version" label="版本" width="90">
|
||||
<template #default="{ row }"><span class="mono">{{ row.version }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="filename" label="文件" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="内网直链" min-width="260" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="mono dim url">{{ row.url }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="SHA256" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="row.sha256" link type="primary" @click="copy(row.sha256, 'SHA256')">
|
||||
{{ row.sha256.slice(0, 8) }}…
|
||||
</el-button>
|
||||
<span v-else class="dim">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.notes || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updated_at" label="更新时间" width="160" />
|
||||
<el-table-column label="启用" width="70" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch :model-value="!!row.enabled" :loading="row._tog" @change="(v) => toggle(row, v)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="130" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="copy(row.url, '链接')">复制</el-button>
|
||||
<el-button link type="danger" :icon="Delete" @click="remove(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无登记的大文件源" :image-size="80" />
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dlg" title="登记内网直链" width="560px">
|
||||
<div class="form">
|
||||
<div class="fitem">
|
||||
<label>分类 <span class="dim">(shell / chrome / …)</span></label>
|
||||
<el-input v-model="form.category" placeholder="如 chrome" />
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>版本</label>
|
||||
<el-input v-model="form.version" placeholder="如 1.0.0" />
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>文件名</label>
|
||||
<el-input v-model="form.filename" placeholder="如 ChromeStandaloneSetup64.exe" />
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>内网直链 url</label>
|
||||
<el-input v-model="form.url" placeholder="http://内网IP:8802/files/..." />
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>SHA256 <span class="dim">(可选)</span></label>
|
||||
<el-input v-model="form.sha256" placeholder="文件校验值,客户端下载后校验" />
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>说明 <span class="dim">(可选)</span></label>
|
||||
<el-input v-model="form.notes" type="textarea" :rows="2" placeholder="备注" />
|
||||
</div>
|
||||
<p class="tip">同一 分类+版本 会覆盖旧记录;删除仅移除中心机登记,不影响内网文件服务器上的文件。</p>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="dlg = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="save">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { Refresh, Plus, Delete } from '@element-plus/icons-vue'
|
||||
import { ElMessage as message, ElMessageBox } from 'element-plus'
|
||||
import { adminFileSources, adminFileSourceCreate, adminFileSourcePatch, adminFileSourceDelete } from '../api'
|
||||
|
||||
const CATS = ['shell', 'chrome']
|
||||
const categories = CATS
|
||||
const busy = ref(false)
|
||||
const rows = ref([])
|
||||
const filter = ref('')
|
||||
const dlg = ref(false)
|
||||
const saving = ref(false)
|
||||
const form = ref({})
|
||||
|
||||
async function refresh() {
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminFileSources(filter.value || '')
|
||||
rows.value = r.files || []
|
||||
const seen = new Set(CATS)
|
||||
;(r.files || []).forEach((f) => seen.add(f.category))
|
||||
categories.length = 0
|
||||
;[...seen].sort().forEach((c) => categories.push(c))
|
||||
} catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
|
||||
function catType(c) {
|
||||
return { shell: 'success', chrome: 'warning' }[c] || 'info'
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
form.value = { category: '', version: '', filename: '', url: '', sha256: '', notes: '', enabled: true }
|
||||
dlg.value = true
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!form.value.category || !form.value.category.trim()) return message.error('分类不能为空')
|
||||
if (!form.value.url || !form.value.url.trim()) return message.error('内网直链不能为空')
|
||||
saving.value = true
|
||||
try {
|
||||
const { enabled, ...rest } = form.value
|
||||
const body = { ...rest, category: form.value.category.trim(), url: form.value.url.trim(), enabled: true }
|
||||
await adminFileSourceCreate(body)
|
||||
message.success('已登记')
|
||||
dlg.value = false
|
||||
await refresh()
|
||||
} catch (e) { message.error('保存失败:' + (e.message || e)) }
|
||||
finally { saving.value = false }
|
||||
}
|
||||
|
||||
async function toggle(row, v) {
|
||||
row._tog = true
|
||||
try { await adminFileSourcePatch(row.id, { enabled: v }); row.enabled = v; message.success(v ? '已启用' : '已停用') }
|
||||
catch (e) { message.error('操作失败:' + (e.message || e)) }
|
||||
finally { row._tog = false }
|
||||
}
|
||||
|
||||
async function remove(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`删除「${row.category} ${row.version}」的登记?此操作仅移除中心机登记,不影响内网文件。`, '确认删除', { type: 'warning' })
|
||||
} catch (_) { return }
|
||||
try {
|
||||
await adminFileSourceDelete(row.id)
|
||||
message.success('已删除')
|
||||
await refresh()
|
||||
} catch (e) { message.error('删除失败:' + (e.message || e)) }
|
||||
}
|
||||
|
||||
async function copy(text, what) {
|
||||
try { await navigator.clipboard.writeText(text); message.success(what + '已复制') }
|
||||
catch (_) { message.error('复制失败,请手动选择') }
|
||||
}
|
||||
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.panel { padding: 22px 24px 26px; }
|
||||
.head-actions { display: flex; gap: 10px; align-items: center; }
|
||||
.form { display: flex; flex-direction: column; gap: 14px; }
|
||||
.fitem { display: flex; flex-direction: column; gap: 6px; }
|
||||
.fitem label { font-size: 13px; font-weight: 700; color: var(--cp-ink-1); }
|
||||
.fitem .dim { font-weight: 500; font-size: 12px; }
|
||||
.dim { color: var(--cp-ink-3); }
|
||||
.url { font-size: 12px; }
|
||||
.tip { font-size: 12px; color: var(--cp-ink-3); margin: 0; }
|
||||
</style>
|
||||
@@ -73,88 +73,136 @@
|
||||
</div>
|
||||
|
||||
<!-- 编辑插件 -->
|
||||
<el-dialog v-model="editShow" :title="`编辑插件 · ${edit.pid}`" width="560px" align-center destroy-on-close>
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="edit.name" placeholder="插件显示名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类">
|
||||
<el-input v-model="edit.category" placeholder="如 薪酬 / 考勤 / 社保" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-input v-model="edit.description" type="textarea" :rows="2" placeholder="插件用途说明" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="edit.status">
|
||||
<el-radio-button value="published">正常发布</el-radio-button>
|
||||
<el-radio-button value="disabled">禁用(停止分发)</el-radio-button>
|
||||
<el-radio-button value="revoked">下架(禁止运行)</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="强制更新(留空表示不强制)">
|
||||
<div class="force-row">
|
||||
<div class="force-line">
|
||||
<el-input v-model="edit.force_min" placeholder="最低版本,如 1.2.0" style="width: 180px" class="mono" />
|
||||
<el-input v-model="edit.force_dl" type="datetime-local" placeholder="截止时间" style="width: 200px" class="mono" />
|
||||
</div>
|
||||
<span class="hint">到达截止时间后,未升级到该版本的部署机会被禁止启动</span>
|
||||
<el-dialog v-model="editShow" width="720px" align-center destroy-on-close>
|
||||
<template #header>
|
||||
<div class="ed-head">
|
||||
<span class="ed-avatar">{{ (edit.name || edit.pid || '?').slice(0, 1) }}</span>
|
||||
<div class="ed-headmeta">
|
||||
<div class="ed-title mono">{{ edit.pid }}</div>
|
||||
<div class="ed-sub">修改基础信息、发布状态与强制更新策略</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-position="top" class="ed-form">
|
||||
<div class="ed-sec">
|
||||
<div class="ed-sec-title">基本信息</div>
|
||||
<div class="form-2col">
|
||||
<el-form-item label="插件名称">
|
||||
<el-input v-model="edit.name" placeholder="插件显示名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类">
|
||||
<el-input v-model="edit.category" placeholder="如 薪酬 / 考勤 / 社保" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ed-sec">
|
||||
<div class="ed-sec-title">插件描述</div>
|
||||
<el-form-item>
|
||||
<el-input v-model="edit.description" type="textarea" :autosize="{ minRows: 5, maxRows: 12 }"
|
||||
maxlength="500" show-word-limit placeholder="插件用途说明(支持换行,执行端与详情页均会展示)" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="ed-sec">
|
||||
<div class="ed-sec-title">发布状态</div>
|
||||
<el-form-item>
|
||||
<el-radio-group v-model="edit.status">
|
||||
<el-radio-button value="published">正常发布</el-radio-button>
|
||||
<el-radio-button value="disabled">禁用(停止分发)</el-radio-button>
|
||||
<el-radio-button value="revoked">下架(禁止运行)</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="ed-sec">
|
||||
<div class="ed-sec-title">强制更新 <span class="ed-opt">可选 · 两项都填才会生效</span></div>
|
||||
<div class="force-box">
|
||||
<div class="force-line">
|
||||
<el-input v-model="edit.force_min" placeholder="最低版本,如 1.2.0" style="width: 190px" class="mono" />
|
||||
<el-date-picker v-model="edit.force_dl" type="datetime" value-format="YYYY-MM-DD[T]HH:mm"
|
||||
format="YYYY-MM-DD HH:mm" placeholder="截止时间" style="width: 220px" class="mono" />
|
||||
</div>
|
||||
<div class="hint">到达截止时间后,未升级到该版本的部署机会被禁止启动;留空表示不强制</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="modal-foot">
|
||||
<el-button @click="editShow = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="saveEdit">保存</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="saveEdit">保存修改</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 插件详情 -->
|
||||
<el-dialog v-model="detailShow" :title="`插件详情 · ${detail?.id || ''}`" width="640px" align-center destroy-on-close>
|
||||
<el-dialog v-model="detailShow" width="780px" align-center destroy-on-close>
|
||||
<template #header>
|
||||
<div class="dt-head" v-if="detail">
|
||||
<span class="dt-avatar">{{ (detail.name || detail.id || '?').slice(0, 1) }}</span>
|
||||
<div class="dt-headmeta">
|
||||
<div class="dt-title-row">
|
||||
<span class="dt-id mono">{{ detail.id }}</span>
|
||||
<el-tag size="small" round effect="light" :type="statusMeta[detail.status]?.type || 'info'">
|
||||
{{ statusMeta[detail.status]?.label || detail.status || '—' }}
|
||||
</el-tag>
|
||||
<el-tag v-if="detail.category" size="small" round effect="plain" type="info">{{ detail.category }}</el-tag>
|
||||
</div>
|
||||
<div class="dt-name">{{ detail.name || '未命名插件' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="detail" class="plg-detail">
|
||||
<div class="d-head">
|
||||
<span class="d-id mono">{{ detail.id }}</span>
|
||||
<span class="d-name">{{ detail.name }}</span>
|
||||
<el-tag size="small" round effect="light" :type="statusMeta[detail.status]?.type || 'info'">
|
||||
{{ statusMeta[detail.status]?.label || detail.status || '—' }}
|
||||
</el-tag>
|
||||
<div class="dt-grid">
|
||||
<div class="dt-item">
|
||||
<el-icon class="dt-ic"><Box /></el-icon>
|
||||
<div><label>最新版本</label><span class="mono">{{ detail.latest_version || '—' }}</span></div>
|
||||
</div>
|
||||
<div class="dt-item">
|
||||
<el-icon class="dt-ic"><Files /></el-icon>
|
||||
<div><label>表单字段</label><span class="mono">{{ detail.field_count || 0 }} 项</span></div>
|
||||
</div>
|
||||
<div class="dt-item">
|
||||
<el-icon class="dt-ic"><User /></el-icon>
|
||||
<div><label>授权账号</label><span class="mono">{{ detail.accounts?.length || 0 }} 个</span></div>
|
||||
</div>
|
||||
<div class="dt-item">
|
||||
<el-icon class="dt-ic" :class="{ 'dt-ic-on': detail.force_min_version && detail.force_deadline }"><Clock /></el-icon>
|
||||
<div><label>强制更新</label><span>{{ forceText(detail) }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<div class="d-item"><label>分类</label><span>{{ detail.category || '—' }}</span></div>
|
||||
<div class="d-item"><label>最新版本</label><span class="mono">{{ detail.latest_version || '—' }}</span></div>
|
||||
<div class="d-item"><label>表单字段</label><span class="mono">{{ detail.field_count || 0 }}</span></div>
|
||||
<div class="d-item"><label>强制更新</label><span>{{ forceText(detail) }}</span></div>
|
||||
<div class="dt-sec">
|
||||
<div class="ed-sec-title">插件描述</div>
|
||||
<p class="dt-desc">{{ detail.description || '暂无描述' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="d-sec"><label>描述</label><p class="d-desc">{{ detail.description || '—' }}</p></div>
|
||||
|
||||
<div class="d-sec">
|
||||
<label>能力</label>
|
||||
<div class="dt-sec">
|
||||
<div class="ed-sec-title">能力声明</div>
|
||||
<div class="tags" v-if="detail.capabilities?.length">
|
||||
<el-tag v-for="c in detail.capabilities" :key="c" size="small" effect="plain" round>{{ c }}</el-tag>
|
||||
<el-tag v-for="c in detail.capabilities" :key="c" size="small" effect="plain" round class="mono">{{ c }}</el-tag>
|
||||
</div>
|
||||
<span v-else class="dim">—</span>
|
||||
</div>
|
||||
|
||||
<div class="d-sec">
|
||||
<label>版本历史</label>
|
||||
<div class="vlist" v-if="detail.versions?.length">
|
||||
<div class="vrow" v-for="v in detail.versions" :key="v.version">
|
||||
<el-tag size="small" round effect="light" class="mono"
|
||||
:type="v.version === detail.latest_version ? 'primary' : 'info'">{{ v.version }}</el-tag>
|
||||
<span class="vtime mono dim-sm">{{ fmtTime(v.uploaded_at) }}</span>
|
||||
<div class="dt-cols">
|
||||
<div class="dt-sec">
|
||||
<div class="ed-sec-title">版本历史</div>
|
||||
<div class="vlist" v-if="detail.versions?.length">
|
||||
<div class="vrow" v-for="v in detail.versions" :key="v.version">
|
||||
<el-tag size="small" round effect="light" class="mono"
|
||||
:type="v.version === detail.latest_version ? 'primary' : 'info'">{{ v.version }}</el-tag>
|
||||
<el-tag v-if="v.version === detail.latest_version" size="small" round effect="plain"
|
||||
type="success" class="v-latest">当前</el-tag>
|
||||
<span class="vtime mono dim-sm">{{ fmtTime(v.uploaded_at) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="dim">暂无版本</span>
|
||||
</div>
|
||||
<span v-else class="dim">暂无版本</span>
|
||||
</div>
|
||||
|
||||
<div class="d-sec">
|
||||
<label>授权账号</label>
|
||||
<div class="tags" v-if="detail.accounts?.length">
|
||||
<el-tag v-for="a in detail.accounts" :key="a" size="small" effect="plain" type="success" round class="mono">{{ a }}</el-tag>
|
||||
<div class="dt-sec">
|
||||
<div class="ed-sec-title">授权账号</div>
|
||||
<div class="tags" v-if="detail.accounts?.length">
|
||||
<el-tag v-for="a in detail.accounts" :key="a" size="small" effect="plain" type="success" round class="mono">{{ a }}</el-tag>
|
||||
</div>
|
||||
<span v-else class="dim">未授权任何账号,执行端不可见</span>
|
||||
</div>
|
||||
<span v-else class="dim">未授权</span>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
@@ -167,7 +215,7 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage as message, ElMessageBox as dialog } from 'element-plus'
|
||||
import { Refresh, UploadFilled, FolderOpened, Edit, Delete, View } from '@element-plus/icons-vue'
|
||||
import { Refresh, UploadFilled, FolderOpened, Edit, Delete, View, Box, Files, User, Clock } from '@element-plus/icons-vue'
|
||||
import { overview, overviewBusy, loadOverview } from '../store'
|
||||
import { adminUpload, adminPluginDelete, adminPluginPatch } from '../api'
|
||||
import { fmtTime } from '../format'
|
||||
@@ -225,9 +273,10 @@ async function saveEdit() {
|
||||
saving.value = true
|
||||
try {
|
||||
const body = { name: edit.name, category: edit.category, description: edit.description, status: edit.status }
|
||||
// 强制更新:min 与 deadline 均填则成对下发;否则清除强制更新
|
||||
body.force_min_version = edit.force_min || null
|
||||
body.force_deadline = edit.force_dl ? new Date(edit.force_dl).toISOString() : null
|
||||
// 强制更新:min 与 deadline 均填则成对下发;否则清除强制更新。
|
||||
// 注意:后端 PluginPatchIn 的 str 字段不接受 null,空值必须传 ''(否则 422 保存失败)
|
||||
body.force_min_version = edit.force_min || ''
|
||||
body.force_deadline = edit.force_dl ? new Date(edit.force_dl).toISOString() : ''
|
||||
body.clear_force = !(edit.force_min && edit.force_dl)
|
||||
await adminPluginPatch(edit.pid, body)
|
||||
message.success(`已更新插件 ${edit.pid}`)
|
||||
@@ -271,27 +320,53 @@ onMounted(refresh)
|
||||
.up-form :deep(.el-form-item) { margin-bottom: 16px; }
|
||||
.file-row { display: flex; align-items: center; gap: 10px; }
|
||||
.hint { font-size: 12px; color: var(--cp-ink-3); margin-top: 2px; line-height: 1.7; }
|
||||
.force-row { display: flex; flex-direction: column; gap: 8px; width: 100%; }
|
||||
.force-line { display: flex; gap: 10px; }
|
||||
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; }
|
||||
.cell-ops { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
|
||||
.cell-ops .el-button { padding: 0 4px; }
|
||||
.cell-ops .el-button + .el-button { margin-left: 0; }
|
||||
|
||||
/* 插件详情 */
|
||||
.plg-detail { display: flex; flex-direction: column; gap: 18px; }
|
||||
.d-head { display: flex; align-items: center; gap: 10px; }
|
||||
.d-id { font-size: 16px; font-weight: 800; color: var(--cp-ink-1); }
|
||||
.d-name { font-size: 15px; color: var(--cp-ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.d-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
|
||||
.d-item { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; background: var(--cp-panel-2); border-radius: 12px; }
|
||||
.d-item label { font-size: 11px; font-weight: 700; color: var(--cp-ink-3); letter-spacing: .4px; }
|
||||
.d-item span { font-size: 13px; font-weight: 600; color: var(--cp-ink-1); }
|
||||
.d-sec { display: flex; flex-direction: column; gap: 8px; }
|
||||
.d-sec > label { font-size: 11px; font-weight: 700; color: var(--cp-ink-3); letter-spacing: .4px; }
|
||||
.d-desc { margin: 0; font-size: 13px; line-height: 1.7; color: var(--cp-ink); background: var(--cp-panel-2); padding: 10px 14px; border-radius: 10px; }
|
||||
.vlist { display: flex; flex-direction: column; gap: 6px; }
|
||||
.vrow { display: flex; align-items: center; gap: 12px; }
|
||||
.vtime { font-size: 12px; }
|
||||
/* 弹窗通用 */
|
||||
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; }
|
||||
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
|
||||
.hint { font-size: 12px; color: var(--cp-ink-3); line-height: 1.7; }
|
||||
|
||||
/* 编辑弹窗:分区卡片 */
|
||||
.ed-head { display: flex; align-items: center; gap: 12px; }
|
||||
.ed-avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 800; background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal)); box-shadow: var(--cp-shadow); flex-shrink: 0; }
|
||||
.ed-headmeta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.ed-title { font-size: 15px; font-weight: 800; color: var(--cp-ink-1); }
|
||||
.ed-sub { font-size: 12px; color: var(--cp-ink-3); }
|
||||
.ed-sec { margin-bottom: 12px; padding: 13px 16px 3px; background: var(--cp-panel-2); border-radius: 12px; }
|
||||
.ed-sec :deep(.el-form-item) { margin-bottom: 13px; }
|
||||
.ed-sec-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--cp-ink-2); letter-spacing: .5px; margin-bottom: 10px; }
|
||||
.ed-sec-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--cp-blue); }
|
||||
.ed-opt { font-weight: 500; color: var(--cp-ink-3); letter-spacing: 0; }
|
||||
.force-box { display: flex; flex-direction: column; gap: 8px; padding-bottom: 13px; }
|
||||
.force-line { display: flex; gap: 10px; }
|
||||
|
||||
/* 详情弹窗:头部 + 统计卡 + 分区 */
|
||||
.plg-detail { display: flex; flex-direction: column; gap: 14px; max-height: 66vh; overflow-y: auto; padding-right: 6px; }
|
||||
.dt-head { display: flex; align-items: center; gap: 12px; }
|
||||
.dt-avatar { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 800; background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal)); box-shadow: var(--cp-shadow); flex-shrink: 0; }
|
||||
.dt-headmeta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||
.dt-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.dt-id { font-size: 15px; font-weight: 800; color: var(--cp-ink-1); }
|
||||
.dt-name { font-size: 13px; color: var(--cp-ink-2); }
|
||||
.dt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
|
||||
.dt-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--cp-panel-2); border-radius: 12px; min-width: 0; }
|
||||
.dt-ic { font-size: 20px; color: var(--cp-ink-3); flex-shrink: 0; }
|
||||
.dt-ic-on { color: var(--cp-amber); }
|
||||
.dt-item div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||
.dt-item label { font-size: 11px; font-weight: 700; color: var(--cp-ink-3); letter-spacing: .4px; }
|
||||
.dt-item span { font-size: 13px; font-weight: 600; color: var(--cp-ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.dt-sec { display: flex; flex-direction: column; }
|
||||
.dt-desc { margin: 0; font-size: 13px; line-height: 1.9; color: var(--cp-ink); background: var(--cp-panel-2); padding: 12px 16px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
|
||||
.dt-cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
|
||||
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.vlist { display: flex; flex-direction: column; gap: 8px; }
|
||||
.vrow { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--cp-panel-2); border-radius: 9px; }
|
||||
.vtime { font-size: 12px; margin-left: auto; }
|
||||
.dim-sm { color: var(--cp-ink-3); }
|
||||
.dim { font-size: 12px; color: var(--cp-ink-3); }
|
||||
</style>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user