build(desktop): 升级 electron-shell 版本至 1.6.3 并调整插件执行超时配置
- 插件执行超时默认延长至 6 小时,支持插件单独配置超时时间 - 新增插件根目录迁移逻辑,解决旧版权限问题 - 新增多个服务端实体、DTO、配置模块等基础代码 - 新增插件 UI 模板及相关静态资源
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 系统管理-菜单(37du 重构版,走 /api/admin/sys/menus,后端构建树)
|
||||
* 支持:新增 / 编辑 / 删除(有子级拒绝);type: 0目录 1菜单 2按钮
|
||||
*/
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { sysMenuDel, sysMenus } from '@/api/sys'
|
||||
import MenuDialog from './modules/menu-dialog.vue'
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
|
||||
const typeName = (t: number) => (Number(t) === 0 ? '目录' : Number(t) === 1 ? '菜单' : '按钮')
|
||||
const typeTag = (t: number) => (Number(t) === 0 ? 'info' : Number(t) === 1 ? 'success' : 'warning')
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const r = await sysMenus()
|
||||
list.value = r.items || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 新增/编辑对话框 ----
|
||||
const dialogVisible = ref(false)
|
||||
const dialogType = ref<'add' | 'edit'>('add')
|
||||
const currentMenu = ref<any>(null)
|
||||
const presetParentId = ref<number | null>(null)
|
||||
|
||||
function openAdd(parent?: any) {
|
||||
dialogType.value = 'add'
|
||||
currentMenu.value = null
|
||||
presetParentId.value = parent ? Number(parent.id) : null
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function openEdit(row: any) {
|
||||
dialogType.value = 'edit'
|
||||
currentMenu.value = row
|
||||
presetParentId.value = null
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleDel(row: any) {
|
||||
await ElMessageBox.confirm(`确认删除菜单「${row.name}」?`, '删除确认', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
await sysMenuDel(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
load()
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
dialogVisible.value = false
|
||||
load()
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-5 space-y-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-lg font-bold">菜单管理</h2>
|
||||
<div class="flex gap-2">
|
||||
<el-button type="primary" @click="openAdd()">新增菜单</el-button>
|
||||
<el-button :loading="loading" @click="load">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-card shadow="never" class="rounded-xl">
|
||||
<el-table v-loading="loading" :data="list" border stripe row-key="id" default-expand-all>
|
||||
<el-table-column prop="name" label="名称" min-width="180" />
|
||||
<el-table-column label="类型" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="typeTag(row.type)">{{ typeName(row.type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="router" label="路由" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="perms" label="权限标识" min-width="210" show-overflow-tooltip />
|
||||
<el-table-column prop="icon" label="图标" width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="orderNum" label="排序" width="70" />
|
||||
<el-table-column label="操作" width="170" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="Number(row.type) !== 2" link type="primary" size="small" @click="openAdd(row)">添加子级</el-button>
|
||||
<el-button link type="primary" size="small" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDel(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<MenuDialog
|
||||
v-model:visible="dialogVisible"
|
||||
:type="dialogType"
|
||||
:menu-data="currentMenu"
|
||||
:preset-parent-id="presetParentId"
|
||||
:tree="list"
|
||||
@submit="handleSubmit"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user