fetch(modify):完善按钮权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m25s

This commit is contained in:
sexygoat
2026-02-03 17:20:50 +08:00
parent de9753f42d
commit 192c6f1d26
22 changed files with 885 additions and 232 deletions

View File

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增权限</ElButton>
<ElButton @click="showDialog('add')" v-permission="'permission:add'">新增权限</ElButton>
</template>
</ArtTableHeader>
@@ -125,6 +125,7 @@
import type { CreatePermissionParams, PermissionTreeNode } from '@/types/api'
import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import {
PermissionType,
@@ -138,6 +139,8 @@
defineOptions({ name: 'Permission' })
const { hasAuth } = useAuth()
// 搜索表单初始值
const initialSearchState = {
perm_name: '',
@@ -299,16 +302,27 @@
width: 120,
fixed: 'right',
formatter: (row: PermissionTreeNode) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePermission(row)
})
])
const buttons = []
if (hasAuth('permission:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('permission:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deletePermission(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])